Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2844331ybk; Mon, 18 May 2020 09:15:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu+A+3D0lM0lVGGC/croVZV3OdasBeTRD6milLKmmo4+soIXtzaigP2sCNDHakhiKncCO9 X-Received: by 2002:a05:6402:c2:: with SMTP id i2mr14635208edu.224.1589818515499; Mon, 18 May 2020 09:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589818515; cv=none; d=google.com; s=arc-20160816; b=bdHut1ywHPwyZiDkV47WmvsVes1uzY9L4s/XI3HziiCPIcBZeynsVHB6P6BmF6p5N4 VBpEOkKchDdPrEy3fb7o8qyS4smPxl2JfGPuwMVkHGILU/9Bfpw73qH3LnFtV8aNzVge gQW9S9ge7KyTbyjzwaqm/o/oVTMPs5x+p1T8LT1Q+jPy6pfggLKP2cI8gU6TktraF7D7 mcE4080opRge6d9dCXrL79CYY2Z43NDRXb4WYpBGDENwwye20h6UrhAXHAnxI8rvwtLU j1/nmSqZ5zeYFh1d6o9PlC4oYIjZZ6CAhygClLYnX8L2SKjrODLCrAJmZnNR5Q+pIgyF G6Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RMyYli+uYcg6GiJKKmuAIgS2Y/Kzt9nNBmazS9TcZzg=; b=x2lb2qEfkAnoih06GSzWpe38MP4UUbcShxevhv2CtdHpF0Hdt46LEXvSbQqAWeem7S hYzI4/G6GQyUTUqK0O/5y6nw5X+WHMs/Z0ArKqnAEuVVSl1djlF9yWflfVc8s8DfP2Ih mHfPBfBu2QCFsq5z688O8GbeCce5LdJ0fCLQwTEX9nJFmf+HaOklm5kqW3H2gXVQbdjC /cgQm0z0agiotHshEyXTEMk+h8ImNiRgvsQ8lfF7FgxqS3M1Gjh7mYnvlKWHfgTDHLlB oohWHk2Hyv2IkAc32VFRa9jDqvv6mHZIXEEtIn8KtFfR9lXEZyE0S8RqrwPGAraTHb8c 9gVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=F4482yxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu18si6601097ejb.482.2020.05.18.09.14.50; Mon, 18 May 2020 09:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=F4482yxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbgERQLH (ORCPT + 99 others); Mon, 18 May 2020 12:11:07 -0400 Received: from merlin.infradead.org ([205.233.59.134]:42298 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbgERQLH (ORCPT ); Mon, 18 May 2020 12:11:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RMyYli+uYcg6GiJKKmuAIgS2Y/Kzt9nNBmazS9TcZzg=; b=F4482yxM4+Z7u9gmgoOYTqjX1j jvn7nL6ik4SWbWbg/CL5d3F7r1XQteo89Y5PF7hA4Y3BSGqROFNUYsyMSwATr+RzgN8yPBJRchXJk HiAEsT4h7JwfQuhXhXgiypPqBhdmDL7Jq3X2/I4hpUx33+FSwJYZgn13QWlS3JlPS3QeGQ9wdmtjN /UvzrBzoox628yUDDyj+8TD7Tou4TybZwiWbELZVVbDqGMyiSAR1pzKYd/le4YjBBznXEYEp5+LfL FtcSmtt6El1d6AAxMv8klTXZYm6YN5q8FR8y3iZEwBKyRpYLwOUSNPS4xgSRazsWvrawnbB0Wai6R bQuuxlQg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jaiJ6-0006qD-IV; Mon, 18 May 2020 16:08:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D22643008A8; Mon, 18 May 2020 18:07:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A184C2105F3B6; Mon, 18 May 2020 18:07:50 +0200 (CEST) Date: Mon, 18 May 2020 18:07:50 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , x86@kernel.org, "Paul E. McKenney" , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon , Tom Lendacky , Wei Liu , Michael Kelley , Jason Chen CJ , Zhao Yakui Subject: Re: [patch V6 00/37] x86/entry: Rework leftovers and merge plan Message-ID: <20200518160750.GA279861@hirez.programming.kicks-ass.net> References: <20200515234547.710474468@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515234547.710474468@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So on top of you entry-v8-full; I had to chase one of those instrumentation_end() escapes an (extended) basic block chase (again!). How about we do something like the below; that fixes the current case (rcu_eqs_enter) but also kills the entire class. --- arch/x86/include/asm/bug.h | 2 +- include/linux/compiler.h | 16 +++++++++++++--- include/linux/compiler_types.h | 4 ---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index f128e5c2ed42..fb34ff641e0a 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -79,8 +79,8 @@ do { \ do { \ instrumentation_begin(); \ _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ - instrumentation_end(); \ annotate_reachable(); \ + instrumentation_end(); \ } while (0) #include diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7db5902f8f6e..b4c248e6b76a 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -120,25 +120,35 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, /* Annotate a C jump table to allow objtool to follow the code flow */ #define __annotate_jump_table __section(.rodata..c_jump_table) +#ifdef CONFIG_DEBUG_ENTRY +/* Section for code which can't be instrumented at all */ +#define noinstr \ + noinline notrace __attribute((__section__(".noinstr.text"))) + /* Begin/end of an instrumentation safe region */ -#define instrumentation_begin() ({ \ +#define instrumentation_begin() ({ \ asm volatile("%c0:\n\t" \ ".pushsection .discard.instr_begin\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) -#define instrumentation_end() ({ \ - asm volatile("%c0:\n\t" \ +#define instrumentation_end() ({ \ + asm volatile("%c0: nop\n\t" \ ".pushsection .discard.instr_end\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) +#endif /* CONFIG_DEBUG_ENTRY */ #else #define annotate_reachable() #define annotate_unreachable() #define __annotate_jump_table +#endif + +#ifndef noinstr +#define noinstr noinline notrace #define instrumentation_begin() do { } while(0) #define instrumentation_end() do { } while(0) #endif diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index ea15ea99efb4..6ed0612bc143 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -118,10 +118,6 @@ struct ftrace_likely_data { #define notrace __attribute__((__no_instrument_function__)) #endif -/* Section for code which can't be instrumented at all */ -#define noinstr \ - noinline notrace __attribute((__section__(".noinstr.text"))) - /* * it doesn't make sense on ARM (currently the only user of __naked) * to trace naked functions because then mcount is called without