Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4287467rwl; Mon, 3 Apr 2023 02:45:56 -0700 (PDT) X-Google-Smtp-Source: AKy350bh6YK23NbZE2wCtmTX6H+h+etwQ0WUOVc1RJk4wj25tfyu+xTwX18JrocA8wfAhEaq2IZL X-Received: by 2002:a17:90a:31c:b0:233:f394:d83 with SMTP id 28-20020a17090a031c00b00233f3940d83mr36212074pje.48.1680515156507; Mon, 03 Apr 2023 02:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680515156; cv=none; d=google.com; s=arc-20160816; b=dXUZfSfDJyZnsf37jnrthSDPnxqpdBcl4IGvIRpH1nzSUfhX24EREpS4FCRp0orw9v Uzgoyq24HS1XTp3fIdXBpOUSLPqk38y+iyj2rd9VL48SkHzKTfQIYDAIW7THUT27nbUs 9Bc72fkB9xUqt62hoJdmiQBKu7cIe8JyAD6vMT98TvAHx457vhEkOwkiEHBIDadFuGGe WG1XDlLlo6OjG3+wa9iWhx3ILkK8aureWW+O6HdYMZYRm2Z+uM8QVQQZvzjHeBhgh93I lU928E8Zwj+G/Kp/3Tw6E2xof8Zwm10EMhOMFBKSMOSOrP0BgICPsZfArCQhbiGz8dXC Ez7A== 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:feedback-id :dkim-signature:dkim-signature; bh=2pcfFIJgR5HmBPHP1v+3gt9ctXXHOFIL+EutshVs9fg=; b=A1Cs4lw0/HluDeKA1VTSz0PVvjavIGlAQ7B9EtVhNLx0DDa3vu3fSmuyZC33KxYY1y 5LUqJ6uIaezizdANkjni6zX5xhf1ZLJD4oJGHpihj05dPVspH4y/z70XT9/+l5/Gaa1o HXFkTnsAsobtRFu7vkxu4lZNDwyJIYR2urdnPHmwNEDxHAelsfVuiYtnOnIKsMiVORjc 3VkIOKJ3JIn5VDL3L1qggKMIs+BaoSx6PAP2XgMenpviNXzmQWA6+B/oxk/1DnN2fWnY jBXyrLN2wdhkPH5LZrBf9Ri9f1w7LrQexgKyfXxly0QSJ/PctWcJfy6sUoCVhGyNiI7H I5MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=W+3Oj32T; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=XUmijHB1; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a17090aa89600b0023d22d0f0fdsi12586136pjq.19.2023.04.03.02.45.45; Mon, 03 Apr 2023 02:45:56 -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=@shutemov.name header.s=fm1 header.b=W+3Oj32T; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=XUmijHB1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbjDCJpd (ORCPT + 99 others); Mon, 3 Apr 2023 05:45:33 -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: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 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