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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2221C433EF for ; Fri, 19 Nov 2021 21:32:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAA256B0071; Fri, 19 Nov 2021 16:32:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D57F96B0072; Fri, 19 Nov 2021 16:32:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF94A6B0073; Fri, 19 Nov 2021 16:32:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id B1C686B0071 for ; Fri, 19 Nov 2021 16:32:20 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6CD888D6DC for ; Fri, 19 Nov 2021 21:32:10 +0000 (UTC) X-FDA: 78826978020.12.A8118FA Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by imf21.hostedemail.com (Postfix) with ESMTP id AB8E8D0369C0 for ; Fri, 19 Nov 2021 21:32:08 +0000 (UTC) Received: by mail-oi1-f171.google.com with SMTP id q25so24384984oiw.0 for ; Fri, 19 Nov 2021 13:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0GXHfM1zHpJu5wwWGSWsee6iiyt6MnGHGfBIxpmPLPk=; b=Da5fgDtGaSWg7kBA6Vl+Q0b9xSV4Gr/s+wRD9Ww4yELap/aNMC7gluX3kCAdnxxYeN kAm9K98pzWsJ58l/6xgKwb6HnUlc4hLwODYnaAU5ZbeGd1xUq9tgrmbAbhuTj2zsVV+T vPF4Zx+hH1fqAZ9xmvVvbkW5y6FT/BcFV9Am66hfoZ1UiBVFlhrbPWu0DSm13Zk1G0gn Ql/PXS3MRTJWKbDGwezkLwA9tBLRrS+lJ+2JO7IdMcS/OiyebpH0wKVl54H9qoceriTI MT8WWuE6XaQbcAbK7KdQl4nzGGKYRmdOOsF7vnhtGQOEjdaR+9XJ9Br9HRxzXBOhS3pO u3AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0GXHfM1zHpJu5wwWGSWsee6iiyt6MnGHGfBIxpmPLPk=; b=cq7kaMOh//E7px/W+wUES/FP3i+npuuRrxdYdcir9uvn4iRPm8FEmu0YAeA3HrEyI/ nmpzjF/GnMX0TRpnhc+PLsQ4YdCkD6X+AfbBDQKbemJ0b4baTTzIlwksJO6TK0O8bIRo eHUlzjQX6ephPfYOk0YhSmJYkFVSEoC5BeKXVok9oLZYOBUF5bmBZ1Zot7xah9suKLJS 9T9Rg68y++KEC9gM/W1T2QDALVfuWUsy/d8gc0133/93wN7WWB8z9hXpv+nS6aNRJHsR CLWdc8xWYV5P+TCy1nR7MqfYxpwsOIqKrIKy1fQIcHTHqOlZqTQamtVbJ/LiLdCbTlWU t3dw== X-Gm-Message-State: AOAM5312vuPo+UDbCLB3fX+scKWgxQs8YNkBfWfvEfqN5RMHw7Rbtwxy usX2fzVKJRljF2zGrX21RcltfEpvSHI75powcf9n/w== X-Google-Smtp-Source: ABdhPJwXmXhmZIoAJvQyEg5ELH0NOHKM8Z2VTFX+cXoZyPNtSc4glckFT5TqVjn11VDqUStoWJnf1FN/l/YZlXmY86E= X-Received: by 2002:a05:6808:118c:: with SMTP id j12mr2759146oil.65.1637357529142; Fri, 19 Nov 2021 13:32:09 -0800 (PST) MIME-Version: 1.0 References: <20211118081027.3175699-1-elver@google.com> <20211118081027.3175699-24-elver@google.com> <20211119203135.clplwzh3hyo5xddg@treble> In-Reply-To: <20211119203135.clplwzh3hyo5xddg@treble> From: Marco Elver Date: Fri, 19 Nov 2021 22:31:57 +0100 Message-ID: Subject: Re: [PATCH v2 23/23] objtool, kcsan: Remove memory barrier instrumentation from noinstr To: Josh Poimboeuf Cc: "Paul E. McKenney" , Alexander Potapenko , Boqun Feng , Borislav Petkov , Dmitry Vyukov , Ingo Molnar , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AB8E8D0369C0 X-Stat-Signature: 18n5ejfxwjwcymbq6549t7y9ip41znby Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Da5fgDtG; spf=pass (imf21.hostedemail.com: domain of elver@google.com designates 209.85.167.171 as permitted sender) smtp.mailfrom=elver@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1637357528-59591 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 19 Nov 2021 at 21:31, Josh Poimboeuf wrote: > > + if (insn->sec->noinstr && sym->removable_instr) { > > if (reloc) { > > reloc->type = R_NONE; > > elf_write_reloc(file->elf, reloc); > > I'd love to have a clearer name than 'removable_instr', though I'm > having trouble coming up with something. > > 'profiling_func'? > > Profiling isn't really accurate but maybe it gets the point across. I'm > definitely open to other suggestions. Well, this bit is not true for all "profiling functions" either. It's only true for instrumentation functions that appear in 'noinstr' and that the compiler can't remove on its own, but are valid to remove by objtool in noinstr code, hence 'removable_instr'. I'm really quite indifferent what we call it, so I'll leave you to pick whatever sounds best: -- profiling_func -- nop_profiling_func -- optional_profiling_func -- noinstr_remove -- removable_profiling_func -- noinstr_nop_func -- noinstr_nop -- nop_in_noinstr -- invalid_in_noinstr ? > Also, the above code isn't very self-evident so there still needs to be > a comment there, like: > > /* > * Many compilers cannot disable KCOV or sanitizer calls with a > * function attribute so they need a little help, NOP out any > * such calls from noinstr text. > */ > I'll add it. > > +{ > > + /* > > + * Many compilers cannot disable KCOV with a function attribute so they > > + * need a little help, NOP out any KCOV calls from noinstr text. > > + */ > > + if (!strncmp(name, "__sanitizer_cov_", 16)) > > + return true; > > A comment is good here, but the NOP-ing bit seems out of place. I'll fix that.