Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4065137rwb; Tue, 20 Sep 2022 08:20:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eFMfsHcN1M/D2ebV/mUi4Ol68Fizg5e9aBIaCYO48W2oPhOlnXESsXVtiFDpACTWJ7Okj X-Received: by 2002:a17:903:234c:b0:177:f6dd:847d with SMTP id c12-20020a170903234c00b00177f6dd847dmr236260plh.118.1663687258453; Tue, 20 Sep 2022 08:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663687258; cv=none; d=google.com; s=arc-20160816; b=wMbf39gmP1xpo9mBT2Qq7BJCCscFkuVnHz25eBi5tvZsknJGXeeNaVWEwbuBgCoArY aKreZfLRxDeZCLaU3ippDUy5/+7zqbD08JX5N4d7MUo1zedFoeibbmflf+TD3RBxaGNt ioKZ0CDkRlGPCd+HoGx6d5cm6+upbeMgwvs533nSfWnZRslfLKxaYA5ohw6lmLdVENKn KDt4vAuqGpN3vRZAhM92XE+b9yg0WwzqkEq3cnkRFfQMkeA3/hEY3G3ZeOlRxnEzvWqi tPPzwDGuVHyXxpVuy+aws3xp3rxE4RZWDkIdKT/SBaZP/dI/Qvk5V3CPbAdbK8ftLosA CCjw== 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:dkim-signature; bh=7TwXPIUPNlxVrQeEDX/RFkTdUiAJ1SXKy/4VgbH6C4k=; b=kFzy7OUq6mUGeRPfkcZCWEurBTJyVmlKYZzVC9dL+UugSgCgWOgXvlbOpLWtFVLvjm ZsK/B/rwrRuIVEw4qsO+FeeV1N15MfmBOyhUYUr1dzPJrlXTjPutECODvahUSfisczDi x94Y++DmpSPVC4giHa9lfY6JW95aF9uxeI3SWKGHYln7QqVlHozlxIk1iE/vNGOJG34k KlckK3HVwY3fkzH0gBkeOoMr3oh26/zEe089a6LE9dxSxyToUb2Fgz+9132dnFZsi2cZ 5NqSUPCPbZASBiuivhZujAPgrGiFwmobsE8f9tpBsqhaD0TG/39FVBuiClCvpvENrHAO EzTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HOElLBQJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a056a00158600b005370942e40dsi2091295pfk.324.2022.09.20.08.20.46; Tue, 20 Sep 2022 08:20:58 -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=@intel.com header.s=Intel header.b=HOElLBQJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbiITO51 (ORCPT + 99 others); Tue, 20 Sep 2022 10:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiITO5Z (ORCPT ); Tue, 20 Sep 2022 10:57:25 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A0961EAC9 for ; Tue, 20 Sep 2022 07:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663685844; x=1695221844; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HvCoWXC5l0s95QFD5U8TCexD257nOCbyPLfqtS7D3tA=; b=HOElLBQJNgKO7FK091pFxrUT4PyaPwP4y4iuHX07qsSgnFtdEvLLhR3x v9QWq3AZQP0CefH9dg0wcj1xHrmC8FzRd0CcwVdHKw66k89J2xQO9TvHo RKWub0r0NVPkkgsfwGIUHbQvEkDr3lzY+Ing5E6h/2OeO181FhSHvxgVk N764ie3PgtzUXuEdIZZ34FtQRfiVEhCMNOVrEpY2tXHapHu+9I4cMf7JL 1h/90UT3ipBmkmBqACfNTXqa5b4HUxqI6FeH0C0rsxw64zGUl6Z3+qOrp J7SDLjhRnqcMEiqhFVXejKG/LZdLOSrVbKa+uO03x3zaWArhOGdGszdX+ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10476"; a="301095915" X-IronPort-AV: E=Sophos;i="5.93,330,1654585200"; d="scan'208";a="301095915" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 07:57:02 -0700 X-IronPort-AV: E=Sophos;i="5.93,330,1654585200"; d="scan'208";a="687441949" Received: from araj-dh-work.jf.intel.com (HELO araj-dh-work) ([10.165.157.158]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 07:57:01 -0700 Date: Tue, 20 Sep 2022 14:57:04 +0000 From: Ashok Raj To: Jason Gunthorpe Cc: "Kirill A. Shutemov" , Jacob Pan , Ashok Raj , "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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Message-ID: References: <20220912224930.ukakmmwumchyacqc@box.shutemov.name> <20220914144518.46rhhyh7zmxieozs@box.shutemov.name> <20220914151818.uupzpyd333qnnmlt@box.shutemov.name> <20220914154532.mmxfsr7eadgnxt3s@box.shutemov.name> <20220914165116.24f82d74@jacob-builder> <20220915090135.fpeokbokkdljv7rw@box.shutemov.name> <20220915172858.pl62a5w3m5binxrk@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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, Sep 20, 2022 at 10:14:54AM -0300, Jason Gunthorpe wrote: > On Thu, Sep 15, 2022 at 08:28:58PM +0300, Kirill A. Shutemov wrote: > > > @@ -31,7 +33,17 @@ int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max) > > min == 0 || max < min) > > return -EINVAL; > > > > + /* Serialize against address tagging enabling */ > > + if (mmap_write_lock_killable(mm)) > > + return -EINTR; > > + > > + if (!arch_can_alloc_pasid(mm)) { > > + mmap_write_unlock(mm); > > + return -EBUSY; > > + } > > This has nothing to do with "allocating pasid" > > Rather should be: "is the CPU page table compatible with the IOMMU HW > page table walker" Thanks Jason, this certainly looks like a more logical way to look at it rather than the functional association of allocating pasids. > > For this I would rather have a function that queries the format of the > page table under the mm_struct and we have enum values like > INTEL_NORMAL and INTEL_LAM as possible values. > > The iommu driver will block incompatible page table formats, and when > it starts up it should assert something that blocks changing the > format. > > Jason >