Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp861342iog; Fri, 17 Jun 2022 15:48:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tW8xt5duR1F0zrRCD2yh3NazjNRL8mo7KsaqeKZb/xP+wt6HcT7FBspUKQfYW/ra/lLJ+G X-Received: by 2002:a63:24e:0:b0:3fd:d5d8:9b91 with SMTP id 75-20020a63024e000000b003fdd5d89b91mr10870827pgc.458.1655506101811; Fri, 17 Jun 2022 15:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655506101; cv=none; d=google.com; s=arc-20160816; b=TpOLu+c8hO8OSkSaSOO3g3K116BUWP83NBjQFBWTgYDIaWPgj79d/4HJjIPHZ+jC/e z4RXrtwBIzVDPZcnKEmkDeawLaQxpGH1uDhB98MBOdDlXm+0s/hlt4SLro82GCUkSIEM NiKiD6ITFHH7bUlm7WYbo+7zuBmaZNxKUj2pR9urQu8HoGG1RgKBbGwhQPJhT8ktAF0k o0vHLje9f9eRtq8teHCJHm+gySRgPRUjz4/JaaAJfG7ISSu9sbrXrkW6vznM/C09/+ha /UHj9OcwTfTXxc/GuBoSACNxYM6Y+MceveITiKOQ8+dViydXez/LWf+xl/+6iTly4Og+ bPeQ== 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=nkaQPEqmqQeqRIAL9Fd9z0jMEi6iTqpaDnkdgcQ0Pqg=; b=AyauKRAhNiy7ytFdnXXdaPweHF5RIkgjtqlq57zDEJlA/QuzXpJJB2AKMZgPVaO02C CiY1f0/JOPqykhiS9F6K/KEvFKNLNmyXlUjPc3rLzJnL8Rjg6s7bfOqpr011sWP2f4f4 LCXej7TDE2uUFyonJN0B0nXdmwng5saTvN8rN+4BDz83I5kArxifR8GX+LkRhL46MTaW PSgmB7YTOTaHMshoIsSAy1D9ntamWzbF4JG9LTJH/d8Cw6Q9DBS1DTxJGQ1zkGMoz3/U xciCKTNarSDBeMRx7D/DA9C+l6q87C3VkxJnPTR6d+eKPZhEY76d0GGNih5T+PMmTBHI AjhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YctMdPyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 203-20020a6307d4000000b0040534ac3906si7483915pgh.418.2022.06.17.15.48.09; Fri, 17 Jun 2022 15:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YctMdPyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236199AbiFQWjp (ORCPT + 99 others); Fri, 17 Jun 2022 18:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbiFQWjo (ORCPT ); Fri, 17 Jun 2022 18:39:44 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB6534BBA9 for ; Fri, 17 Jun 2022 15:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655505583; x=1687041583; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wG47mPH2ny+DfuBj61UmcLRLOVow6f7xHscwu0hdrEU=; b=YctMdPyMcbZmJ0i98FRnnR+wkfIyoQD4hfEtgAtgkCv/gwM/yamj1D/m 16XW/uui+rH1dS26YFi9c/yoou9dVZeQ8NeCcHRF2ZS+8deD3KHZutxAd vPI3ta+O/KWbiH68oDnTydGTg/E/xQLlJSkBqy8m0rh7T/0WFlh8tqgDP +K+/Smm4wPpPQo2pvN6ZAF70MBtCbT/AofDMScLd83h6rxXfsn7F3Igvv 1BJNkZrvjNalEaY6MZPxthZuhh/8XlMvdhhuTNfi7u8khNIFim/g59HgR Qo4BExfs97QmHKwIbeisks8Z7TvzLhARZY/5vLkjoI+haveAD8nO+ttIq Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277150282" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277150282" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2022 15:39:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="688494714" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2022 15:39:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id E6ACB132; Sat, 18 Jun 2022 01:39:38 +0300 (EEST) Date: Sat, 18 Jun 2022 01:39:38 +0300 From: "Kirill A. Shutemov" To: Alexander Potapenko Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , the arch/x86 maintainers , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Subject: Re: [PATCHv3 4/8] x86/mm: Handle LAM on context switch Message-ID: <20220617223938.3qeb7tjr7wdjas27@black.fi.intel.com> 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: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2022 at 05:35:05PM +0200, Alexander Potapenko wrote: > On Fri, Jun 10, 2022 at 4:35 PM Kirill A. Shutemov > wrote: > > > > Linear Address Masking mode for userspace pointers encoded in CR3 bits. > > The mode is selected per-thread. Add new thread features indicate that the > > thread has Linear Address Masking enabled. > > > > switch_mm_irqs_off() now respects these flags and constructs CR3 > > accordingly. > > > > The active LAM mode gets recorded in the tlb_state. > > > > Signed-off-by: Kirill A. Shutemov > > > > +#ifdef CONFIG_X86_64 > > +static inline u64 mm_cr3_lam_mask(struct mm_struct *mm) > > +{ > > + return mm->context.lam_cr3_mask; > > +} > > Nit: can we have either "cr3_lam_mask" or "lam_cr3_mask" in both places? With changes sugessted by Peter, the field in the mmu_context will be called 'lam' as it is not CR3 mask anymore. -- Kirill A. Shutemov