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 16F62ECAAD3 for ; Wed, 14 Sep 2022 14:45:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B0438D0002; Wed, 14 Sep 2022 10:45:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 560728D0001; Wed, 14 Sep 2022 10:45:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4280B8D0002; Wed, 14 Sep 2022 10:45:28 -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 30AAA8D0001 for ; Wed, 14 Sep 2022 10:45:28 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E8BEAAAABC for ; Wed, 14 Sep 2022 14:45:27 +0000 (UTC) X-FDA: 79910964294.23.194CFBB Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf03.hostedemail.com (Postfix) with ESMTP id E17D02009A for ; Wed, 14 Sep 2022 14:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663166727; x=1694702727; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=bdoccEymo1H3GjmexvKpOqscCGnqGDW6yvBGN6gRctA=; b=Nq/uLqdLB70dBDkbW9Xjq/MKU/niQkegbQ9BT+1fTOcty3m25wu9v/gP HUm2w8hbHK2d97cJwWzMNkkdz1D2K95hAix9BH5EM2B6ArMLTlpUc+wEp zpDFZNHGpyAd4ekz7tSkmkmm91q23q4Hkij2uq8MSt+nplV7dPI5YSVvK y+HcyFph/MU7+rvTPSgi8pjtlOJuyN9pduj0/naUcIU7eWXF8oIpJZgC+ Yf+3jnvWzs4MgY7PCRcQN56ilpp2sK0/Dj9o8tlAX6QnNYGrrmg+U4HW1 tSTTMwr+JyqRF/fS/sqj5EAx/bg9RGCK2qFwWT9I0jf83A4uz2IFGJ2Vo g==; X-IronPort-AV: E=McAfee;i="6500,9779,10470"; a="299804582" X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="299804582" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 07:45:25 -0700 X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="619334608" Received: from gcapodan-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.209.179]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 07:45:21 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id BA63E10466D; Wed, 14 Sep 2022 17:45:18 +0300 (+03) Date: Wed, 14 Sep 2022 17:45:18 +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: <20220914144518.46rhhyh7zmxieozs@box.shutemov.name> References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904003952.fheisiloilxh3mpo@box.shutemov.name> <20220912224930.ukakmmwumchyacqc@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220912224930.ukakmmwumchyacqc@box.shutemov.name> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663166727; 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=3INBVR6g7lxuBD3u2E9lA0K/zExg9pOL03ZguzxU2Ww=; b=s+lIaqmnqkaIBSwLpMcrhP0fzCEjTqkdCKGC8txTZYq6mbCBWksSD0gCM1dzhzoXEVNus6 FjaGsuWUqjenuHRxtMMKGvjMO9JsCFo7BDSCiG4pQmXJvDZKGrQePcN3hq7ha69Q9mlaYl pLOSUifPBwSeatRa+LhKwWAu6KYcy2E= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b="Nq/uLqdL"; spf=none (imf03.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663166727; a=rsa-sha256; cv=none; b=5F20wR5WPElQhXKzUHcIEwdi3RV90SonNBvxyjFFy25wpQHwHKizJ7rlU0k0LnH93a2hKA mY2QbXjGygla/nIPJZQDcLOYdsC0nOp20Iuk97ieLb7hVhnVOpI91ZtR7D3VOE7x/SdprF zIq1GPSFiFHGCuVlkIG20X2uIGooi6s= Authentication-Results: imf03.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b="Nq/uLqdL"; spf=none (imf03.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam08 X-Rspam-User: X-Stat-Signature: xbjq8qbqb6fwhisqb6sqgyu943du8hij X-Rspamd-Queue-Id: E17D02009A X-HE-Tag: 1663166726-176745 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 Tue, Sep 13, 2022 at 01:49:30AM +0300, Kirill A. Shutemov wrote: > 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? We need closure on this to proceed. Any clue? -- Kiryl Shutsemau / Kirill A. Shutemov