Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp286812rwi; Tue, 18 Oct 2022 17:53:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aytrmCBpQuY2M+f2kOe5uzWUIIZ2AfRRgIyDezpfJuvYm93rD6Dcpa3HFu9Bu5vBZozB4 X-Received: by 2002:a17:906:8a61:b0:78d:9d00:c906 with SMTP id hy1-20020a1709068a6100b0078d9d00c906mr4593507ejc.321.1666140820308; Tue, 18 Oct 2022 17:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666140820; cv=none; d=google.com; s=arc-20160816; b=QmolwKiqlw3o2UBe5fEYUfE4xTcaaNih0BSokRi+C1e1SWTQEGKfu1FdHHgEgUDUmO 3F4hnyNUYEodN9sBxeLRbHHcIlJLdb4HSLHBF8Q4T/l6VVP46BUUDBfIpYaKYPs9I6hW WeDYwQUwfkMe3fndiIR7C06hm235fcxXtzrnaZLdVl/BG6BYWL8lie0UsuDXt84Gbyby /StorS/oVIvB1ioHW744nWHyEqxUnqgG/voXfKca+DFlNnFNCXrQn60Rx7o458IHlHNM zQChm2GEX8RjmfxQjbOe3M3lBxpZfs41s8ktgJWCCDBbbEvUKl9xpjJgFS93S/TA7u3W Qfnw== 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=Zsrr5zTY02howzem/uvI6lDyxx0n45EbNI50IgAhUQI=; b=xlmir+9AtloFGk54QeZ3cEPXqMaEpZ4hKdCA7YAQuOFfduc7Zw2nqXlmcFhDq2bDvX rWjFzHMAkVLBnm5ZpbQEeyzEBcMnDllMbOcbBa77EsaeJIT/sASQ0LnZSmyt7IANG54v dfxOVxBzcAQuxe/3Pw6gpXIkQPsVZfWYZ4ONyfN5rsYWzvk4zgEXsFZcguuR5X9sIfzp e+cOadPgr8KPD4v5t5MVgZeZ51tVoraQY8wwON/b+k44zDCqpopcsHgKZUHspA26lLik kKxycwA+9hogMRKxgLaFZ5fvq+Eg38vVZ0FYUEgwfydF97fDMcMzFHJGpoU2zIFay9xF /BdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=IekZB6N9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=fKmR60Lv; 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 oz42-20020a1709077daa00b0078c6a12ff3dsi14772289ejc.215.2022.10.18.17.53.13; Tue, 18 Oct 2022 17:53:40 -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=IekZB6N9; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=fKmR60Lv; 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 S229808AbiJSATF (ORCPT + 99 others); Tue, 18 Oct 2022 20:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbiJSAS5 (ORCPT ); Tue, 18 Oct 2022 20:18:57 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73DBF61724 for ; Tue, 18 Oct 2022 17:18:44 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 609D232005D8; Tue, 18 Oct 2022 20:17:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 18 Oct 2022 20:17:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc: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=1666138651; x=1666225051; bh=Zs rr5zTY02howzem/uvI6lDyxx0n45EbNI50IgAhUQI=; b=IekZB6N9aXmmp56dDq AGYDZPjs8E8Embg0az0P7eZ9n8tRRlGNNDOXryCpMXrKYNhuBRwA4/4WPHvwh5ON jOeZ12EjTF6wds2wejtrrCTeSQaomXjL/v9gbLH10hLXyjW1iKO1j2QCT/XMkqXl GL/ugr9lYS3EMHsKjG/ztjBv67WHTbh9I6lv4VGKXsd6aH1RskzZhk6lM6VnttLW lJ0GARrdwvsWxTPQmtQG3Z5VoTbtK/7YJOy5DE4lfqn5t+Ox9rU9dwnC7oV4s+bz OyahTkuhyM6V9vBlwfH4Z81G1D3/jMsVZdKlaw6p7AmDnF2gFtOCcER541IKWOqg QTcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= fm3; t=1666138651; x=1666225051; bh=Zsrr5zTY02howzem/uvI6lDyxx0n 45EbNI50IgAhUQI=; b=fKmR60Lv+g7sxHHF/buBNNOaiofDe5SvlSZdQqetpZY+ jJljp5xTlx5IJzTGM3i+IF74xp9EfmshbhJIAD9wMqtMgzrG2J//IBorNW3QRD6/ 3MnJ6BjchFYWPyKs1t0yUik9otojIOaqADMERKc9XcW6KtNBsBLFAqlJ4+iOgdc2 Ev/RrHTgRQRgsPPFpg0CWMOUPaPTZknk1q9pHA5rqReGJXaAyYsrcyZ1HUbOrYlq dbRqRyhfP+FLbumsJ7nOyM1caD5EA4SPc08jrTrehBEBIK7LoD/yj3La4jrEywnK tJEoZ488L6AoV6cdNcw52Afcfcuu/m9wbCZqY4kBcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelfedgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpefhieeghfdtfeehtdeftdehgfehuddtvdeuheet tddtheejueekjeegueeivdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Oct 2022 20:17:31 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 5C2781068AD; Wed, 19 Oct 2022 03:17:28 +0300 (+03) Date: Wed, 19 Oct 2022 03:17:28 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , 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 , Bharata B Rao , Jacob Pan , Ashok Raj , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv10 10/15] x86/mm, iommu/sva: Make LAM and SVM mutually exclusive Message-ID: <20221019001728.jvjtrkoe7aqmhfww@box.shutemov.name> References: <20221018113358.7833-1-kirill.shutemov@linux.intel.com> <20221018113358.7833-11-kirill.shutemov@linux.intel.com> <20221018223341.tiyypudh6k63mnnb@box.shutemov.name> <3a0dd700-ce2e-e1ec-ee8b-74cd68c360b7@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a0dd700-ce2e-e1ec-ee8b-74cd68c360b7@intel.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 Tue, Oct 18, 2022 at 03:43:24PM -0700, Dave Hansen wrote: > On 10/18/22 15:33, Kirill A. Shutemov wrote: > >> Is this #ifdef really necessary? CONFIG_IOMMU_SVA selects IOASID, > >> without which pasid_valid() is just stubbed out to 0. > > mm->pasid is only defined for CONFIG_IOMMU_SVA=y. > > > > Do you want me to add mm_has_valid_pasid()? > > A quick grep makes it look like pasid_valid() could be *replaced* with > mm_has_pasid_valid() since all the places doing pasid_valid() do it with > mm->pasid. Almost: the second pasid_valid() in iommu_sva_alloc_pasid() called for just allocated pasid. I guess we can just opencode this case. -- Kiryl Shutsemau / Kirill A. Shutemov