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 4177FC433EF for ; Thu, 12 May 2022 14:37:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C439F6B0074; Thu, 12 May 2022 10:37:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF2BB6B0075; Thu, 12 May 2022 10:37:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A93336B0078; Thu, 12 May 2022 10:37:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9669A6B0074 for ; Thu, 12 May 2022 10:37:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6E81A789 for ; Thu, 12 May 2022 14:37:14 +0000 (UTC) X-FDA: 79457343588.02.42B552A Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf16.hostedemail.com (Postfix) with ESMTP id D2E9C1800CF for ; Thu, 12 May 2022 14:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=M6wXwKLlbJ5QPgqxQHjWz14n+naV6OjfbCxLRHepeE4=; b=CEvLUGZgVRlxnfeYt0yODEx8dw fztgH10apfgqAyyBrCeYiBrr8HG7phdnEu3WjfH+uotCIcfTix5lzv03h3/59NlBGDQa9LsHGTRXI I23fo0wbTxxXPpx5Qnw+0/5ycYRx5wXGMUHbo/iM+oaygezE6yzujEfxFj9HvjByqcdYw95CLn93/ lUpgbB/aosEEle66JyKNYRGMbvJ9RwvqZ4vVm2OGwjt0h1ew6kjkoPOmF0KI+7xL+rCOwoT+dkGPB YvE18Eu0OBtX6GlYWf90asw3xHOZiLTUHZiZ6pKq8pXR/ZrcwJgY37zDNKDouRk4VDZ6Qx6xQd31/ d/ISVUoQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1np9w6-00DWlm-8Q; Thu, 12 May 2022 14:37:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A64DC30047E; Thu, 12 May 2022 16:37:00 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 92825201E235B; Thu, 12 May 2022 16:37:00 +0200 (CEST) Date: Thu, 12 May 2022 16:37:00 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , x86@kernel.org, Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFCv2 04/10] x86/mm: Introduce X86_THREAD_LAM_U48 and X86_THREAD_LAM_U57 Message-ID: References: <20220511022751.65540-1-kirill.shutemov@linux.intel.com> <20220511022751.65540-6-kirill.shutemov@linux.intel.com> <20220511070211.GS76023@worktop.programming.kicks-ass.net> <87ee0zvszt.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ee0zvszt.ffs@tglx> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D2E9C1800CF X-Stat-Signature: b7wckmqfi8fnawsstk69tfod9dsx414r X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=CEvLUGZg; spf=none (imf16.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-HE-Tag: 1652366224-170315 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 Thu, May 12, 2022 at 02:24:22PM +0200, Thomas Gleixner wrote: > On Wed, May 11 2022 at 09:02, Peter Zijlstra wrote: > > On Wed, May 11, 2022 at 05:27:45AM +0300, Kirill A. Shutemov wrote: > > > >> +#define LAM_NONE 0 > >> +#define LAM_U57 1 > >> +#define LAM_U48 2 > > > >> +#define X86_THREAD_LAM_U48 0x1 > >> +#define X86_THREAD_LAM_U57 0x2 > > > > Seriously pick an order and stick with it. I would suggest keeping the > > hardware order and then you can do: > > > >> +static inline unsigned long lam_to_cr3(u8 lam) > >> +{ > > > > return (lam & 0x3) << X86_CR3_LAM_U57; > > This "works" because the hardware ignores LAM_U48 if LAM_U57 is set, but > I'd rather make that exclusive in the prctl() as setting both does not > make any sense. Yes, I was very much assuming the interface would not allow setting both, that would be daft.