Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp578778rdg; Thu, 12 Oct 2023 14:31:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDa+HSn6SKFfCQqU813uM+3KvqyouZESCPcFDcxuu8Oh2JmQKjiZBzCbOTsePRNwpYKLbJ X-Received: by 2002:a05:6e02:dcf:b0:357:4fab:e24c with SMTP id l15-20020a056e020dcf00b003574fabe24cmr4713021ilj.13.1697146274918; Thu, 12 Oct 2023 14:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697146274; cv=none; d=google.com; s=arc-20160816; b=SZ0vta5zZYdy4e0QGnJyIIcIGcbqwUBlcVwYwTIzTB9tkbeRVdClKbS/DRoBwO16cu 1a46yCo2+j5PqWLH3a4sVZXgqhRIDPwHDS+8B+jjuZmY2MMdc2E5HqglQsNGP6CXERfS mDLZA8Dujot6nS5ul/8xzpWIPfqlwq6bcp6EK+foGU/TZclU9Luf6iRrTT8XlGOU87aM xnk4e8kNNZYfmc/79JRF37IkVSYXPyp6fzE5Yx47nbWP+W7uCv5aRJbX2rEE46jJyXkN tfYfAyzNOJzgG+BPHc1JZ50NcUkoqaYx3kXjNEcgDaO/1tQDWhlzGZeH1oYyokbbiwui rAoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FTQh3kC18yqp7Dm0n0AgUu7RdvOToM+SvBdTy0q2E9c=; fh=54oHijCQQbr0CUYWKbVFOlmLOQWVDL1EJE8tVZ6V7Us=; b=vbsTbwdnSvW1fDy+YLo8qEj5pXKPP5ncnOfyveLEafIQspVHYo2NqofmLaadFXAvQI YajjxgjbMjlwfQ//bA8dOmZglL6gGFpoCWruU1xZZOUEn367r33o9w3pR1abcUKx/+nP DioA6pIMUnOSoQURxMSjVROxILUyrKgbyk+Mc9AQZd5SQVT0PSIXJrTYKwt7Vdr5CYOA 2L73rZFJYmiJJ3zyRlMasFxW4ssbshvKohP4U551Yex95Nf1NPKNbwoCMYiQyzcSwJEL Z2H1pcRWdOcWDzgjazDogjqh96HHdLG78NS9XZWsXfmpRGgkKHYiJNI3p1LCvG5xpqD9 /75g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qrjFVlVu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id br4-20020a056a00440400b0068fd7cb5864si15518604pfb.263.2023.10.12.14.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 14:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qrjFVlVu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2F1E880CBDE1; Thu, 12 Oct 2023 14:30:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442911AbjJLVao (ORCPT + 99 others); Thu, 12 Oct 2023 17:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442824AbjJLVam (ORCPT ); Thu, 12 Oct 2023 17:30:42 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1655CA9 for ; Thu, 12 Oct 2023 14:30:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2007FC433C7; Thu, 12 Oct 2023 21:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697146240; bh=yKRnRXKOfRmE25XMyAXq5WWfuyzH78vRJa2eFaPofP4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qrjFVlVulI8NyvKWHty4htvgfCyc+2h9h2fODc/g94+FbevWA2zHcWfyZXlv7IkFh Pnitx/QdldQhcWfKCYltDme63QDg2x8CfVDxL2Qp7h644hoLMePFyfIEgXCY9jQzTa yTrX1osr3u0pJbtgbFXprHtZ2ZwXb663L2AZxyLGO3wOf5FMxdhE/DUt2F+l/r81JZ LD+VgIujQsJqKbA9GM8Yht63K4AiTUX0N3la7IFYq7ar+4zww1RmUaEwyPU4cnsLqS wqagL4r55amWO8yWmbDf9iUv+uTkPt8KJg9KVPkfCyD+Tf0gNdBETEUYeOkIgBggcV EG9za3UQP2e5g== Date: Thu, 12 Oct 2023 14:30:38 -0700 From: Josh Poimboeuf To: Ingo Molnar Cc: "H. Peter Anvin" , Linus Torvalds , Uros Bizjak , x86@kernel.org, linux-kernel@vger.kernel.org, Nadav Amit , Andy Lutomirski , Brian Gerst , Denys Vlasenko , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() Message-ID: <20231012213038.pnq6eds53dbqxstj@treble> References: <9b71932a-d410-4b92-b605-d6acc5d35069@zytor.com> <20231012013507.jrqnm35p7az6atov@treble> <20231012160801.blc2t37gfqhlah5h@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 14:30:56 -0700 (PDT) On Thu, Oct 12, 2023 at 07:59:43PM +0200, Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > > On Thu, Oct 12, 2023 at 08:19:14AM +0200, Ingo Molnar wrote: > > > > > > * Josh Poimboeuf wrote: > > > > > > > Though, another problem is that .text has a crazy amount of padding > > > > which makes it always the same size, due to the SRSO alias mitigation > > > > alignment linker magic. We should fix that somehow. > > > > > > We could emit a non-aligned end-of-text symbol (we might have it already), > > > and have a script or small .c program in scripts/ or tools/ that looks > > > at vmlinux and displays a user-friendly and accurate list of text and > > > data sizes in the kernel? > > > > > > And since objtool is technically an 'object files tool', and it already > > > looks at sections & symbols, it could also grow a: > > > > > > objtool size > > > > > > command that does the sane thing ... I'd definitely start using that, instead of 'size'. > > > > > > /me runs :-) > > > > Yeah, that's actually not a bad idea. > > > > I had been thinking a "simple" script would be fine, but I'm realizing > > the scope of this thing could grow over time. In which case a script is > > less than ideal. And objtool already has the ability to do this pretty > > easily. > > Yeah, and speed actually matters here: I have scripts that generate object > comparisons between commits, and every second of runtime counts - and a > script would be slower and more fragile for something like allmodconfig > builds or larger disto configs. Ah, good to know. > BTW., maybe the right objtool subcommand would be 'objtool sections', with > an 'objtool sections size' sub-sub-command. Because I think this discussion > shows that it would be good to have a bit of visibility into the sanity of > our sections setup, with 'objtool sections check' for example doing a > sanity check on whether there's anything extra in the text section that > shouldn't be there? Or so ... What would be an example of something "extra"? A sanity check might fit better alongside the other checks already being done by the main objtool "subcommand" which gets run by the kernel build. BTW, I actually removed subcommands a while ago when I overhauled objtool's interface to make it easier to combine options. That said, I'm not opposed to re-adding them if we can find a sane way to do so. Here's the current interface: Usage: objtool [] file.o Actions: -h, --hacks[=] patch toolchain bugs/limitations -i, --ibt validate and annotate IBT -l, --sls validate straight-line-speculation mitigations -m, --mcount annotate mcount/fentry calls for ftrace -n, --noinstr validate noinstr rules -o, --orc generate ORC metadata -r, --retpoline validate and annotate retpoline usage -s, --stackval validate frame pointer rules -t, --static-call annotate static calls -u, --uaccess validate uaccess rules for SMAP --cfi annotate kernel control flow integrity (kCFI) function preambles --dump[=] dump metadata --prefix generate prefix symbols --rethunk validate and annotate rethunk usage --unret validate entry unret placement Options: -v, --verbose verbose warnings --backtrace unwind on error --backup create .orig files before modification --dry-run don't write modifications --link object is a linked object --mnop nop out mcount call sites --module object is part of a kernel module --no-unreachable skip 'unreachable instruction' warnings --sec-address print section addresses in warnings --stats print statistics Note how all the actions can be easily combined in a single execution instance. If we re-added subcommands, most of the existing functionality would be part of a single subcommand. It used to be called "check", but it's no longer a read-only operation so that's misleading. I'll call it "run" for now. Right now my preference would be to leave the existing interface as-is, and then graft optional subcommands on top. If no subcommand is specified then it would default to the "run" subcommand. It's a little funky, but it would work well for the common case, where ~99% of the functionality lives. And it doesn't break existing setups and backports. For example: # current interface (no changes) objtool --mcount --orc --retpoline --uaccess vmlinux.o # same, with optional explicit "run" subcommand objtool run --mcount --orc --retpoline --uaccess vmlinux.o # new "size" subcommand obtool size [options] vmlinux.o.before vmlinux.o.after -- Josh