From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46665C38A2D for ; Tue, 25 Oct 2022 09:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231351AbiJYJrj (ORCPT ); Tue, 25 Oct 2022 05:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbiJYJri (ORCPT ); Tue, 25 Oct 2022 05:47:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E40DFE087; Tue, 25 Oct 2022 02:47:35 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F000D6E; Tue, 25 Oct 2022 02:47:41 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.7.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 65D3C3F792; Tue, 25 Oct 2022 02:47:31 -0700 (PDT) Date: Tue, 25 Oct 2022 10:47:25 +0100 From: Mark Rutland To: Guo Ren Cc: Peter Zijlstra , Lai Jiangshan , arnd@arndb.de, palmer@rivosinc.com, tglx@linutronix.de, luto@kernel.org, conor.dooley@microchip.com, heiko@sntech.de, jszhang@kernel.org, lazyparser@gmail.com, falcon@tinylab.org, chenhuacai@kernel.org, apatel@ventanamicro.com, atishp@atishpatra.org, palmer@dabbelt.com, paul.walmsley@sifive.com, zouyipeng@huawei.com, bigeasy@linutronix.de, David.Laight@aculab.com, chenzhongjin@huawei.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Borislav Petkov , Miguel Ojeda , Kees Cook , Nick Desaulniers Subject: Re: [PATCH V6 04/11] compiler_types.h: Add __noinstr_section() for noinstr Message-ID: References: <20221002012451.2351127-1-guoren@kernel.org> <20221002012451.2351127-5-guoren@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Tue, Oct 25, 2022 at 10:51:02AM +0800, Guo Ren wrote: > On Mon, Oct 24, 2022 at 8:14 PM Mark Rutland wrote: > > > > On Mon, Oct 24, 2022 at 02:06:04PM +0200, Peter Zijlstra wrote: > > > On Mon, Oct 24, 2022 at 12:56:03PM +0100, Mark Rutland wrote: > > > > > > > How about we split this like: > > > > > > > > | /* > > > > | * Prevent the compiler from instrumenting this code in any way > > > > | * This does not prevent instrumentation via KPROBES, which must be > > > > | * prevented through other means if necessary. > > > > > > Perhaps point to NOINSTR_TEXT in vmlinux.lds.h > > > > Makes sense, will do. > Do I need to update the comment with NOINSTR_TEXT? eg: > > * Prevent the compiler from instrumenting this code in any way > * This does not prevent instrumentation via KPROBES, which must be > * prevented through other means if necessary. See NOINSTR_TEXT > * in vmlinux.lds.h. I think given Peter's reply we can leave the patch as-is for now, and we can leave commentary or other changes to a later follow up. I'm happy to propose patches for that once the existing bits are merged. Sorry for confusing matters! > > > > | */ > > > > | #define __no_compiler_instrument \ > > > > | noinline notrace noinline notrace __no_kcsan \ > > > > | __no_sanitize_address __no_sanitize_coverage > > > > | > > > > | /* > > > > | * Section for code which can't be instrumented at all. > > > > | * Any code in this section cannot be instrumented with KPROBES. > > > > | */ > > > > | #define noinstr __no_compiler_instrument section(".noinstr.text") > > > > > > > > ... then we don't need __noinstr_section(), and IMO the split is > > > > clearer. > > > > > > Yeah, perhaps, no strong feelings. Note I have this in the sched-idle > > > series as well (which I still need to rebase and repost :/). > > > > Ah; I'll sit on this for now then, and once that's all in I can send a > > cleanup/rework patch. Sorry for the noise! > We still keep __noinstr_section(), right? Yes -- for now this patch can stay as-is, and __noinstr_section() will remain. Thanks, Mark.