From patchwork Mon Jan 16 14:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 44198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1232556wrn; Mon, 16 Jan 2023 06:54:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXthaZb5HmhIU84ZXohASZJeiOZaf02SgY3J9DtWj5BeFwOuznMIU9b30v24eS0zJsgb9LU8 X-Received: by 2002:a17:902:da91:b0:188:760f:d831 with SMTP id j17-20020a170902da9100b00188760fd831mr108290plx.7.1673880858926; Mon, 16 Jan 2023 06:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673880858; cv=none; d=google.com; s=arc-20160816; b=eZKAg+ewIavfyQt7F37m92gzAiSL07KxyXBNav5fGLxvXV9cuO4kbOZUTmVpud7jnN QAqTLFcX+0wxrKCjP3p9AnNTRP4DhNx8ZxIIG8sA0JIA2tjD810BnuE2dKT3XiDcSkDU s3J+oKIDzo4YmxRA7WoF1kTGGxNGMj0i6CDYwPbwNolok5wI73c31mnPxyDBAQBZ9SS4 1YSF2wmWLdW6i0tdQPJrGfuXHnbysprXnDljkw9Bml1xOQZXEUzKgijhHKcz7Jt1eS4O oUxffBB1cZoH99cTssIoaQasByjwWGY3WHCjN8lB02tGVzqtChWCaNfPP2dLLbjne5rH 6uEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=Mc6JE/lSqhoI08ZCOd1MO1vmLEzmsp/ETRSpv4hRS+8=; b=PuM6Edf+r7xht7rFFDZF9abi5SxjQzhK2JkE4XAPVr/u4wkdu31WXYnAWgeWK13iSJ Y4qvzGy9HgS4zKR2XYTeedrSsiagyhZfNjcMLA58myOPfUV3gqBPz/pDViKbGWs2zquu NPPUXxbM0AJki9mnC64sq7zx+TWHY+nB0IUsaSXy2URuGGDNYC98E19p3ibi2CQj3e1M 15iam6+axgyPvWjQZty8tZmPF82uqAu2nhCKWqvtZcFjhRz1NMQrW40vhG5I2dWfS4YD czHusFPz+bybyiL/n2EjvScZ4DAtk1P9q1Z02MW3D4RfaJbVwSYEUi9uxwy4rRR2Z/U9 St8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=T1nrQTJt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a170902b21400b0019491eabca0si1066455plr.98.2023.01.16.06.54.07; Mon, 16 Jan 2023 06:54:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=T1nrQTJt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbjAPOw6 (ORCPT + 99 others); Mon, 16 Jan 2023 09:52:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjAPOwN (ORCPT ); Mon, 16 Jan 2023 09:52:13 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43522BF13 for ; Mon, 16 Jan 2023 06:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=Mc6JE/lSqhoI08ZCOd1MO1vmLEzmsp/ETRSpv4hRS+8=; b=T1nrQTJttu/3Jnm9EJrYVDiMxC s34Y8QKh6Os9ywtC1Z1w2DiWPN6Xf9K5GkRtu6DtxWWsA8ej0VDBcu9iVcitzgXSTWCKMPsZsT/yv UyAjSANcObXIQvCe1J1cb2ZFm0PgpHHKh22ywjkdRZY49ET7hYiwVX9R/AkWzL156Ux4u1mcKbpW3 wubPrTdQVa+IM+KQkoM2pcN0SQ8YrHNTvKlSQpXlxOMZ0Z7Y2ts9qxviLI1ZgAHkTz7oQ5Z95SZu9 jTowvNgMdlt4jqLsw2QD7LpDyIe1S1Qwn8XSQdU41tuNFe9PXsjS6ESqii8W89Nd11lkxG5d+ERsF kQkbM/9A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHQcU-008oZF-RG; Mon, 16 Jan 2023 14:37:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 56162300C6F; Mon, 16 Jan 2023 15:37:39 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id B9FA620EF0A23; Mon, 16 Jan 2023 15:37:38 +0100 (CET) Message-ID: <20230116143645.829076358@infradead.org> User-Agent: quilt/0.66 Date: Mon, 16 Jan 2023 15:25:38 +0100 From: Peter Zijlstra To: x86@kernel.org, Joan Bruguera Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, Juergen Gross , "Rafael J. Wysocki" , xen-devel , Jan Beulich , Roger Pau Monne , Kees Cook , mark.rutland@arm.com, Andrew Cooper , =?utf-8?b?SsO2cmcgUsO2ZGVs?= , "H. Peter Anvin" Subject: [PATCH v2 5/7] x86/callthunk: No callthunk for restore_processor_state() References: <20230116142533.905102512@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755191295659186469?= X-GMAIL-MSGID: =?utf-8?q?1755191295659186469?= From: Joan Bruguera When resuming from suspend we don't have coherent CPU state, trying to do callthunks here isn't going to work. Specifically GS isn't set yet. Fixes: e81dc127ef69 ("x86/callthunks: Add call patching for call depth tracking") Signed-off-by: Joan Bruguera Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230109040531.7888-1-joanbrugueram@gmail.com --- arch/x86/kernel/callthunks.c | 5 +++++ arch/x86/power/cpu.c | 3 +++ 2 files changed, 8 insertions(+) --- a/arch/x86/kernel/callthunks.c +++ b/arch/x86/kernel/callthunks.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -151,6 +152,10 @@ static bool skip_addr(void *dest) dest < (void*)hypercall_page + PAGE_SIZE) return true; #endif +#ifdef CONFIG_PM_SLEEP + if (dest == restore_processor_state) + return true; +#endif return false; }