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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B33C8C761A6 for ; Mon, 3 Apr 2023 09:45:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232288AbjDCJpf (ORCPT ); Mon, 3 Apr 2023 05:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232265AbjDCJpL (ORCPT ); Mon, 3 Apr 2023 05:45:11 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4E8113D1 for ; Mon, 3 Apr 2023 02:44:44 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A81A65C0158; Mon, 3 Apr 2023 05:44:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 03 Apr 2023 05:44:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1680515063; x= 1680601463; bh=2pcfFIJgR5HmBPHP1v+3gt9ctXXHOFIL+EutshVs9fg=; b=W +3Oj32TsZ2HMHjTi2MPIXNX1TRSAG87+b3XedOPC0NX3IxGAhrO1g3ZUbIkOlTM/ eeAOBkOz7Y/WQ0hEljKi2wULs18jUxl75nHL6iPHIL6mxwE9pTWtLmOh4DrEs0Ej JcowUSrUYxlWtI23iEH0BFEPBtsefcpbJsm7ZEC3tdG/5cRFIGbSKyCKFhHeBLRw 8jks8bGQrIXWlOP1VizwkFKDeT69SW+NRyoamZE/G50/LeKChndo1gkOcks3n+Q+ X5MAhCEXNLXsrrgoEtmDd5RaeTSoD16I42NpEUWuyPokor6EoiXlwNIY/vITQHan V0uJ26+r9EFudbhxJiulg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680515063; x=1680601463; bh=2pcfFIJgR5HmB PHP1v+3gt9ctXXHOFIL+EutshVs9fg=; b=XUmijHB1aMmu3mAcL+QsIFrIp57mR X/0U4XHdR5ZzNLx4NAOiOZ/gMiDZRMMPC63Loxu6TGlcdPatM4jG+bUumC1C19cb DcmfYn3ZwBxHGo7Ybgp+qL94LUpPzzycz9ZqObqFJDN3D8lbQxOcSsrI1yaAFSJo CyGjOF9njKvZ5EkfiVbOO8KqHXUxF35Boh0y+ZKtnBCf4baPO1tSF6YdBVpw2ZjF 6gRmqecmynfhfng5vGBPaS7v3iZ8yaqHs9abShZMt5+G0om/bYv4GmtVi/2ESxPk ziy9w08fFihiwtB42PP0xd0T+4M2CVuFT9x8lLnUfxP3sBn5ah3mzz9mw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeijedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpeeuveelveevleeggeevudefheeifeegvdejteel jeejtdfgfefgvdeiheeuvdeikeenucffohhmrghinhepphgrshhiugdrhhhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirhhilhhlsehs hhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Apr 2023 05:44:22 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 43B4610D7B3; Mon, 3 Apr 2023 12:44:19 +0300 (+03) Date: Mon, 3 Apr 2023 12:44:19 +0300 From: "Kirill A. Shutemov" To: Dmitry Vyukov Cc: "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Bharata B Rao , Jacob Pan , Ashok Raj , Linus Torvalds , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv16 11/17] x86/mm/iommu/sva: Make LAM and SVA mutually exclusive Message-ID: <20230403094419.zl2ncsd4qyd35fex@box> References: <20230312112612.31869-1-kirill.shutemov@linux.intel.com> <20230312112612.31869-12-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 03, 2023 at 08:18:57AM +0200, Dmitry Vyukov wrote: > Hi Kirill, > > ARCH_ENABLE_TAGGED_ADDR checks that task->mm == current->mm, > shouldn't ARCH_FORCE_TAGGED_SVA check that as well? Do you a particular race in mind? I cannot think of anything right away. I guess we can add the check for consistency. But if there's a bug it is a different story. > Also it looks like currently to enable both LAM and SVA. > LAM enabling checks for SVA, but SVA doesn't and both are not mutually > exclusive. For LAM we check SVM with mm_valid_pasid() && !test_bit() in prctl_enable_tagged_addr(). For SVM we check for LAM with !mm_lam_cr3_mask() || test_bit() in arch_pgtable_dma_compat() which called from iommu_sva_alloc_pasid(). Hm? -- Kiryl Shutsemau / Kirill A. Shutemov