Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5750626rwn; Mon, 12 Sep 2022 13:52:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nQO3/UIoERfgPq2FS5VWln2dCMjjJwYnLTWHTY6SMpvuduXcbebNFH5Jd2A2MpqzsODfH X-Received: by 2002:a05:6402:1909:b0:451:ace7:ccbd with SMTP id e9-20020a056402190900b00451ace7ccbdmr6346357edz.276.1663015960772; Mon, 12 Sep 2022 13:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663015960; cv=none; d=google.com; s=arc-20160816; b=bnfPvwCAsJLL1vvLLFuVedG2tOoljigSdRUZi/OHeuNd1EPTHSn2RFuj3chYkb4V1y x61bxaPHjmw38QucrQZfvVCgHEMvpHnA31djBkdVypnd9KIruqWHWFGA/aH9QrTx9Zi4 fmOs6JhCQzo7FK+4tbczyQHepqRUVxXECNHAxfNyTG+8JDdzMTkKFnl0bMRqa3qHyYgj q1qYz5XT+e2X/7pPfKdMU9/hGBhL3vXwIDvj3DKeRlhC3MbpsAyncwdT3DMs3BVPEwql edhLKUawWcNC0Nb3g56OqXFzbi3t3o3Q5V8tv44bxn9AQ0rusWV2WoZhA6TVgoLrKr3U Jm9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=oBl2sKcRqcTqT8nHrZiNuE5eI4us2BpLhXrEMSMu3CA=; b=D13NQkU1Jvrkw2Ff8/BE1MIhriIB950qFUvqrXgqn5QGMevfO+HdpHbVqWGTpsvq4P oo/lydOqTWHQXTxdVaX+ZILVQM/UHr55DQgAypgudCgX+kk6hFfP7ze5ejTGEqj/fDx7 YP+YZkgP8INRpVgz+qztoiKV0X7z+PaWsDdzGcQRQJ6nZQ3aXlZ7ncOMrV8o9GXC4EUQ WIvc9+/9X4E9yyNJxPmxr3aD2PYs6dVX+fV1boUm8Eja20mxMN2x/mfKgR1b5mg3rsdi A1roaCzuYOVfiRVzshyUDWz9F3ZynEvs3E4cGQvEekwAMzgwaZPWV7yKsOJE4HQ10kVl gRtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ORfmZ5/+"; 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 s10-20020a50d48a000000b00450c8cd976esi6984290edi.224.2022.09.12.13.52.14; Mon, 12 Sep 2022 13:52:40 -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="ORfmZ5/+"; 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 S229616AbiILUgQ (ORCPT + 99 others); Mon, 12 Sep 2022 16:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbiILUgN (ORCPT ); Mon, 12 Sep 2022 16:36:13 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8777491EB for ; Mon, 12 Sep 2022 13:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663014972; x=1694550972; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cYohu4G+JWcFUsq5o/u1kDMJywbtXpKuspQG8T5G+PQ=; b=ORfmZ5/+8ygMyOCZcBDhWmKS/j1VtOdb0nynjVKs4P6XHy3kHZNtvTcn QgFhIqpkNUDDHl3d6rOX0GpWFnKSWf6TzCyrxcCjuVlZln0biE7j8eBXI sVHNP/9QFKUKmlhRSRZ/Tajii8hkGqEScGxK75Rp0r7VgYjRW4TdVuYlm /TLLldftqUn4WlqpFwb1l6Hzy9HadJUTgivLmXTaHOYjDbyXi5wwxuX87 LNme7VkhLfp08KufkDAI5RnTa3GOzGGL5phoZZ1FBKu0v5WGvdGta/bVO qj1cu8U8Im5ijqeLeWiO8doq9b/JjBO5x/Zm+e8pQuQnyit/OlUqqKc1H g==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="359688879" X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="359688879" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 13:36:12 -0700 X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="616196357" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.198.157]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 13:36:12 -0700 Date: Mon, 12 Sep 2022 13:39:35 -0700 From: Jacob Pan To: Ashok Raj Cc: "Kirill A. Shutemov" , "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , "Peter Zijlstra" , , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , , , Ashok Raj , jacob.jun.pan@intel.com Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Message-ID: <20220912133935.3bb3e247@jacob-builder> In-Reply-To: References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904003952.fheisiloilxh3mpo@box.shutemov.name> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Hi Ashok, On Fri, 9 Sep 2022 16:08:02 +0000, Ashok Raj wrote: > > diff --git a/arch/x86/include/uapi/asm/prctl.h > > b/arch/x86/include/uapi/asm/prctl.h index a31e27b95b19..e5c04ced36c9 > > 100644 --- a/arch/x86/include/uapi/asm/prctl.h > > +++ b/arch/x86/include/uapi/asm/prctl.h > > @@ -23,5 +23,6 @@ > > #define ARCH_GET_UNTAG_MASK 0x4001 > > #define ARCH_ENABLE_TAGGED_ADDR 0x4002 > > #define ARCH_GET_MAX_TAG_BITS 0x4003 > > +#define ARCH_ENABLE_TAGGED_ADDR_FORCED 0x4004 > > > > #endif /* _ASM_X86_PRCTL_H */ > > diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c > > index 337f80a0862f..7d89a2fd1a55 100644 > > --- a/arch/x86/kernel/process_64.c > > +++ b/arch/x86/kernel/process_64.c > > @@ -774,7 +774,8 @@ static bool lam_u48_allowed(void) > > #define LAM_U48_BITS 15 > > #define LAM_U57_BITS 6 > > > > -static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned > > long nr_bits) +static int prctl_enable_tagged_addr(struct mm_struct > > *mm, unsigned long nr_bits, > > + bool forced) > > { > > int ret = 0; > > > > @@ -793,6 +794,11 @@ static int prctl_enable_tagged_addr(struct > > mm_struct *mm, unsigned long nr_bits) goto out; > > } > > > > + if (pasid_valid(mm->pasid) && !forced) { I don't think this works since we have lazy pasid free. for example, after all the devices did sva_unbind, mm->pasid we'll remain valid until mmdrop(). LAM should be supported in this case. Perhaps, we could introduce another prctl flag for SVA, PR_GET_SVA? Both iommu driver and LAM can set/query the flag. LAM applications may not be the only ones want to know if share virtual addressing is on. > > + ret = -EBUSY; > > + goto out; > > + } > > + Thanks, Jacob