Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5878366rwn; Mon, 12 Sep 2022 16:16:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR796QYrTpp6tyUrbQK/p1uDuwVkpHu+8U5VE4QfFjnK+RUIPA/jr7vglgBgcNT00mZGrF2d X-Received: by 2002:a65:6d19:0:b0:42a:37d7:90da with SMTP id bf25-20020a656d19000000b0042a37d790damr25581245pgb.16.1663024605870; Mon, 12 Sep 2022 16:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663024605; cv=none; d=google.com; s=arc-20160816; b=GZnkqaTxv/Qoql+YITnFo+8c0me7Puaa/AMEGu0vbPG3vqL3hf2/8yIj9gecAkEBxY ZaiXKNfk1Ezqr8/3PUtsa5UcpHVGoc0zAiVBgW8yqJcytU1ExqeEHWTAhOJtDx+P2OeS 39ztdl4bLSbzVBVDmmncj89ug/SxcBqEcWcnMARcxLyJ6HayHpUOx+7Cx+KdA5vG90Td Bt1+9CIFjBClNggdt3SUk9NNi1L5Oq4Ef7OH7UOVDwTizFF3rABh8MVPtIUzSbNeLVPF aH9NBHhSH+Uv4o18tAfiuststsF+9ZLWesX9AbjiKTAXq1K1/5/n/JWz7L6wwSYRqTNe znew== 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=luUW4YjvcPsbRiIt0gvhMY+kJNuwKI/zyJm3dNL/0Vc=; b=SAKd4Y/9o5e4G6eZBqtGyFwJXp6fVk4N6iyi3RI4ZTpeL46webZSo0B9YvzZFj/IIQ wraNbUiw7PUbwV0Qudy5TQjNAwhmULuUqqAJ7V2SbZ++xq7x72ijrqBeL7M9GNs0bfu4 4cC1RNxmki37k2Krj9Ft+be/smtSS16EK9h6qp3q8IZ8HiS/lnzWcdZiPx1T/NDm+DZM ztRKaRs6Sao1ECb+8GU0tp1IF/R+OulNXWqtFLlkDaTgDmQQMeitpm0u80Yn1q0sa5qi 4XVWc7OeytDppzMLF04cYcCAFOBDaOXzjY0z0odRXDQ5LnTOojyS1OpqWd9NOCnoGkNk GcAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Uf/SR0VC"; 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 qb16-20020a17090b281000b001fdb6cfb4c2si9700270pjb.26.2022.09.12.16.16.33; Mon, 12 Sep 2022 16:16:45 -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="Uf/SR0VC"; 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 S229895AbiILWtm (ORCPT + 99 others); Mon, 12 Sep 2022 18:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiILWtk (ORCPT ); Mon, 12 Sep 2022 18:49:40 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA9F62CD for ; Mon, 12 Sep 2022 15:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663022979; x=1694558979; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NsiOox7nfIPNPbqeXi04s08cExYxbUI6A8GPKqPLH8c=; b=Uf/SR0VCmoWZxvio96+oGGz9Ukdd7lOVch8uJBZXx+a5YwMp4PKBLSQY RoFWbroa8iEGKWBTO2RGrnA909IiR+gc/yxeLChdcEoswzl+kSzXpJGZE bn+KQDI02gQbn+V4AurzukrKUs8NmgXuNMrPIsMolfgl3dkGI6FVQXbbP fzk6RveJ4cpuVLMScy0LOPJ/NioI3E9rYlzww5md2W+qBowpkDn/SaTfI hSfdTs0z/FB8deXorEEWlsXnZiON62tkAOB+4OlHDK2bxVFAd0uoIX61/ jIpk7COyAQMHyER11ZO4wF6jqcgmkoTuacZdvnfQc1jKN7Ta5Lt8+JMd+ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="285008273" X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="285008273" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 15:49:37 -0700 X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="616234521" Received: from aburgsta-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.208.142]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 15:49:33 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id E30D610455B; Tue, 13 Sep 2022 01:49:30 +0300 (+03) Date: Tue, 13 Sep 2022 01:49:30 +0300 From: "Kirill A. Shutemov" To: "Kirill A. Shutemov" Cc: Ashok Raj , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jacon Jun Pan , Ashok Raj Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Message-ID: <20220912224930.ukakmmwumchyacqc@box.shutemov.name> References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904003952.fheisiloilxh3mpo@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220904003952.fheisiloilxh3mpo@box.shutemov.name> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 Sun, Sep 04, 2022 at 03:39:52AM +0300, Kirill A. Shutemov wrote: > On Thu, Sep 01, 2022 at 05:45:08PM +0000, Ashok Raj wrote: > > Hi Kirill, > > > > On Tue, Aug 30, 2022 at 04:00:53AM +0300, Kirill A. Shutemov wrote: > > > Linear Address Masking[1] (LAM) modifies the checking that is applied to > > > 64-bit linear addresses, allowing software to use of the untranslated > > > address bits for metadata. > > > > We discussed this internally, but didn't bubble up here. > > > > Given that we are working on enabling Shared Virtual Addressing (SVA) > > within the IOMMU. This permits user to share VA directly with the device, > > and the device can participate even in fixing page-faults and such. > > > > IOMMU enforces canonical addressing, since we are hijacking the top order > > bits for meta-data, it will fail sanity check and we would return a failure > > back to device on any page-faults from device. > > > > It also complicates how device TLB and ATS work, and needs some major > > improvements to detect device capability to accept tagged pointers, adjust > > the devtlb to act accordingly. > > > > > > Both are orthogonal features, but there is an intersection of both > > that are fundamentally incompatible. > > > > Its even more important, since an application might be using SVA under the > > cover provided by some library that's used without their knowledge. > > > > The path would be: > > > > 1. Ensure both LAM and SVM are incompatible by design, without major > > changes. > > - If LAM is enabled already and later SVM enabling is requested by > > user, that should fail. and Vice versa. > > - Provide an API to user to ask for opt-out. Now they know they > > must sanitize the pointers before sending to device, or the > > working set is already isolated and needs no work. > > The patch below implements something like this. It is PoC, build-tested only. > > To be honest, I hate it. It is clearly a layering violation. It feels > dirty. But I don't see any better way as we tie orthogonal features > together. > > Also I have no idea how to make forced PASID allocation if LAM enabled. > What the API has to look like? Jacob, Ashok, any comment on this part? I expect in many cases LAM will be enabled very early (like before malloc is functinal) in process start and it makes PASID allocation always fail. Any way out? -- Kiryl Shutsemau / Kirill A. Shutemov