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 5ECB8ECAAD3 for ; Wed, 14 Sep 2022 15:45:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 773618D0003; Wed, 14 Sep 2022 11:45:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 722678D0001; Wed, 14 Sep 2022 11:45:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 611988D0003; Wed, 14 Sep 2022 11:45:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 50F6D8D0001 for ; Wed, 14 Sep 2022 11:45:50 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1BEC640630 for ; Wed, 14 Sep 2022 15:45:50 +0000 (UTC) X-FDA: 79911116460.11.12F664A Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf17.hostedemail.com (Postfix) with ESMTP id 38D5C40096 for ; Wed, 14 Sep 2022 15:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663170349; x=1694706349; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2J58XWUXP07cyxLDmZJLpFnGymq3h5HGsgmtzg9SqzE=; b=WPQslOmJ6QfuIH8imokchry9ug3kZA4FBVYepP22gX1DdF6Opz1NB5HM cLbUtg08kL7eZYDLhbCc/9pi2gs7HH0arSj0EPx8RxhZKx94ZnbqgDBUw qtpeCDKNvqIc0olO/4RYjWEkupQTxifJ67sltKY0n0zJzXcHL3USk7Uzm qhpLmRBqJtIMWP/KK6Fjxy5GyQggnk8gpgiWb+exTGVCfMW3u289BRsAT 54ozF+0EQO95YjosUvXTRiXdJoyPd+27nLCH4WbUI8yxthapoTo0QaZ8e PVTNO1a8Vu1hDDNWCfqd/ksbrDNIjnAFXLGMTFvM9Vd9R7oB0wlRQmfNW g==; X-IronPort-AV: E=McAfee;i="6500,9779,10470"; a="298460592" X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="298460592" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 08:45:39 -0700 X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="650119021" Received: from gcapodan-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.209.179]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 08:45:34 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 0B5AA10466D; Wed, 14 Sep 2022 18:45:32 +0300 (+03) Date: Wed, 14 Sep 2022 18:45:32 +0300 From: "Kirill A. Shutemov" To: Ashok Raj Cc: "Kirill A. Shutemov" , 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 , Jason Gunthorpe , Joerg Roedel Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Message-ID: <20220914154532.mmxfsr7eadgnxt3s@box.shutemov.name> References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904003952.fheisiloilxh3mpo@box.shutemov.name> <20220912224930.ukakmmwumchyacqc@box.shutemov.name> <20220914144518.46rhhyh7zmxieozs@box.shutemov.name> <20220914151818.uupzpyd333qnnmlt@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663170349; a=rsa-sha256; cv=none; b=RbgQuiTQ+S5jB2T565OTiVcpY51bELti/69lqHvO8MlIG1LYXw6pAOb4Rd88mBE08flKWF sRU46E6CqCVMmhmk1lLNGrfCm1rEXOQjbABIPIUv97rsCnMru2v8UjZQDauIgdHVAjJ1vf V6RlExJ5yQT9FFUnsNAOhyik2yBgwJ8= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=WPQslOmJ; spf=none (imf17.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663170349; 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=CNs4MglVCK0cnwhher8oXP04wfcxQX8w6twg5ud85JM=; b=5fmTFFXxWWtTJl6Hb6+5o6ClcDRJ2yWKdSlTFEaZ7dyAQyPNNt5IYKMNbB68Rb2eAwPci/ P99OAP2gUqSATV98Zll7y7lOFFvTRmDw8by0Gke6jp5hs508DHe7vIvjnK25xoAQZehVJn LRtpL+AyyPPc4fObSpd+VHzvHsO/PXs= X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=WPQslOmJ; spf=none (imf17.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam02 X-Stat-Signature: h4kuxd8ad5ync8cf5tjgjinwqutddhew X-Rspamd-Queue-Id: 38D5C40096 X-HE-Tag: 1663170348-861561 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 Wed, Sep 14, 2022 at 08:31:56AM -0700, Ashok Raj wrote: > On Wed, Sep 14, 2022 at 06:18:18PM +0300, Kirill A. Shutemov wrote: > > > > > > > > > > > > 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? > > > > > > Failing PASID allocation seems like the right thing to do here. If the > > > application is explicitly allocating PASID's it can opt-out using the > > > similar mechanism you have for LAM enabling. So user takes > > > responsibility for sanitizing pointers. > > > > > > If some library is using an accelerator without application knowledge, > > > that would use the failure as a mechanism to use an alternate path if > > > one exists. > > > > > > I don't know if both LAM and SVM need a separate forced opt-in (or i > > > don't have an opinion rather). Is this what you were asking? > > > > > > + Joerg, JasonG in case they have an opinion. > > > > My point is that the patch provides a way to override LAM vs. PASID mutual > > exclusion, but only if PASID allocated first. If we enabled LAM before > > PASID is allcoated there's no way to forcefully allocate PASID, bypassing > > LAM check. I think there should be one, no? > > Yes, we should have one for force enabling SVM too if the application > asks for forgiveness. What is the right API here? -- Kiryl Shutsemau / Kirill A. Shutemov