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 5E571C43334 for ; Thu, 16 Jun 2022 09:08:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C54ED6B0072; Thu, 16 Jun 2022 05:08:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDD556B0073; Thu, 16 Jun 2022 05:08:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A56A36B0074; Thu, 16 Jun 2022 05:08:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 91BF16B0072 for ; Thu, 16 Jun 2022 05:08:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 61C9734D9A for ; Thu, 16 Jun 2022 09:08:39 +0000 (UTC) X-FDA: 79583523558.11.AA15C07 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 2FBB2800AD for ; Thu, 16 Jun 2022 09:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=qrHyXuJPKZh7ZM1zFO0NX5HEyIc3Jst88sq5+SSmSzQ=; b=hRDKrI5OemVxkmWh4VTAQCIF2L RS2ide6shPXTGW3WD5apsQiPVhE69HyE2GW+IrJVOzabgDRnttRkJ4ojYIz6eRSo9JS/k9rIIzHvc SNYCfhcnmC/VSYwv7r314UltRc9bLyrl43uguH1uaFofZLQr0pnD1mq1HyBOETypADrxALzs04PAb 4AcdE7r4YnPogc+uA/+W6MiEuRZpKnBYu62Md1M6YXQGgTD/L899vi+mYDeG1+4u/P40hfK77D6R2 pKabbnebKW4Z7HsKR+ePdL97RzlUK55/hWbE/OoDy3KBUOyRsKvRNaWbVEr82HjQ1LWZ1rCJpZkP6 uAyjn0nQ==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1lU4-001ot2-JX; Thu, 16 Jun 2022 09:08:12 +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 560E130023F; Thu, 16 Jun 2022 11:08:07 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3C8042018EF8F; Thu, 16 Jun 2022 11:08:07 +0200 (CEST) Date: Thu, 16 Jun 2022 11:08:07 +0200 From: Peter Zijlstra To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, namit@vmware.com Subject: Re: [PATCHv3 4/8] x86/mm: Handle LAM on context switch Message-ID: References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-5-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220610143527.22974-5-kirill.shutemov@linux.intel.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655370519; a=rsa-sha256; cv=none; b=ktZufFt4jVLq2pYEsJjmMF/FBYqAmeRcFrihBx/n6vPeTGdBBEwEmcYBf8N1IdPQrpx6Gc aFogckAcqxFdoV2u7NDGSfZAHYoTc6LVi1AcUeXrRrEj9GtXG5cj+vd08cKHAfmWFQCWNz nzU4Y+obU9/eOUFOCVSWF8aAm8zOig4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hRDKrI5O; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655370519; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qrHyXuJPKZh7ZM1zFO0NX5HEyIc3Jst88sq5+SSmSzQ=; b=WvjlAmVV++SpYxPGpLNLFF6bHIZtxP8YxD/9R6oavfR3Micm+On9bCKwTkeirSHVjXZG5x AJdUPd1TfAv6CY2RU7MlBFf6JDwltfOWixAd/lTlQBFFTYNi3bURghejVOBIdCEBRizLez MRF1cB6mX+8Zi7Smn1Q7Y0aa4S3rwkY= X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2FBB2800AD X-Stat-Signature: sr4rsshehfjbpmm9c4btkfs1ymrh8bb5 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hRDKrI5O; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org X-Rspam-User: X-HE-Tag: 1655370518-436870 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, Jun 10, 2022 at 05:35:23PM +0300, Kirill A. Shutemov wrote: > diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h > index 4af5579c7ef7..5b93dad93ff4 100644 > --- a/arch/x86/include/asm/tlbflush.h > +++ b/arch/x86/include/asm/tlbflush.h > @@ -86,6 +86,9 @@ struct tlb_state { > unsigned long last_user_mm_spec; > }; > > +#ifdef CONFIG_X86_64 > + u64 lam_cr3_mask; > +#endif > u16 loaded_mm_asid; > u16 next_asid; > Urgh.. so there's a comment there that states: /* * 6 because 6 should be plenty and struct tlb_state will fit in two cache * lines. */ #define TLB_NR_DYN_ASIDS 6 And then look at tlb_state: struct tlb_state { struct mm_struct * loaded_mm; /* 0 8 */ union { struct mm_struct * last_user_mm; /* 8 8 */ long unsigned int last_user_mm_spec; /* 8 8 */ }; /* 8 8 */ u16 loaded_mm_asid; /* 16 2 */ u16 next_asid; /* 18 2 */ bool invalidate_other; /* 20 1 */ /* XXX 1 byte hole, try to pack */ short unsigned int user_pcid_flush_mask; /* 22 2 */ long unsigned int cr4; /* 24 8 */ struct tlb_context ctxs[6]; /* 32 96 */ /* size: 128, cachelines: 2, members: 8 */ /* sum members: 127, holes: 1, sum holes: 1 */ }; If you add that u64 as you do, you'll wreck all that. Either use that one spare byte, or find room elsewhere I suppose.