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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01AFC4361B for ; Wed, 16 Dec 2020 02:09:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1739823105 for ; Wed, 16 Dec 2020 02:09:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1739823105 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4CCF66B0036; Tue, 15 Dec 2020 21:09:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4554F6B005D; Tue, 15 Dec 2020 21:09:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31CBF6B0068; Tue, 15 Dec 2020 21:09:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 17FEE6B0036 for ; Tue, 15 Dec 2020 21:09:17 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D5C1B362D for ; Wed, 16 Dec 2020 02:09:16 +0000 (UTC) X-FDA: 77597513112.07.box05_2c054b527428 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id B7F431803F9A9 for ; Wed, 16 Dec 2020 02:09:16 +0000 (UTC) X-HE-Tag: box05_2c054b527428 X-Filterd-Recvd-Size: 4930 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 02:09:16 +0000 (UTC) X-Gm-Message-State: AOAM533MsLbmnuXmw3CwHQYUqYxxKxagFK71kvqqcPJB/POPpEfGykJY AvVB6LZg7QRhd3iYjFc2q0EXU1CzGs2xppnAg4jNNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608084555; bh=lNceg3zsRQIJnHCRAuvzGZav5VoW/sPjJj297FNCEIE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OQgvnVaNI74sIqAfu9tmH08B02FGdjlECv5YoeVvShFftLtYz/cLruALfnrNvXjbp Mu9i65y0fvsv0t8FB4dfnHVaXipGvQT80YnYUP9ZpHiAucTpbHUaMQgSKOXxRwzaXx QJQDPuKMG8IjA2mGXjl8ullNqLdoMRqqnWq/r3K/8jxwh4/0f59ApGZKJFwlop9xKk /UHjRKgQ3DOGzxOmQes6i0nGlIa9dGA37ciHhbUXXOI8JSqi14ml4VmeKyqiXviYsz j27PBrLe2PKfLk6Hq1oqx8tgkGTpP1GOLLg5RLdrHVIW9k0cqngQIILI7dARy2KC5O WmMT43NQvGRYw== X-Google-Smtp-Source: ABdhPJxF4IgLZo1zLMG6fgv3Y/r/6cEkD+J3Xjpg+eE9MJVMRCyPOEp4KttaWYdIQQlTeDz1jvZ23DX6Z/Spj4LR1ck= X-Received: by 2002:adf:e64b:: with SMTP id b11mr35857878wrn.257.1608084553468; Tue, 15 Dec 2020 18:09:13 -0800 (PST) MIME-Version: 1.0 References: <20201106232908.364581-6-ira.weiny@intel.com> <20201124060956.1405768-1-ira.weiny@intel.com> <20201216013202.GY1563847@iweiny-DESK2.sc.intel.com> In-Reply-To: <20201216013202.GY1563847@iweiny-DESK2.sc.intel.com> From: Andy Lutomirski Date: Tue, 15 Dec 2020 18:09:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V3.1] entry: Pass irqentry_state_t by reference To: Ira Weiny Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Dave Hansen , X86 ML , LKML , Andrew Morton , Fenghua Yu , "open list:DOCUMENTATION" , linux-nvdimm , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , Dan Williams , Greg KH Content-Type: text/plain; charset="UTF-8" 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 Tue, Dec 15, 2020 at 5:32 PM Ira Weiny wrote: > > On Fri, Dec 11, 2020 at 02:14:28PM -0800, Andy Lutomirski wrote: > > On Mon, Nov 23, 2020 at 10:10 PM wrote: > > IOW we have: > > > > struct extended_pt_regs { > > bool rcu_whatever; > > other generic fields here; > > struct arch_extended_pt_regs arch_regs; > > struct pt_regs regs; > > }; > > > > and arch_extended_pt_regs has unsigned long pks; > > > > and instead of passing a pointer to irqentry_state_t to the generic > > entry/exit code, we just pass a pt_regs pointer. And we have a little > > accessor like: > > > > struct extended_pt_regs *extended_regs(struct pt_regs *) { return > > container_of(...); } > > > > And we tell eBPF that extended_pt_regs is NOT ABI, and we will change > > it whenever we feel like just to keep you on your toes, thank you very > > much. > > > > Does this seem reasonable? > > Conceptually yes. But I'm failing to see how this implementation can be made > generic for the generic fields. The pks fields, assuming they stay x86 > specific, would be reasonable to add in PUSH_AND_CLEAR_REGS. But the > rcu/lockdep field is generic. Wouldn't we have to modify every architecture to > add space for the rcu/lockdep bool? > > If not, where is a generic place that could be done? Basically I'm missing how > the effective stack structure can look like this: > > > struct extended_pt_regs { > > bool rcu_whatever; > > other generic fields here; > > struct arch_extended_pt_regs arch_regs; > > struct pt_regs regs; > > }; > > It seems more reasonable to make it look like: > > #ifdef CONFIG_ARCH_HAS_SUPERVISOR_PKEYS > struct extended_pt_regs { > unsigned long pkrs; > struct pt_regs regs; > }; > #endif > > And leave the rcu/lockdep bool passed by value as before (still in C). We could certainly do this, but we could also allocate some generic space. PUSH_AND_CLEAR_REGS would get an extra instruction like: subq %rsp, $GENERIC_PTREGS_SIZE or however this should be written. That field would be defined in asm-offsets.c. And yes, all the generic-entry architectures would need to get onboard. If we wanted to be fancy, we could split the generic area into initialize-to-zero and uninitialized for debugging purposes, but that might be more complication than is worthwhile.