Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3963423rdb; Mon, 11 Dec 2023 05:21:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8DBnbxYYoLtKFRZJIMNfTlK20wvvnK/3JK3Eh2JkBLisdiv/P8kqifxl9BIard+b+xmSR X-Received: by 2002:a17:90a:7c06:b0:286:6cc1:5fb3 with SMTP id v6-20020a17090a7c0600b002866cc15fb3mr1943141pjf.54.1702300878422; Mon, 11 Dec 2023 05:21:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702300878; cv=pass; d=google.com; s=arc-20160816; b=oKsReJcsZBldTR0eMH7Bpmjc9P1bvFFPGHSBeZbzcTX1drmuPAOgSz+ipojH6Pz9KX enFHp/v4PLDcledOYQSNeR36QzQZoYApoSbDGfGsWcLeR2vCHQ3KLOPD9RxSpPnKGfQF MISEh+LBfDfOmuwfVnTFDZM8AEQ8VbCHM2/LkabhK9TIGQsbE1EY2c9NCoHGos6gRle0 OAFVVeUQduO4mNVv0QVfDFcEmr3sqqv7S20UyPxX5AcrzKyikmdjN0bnQYSgUereqANo wFfuhJrkl2Z7bixKxIsR62b1X/rcEcDkVY7LDmtl9bMxH5E4PyWN2Q/J2ZSYEPluGj5O hC2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=W+WITRz0gjyWRA3VOGox+SRsg3Itx/VuYGmKozrmE1o=; fh=jGLd51VCnz6eXOix+oLOxbXE6OjIM1RmrZW7pOw7uS4=; b=RrlDB8l88wsJjA9dVe9PzMjPyHgYIsXtwWfxkINbI64xZXA0mcLAQndCSaCGSm/Qq5 j5pi0erkhtrVwypIXF13S7NnV33eh36WLk83A7MkxenvlHst6U2XM+sQ3kG1mAck72Rg 6Jh/GJstp3kWp6NG9THdvwX3sy3EIdkt9ITGApveZMTX62Q0qv7q3uvkmae4xyuKijPz nzKOh1Dor43+hSxz91Pnrb/a+ux2GEfzCK8pGrPyRctuxE9U+QmmYJCuyIIIkCR3G5a8 rdjUiUxQPelzPnpfEgkGLYjfzdDoKdDuThV7LEO5s+wzQ8Ykwb5sFfHZIUxxRrirohuU AG6A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=BJItbru2; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id q95-20020a17090a17e800b00285b7529e7asi6220780pja.103.2023.12.11.05.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:21:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=BJItbru2; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9799C8093C8F; Mon, 11 Dec 2023 05:21:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343541AbjLKNUp (ORCPT + 99 others); Mon, 11 Dec 2023 08:20:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343654AbjLKNUl (ORCPT ); Mon, 11 Dec 2023 08:20:41 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57097DB; Mon, 11 Dec 2023 05:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F4rpjM1iHybaI0vX/nOADeutbLukThbPon8DA8gNGUHFHT3tkB15efbRYKK2P56pmOVryEuezdptbrn6+Bu0uUgB+Vi+VwRkJ16DnYuXUpxx0RHMCeK4FEyye5ZBc39x0altVw0I1ILOTchmdvdDbsDrLjzlD/XwxzvWTX3gyyKUTYsRZZPzlbBSg7ttrLpSewaAi2Pf6OkCljq6BwwfFlU698mxTEd/eoXj9uXkGffQwXq28uukY9XbghEF/F95+J35/YIM20XxeCkUmLDwXpdUil/m1CUx+j8ySVzOGLLaRV5qcKiKATx71n1/GeAshfxYs0Y0fAJepYC3D2o67Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W+WITRz0gjyWRA3VOGox+SRsg3Itx/VuYGmKozrmE1o=; b=UFrMHlTz60fE1ioHO8PIwsyBMLdLYczT0yYWx9YqNGs7w0JZJl9MHPOD6I2GPArIGvi8CMrTzI0Do/zXIltTfDVgupQaOXRJ/vTBhBWVl9FdRBxp5HvmRprBtOmG/Z8lmQzonJL40PFxUZl1tzTMVi7gmLDmsoGo1pc97W6HkU5DK4h2P3odUrAD0tbNgEPOI9AUPaghYk81CHXrJQHjzKgTpHTF6+VbR7inKbOzkz8q1sCbgOcrH9BgeXg4ByZMSDY6eqAX5oXAxLAfNo10nwt+PrfahHloP8G3nyQzqz8GAgg8qYlvNVuzxPvQ+Er3dt6XVMXFQdrzuprpcIUqfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W+WITRz0gjyWRA3VOGox+SRsg3Itx/VuYGmKozrmE1o=; b=BJItbru2mQv9eTxsePpH6XHlrxQi9VQR09ItX+u1Najs85x+cc4pnb9jlhrqiLkwJ1SGQB0H/2M0TzpiHBVLYYI1xxD/NXxmwpfmCMpv9A7sPRKHf9OOacz89PtIUyFxr/jha+XpyJtC2yPVnI6aAzzNm6vIyQQOlEUlxAzeJ+5O+RCMQXNbzmtVih6Re8UV3iKhN5o9UlbwvYVkSeBkz8FqHoAZ9lMBWTHqEGItRloqXFWpNDhkg2vhYqbLbdFmXr++gPjQbs9+jlOJ+FqLRwHKAcwKCHd3ZkmYVW7Ud5kmljSHTiuzfVlQMSs9YyjyOxG/62lQXWuYAp+hDeegwA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by BY5PR12MB4178.namprd12.prod.outlook.com (2603:10b6:a03:20e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 13:20:43 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 13:20:42 +0000 Date: Mon, 11 Dec 2023 09:20:41 -0400 From: Jason Gunthorpe To: Yi Liu Cc: "Giani, Dhaval" , Vasant Hegde , Suravee Suthikulpanit , joro@8bytes.org, alex.williamson@redhat.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com, cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com, xin.zeng@intel.com, yan.y.zhao@intel.com Subject: Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2) Message-ID: <20231211132041.GE2944114@nvidia.com> References: <20231117130717.19875-1-yi.l.liu@intel.com> <20231209014726.GA2945299@nvidia.com> <77ac47d0-2ef0-41fa-86c2-091358541465@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77ac47d0-2ef0-41fa-86c2-091358541465@intel.com> X-ClientProxiedBy: BL6PEPF00013DF7.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:9) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|BY5PR12MB4178:EE_ X-MS-Office365-Filtering-Correlation-Id: d2d80785-df60-43fe-fd54-08dbfa4bfa07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tDBsMTHoYR9L8xV2gjK98vO+SgRK3l+RZILJ8t2VAeKByDjkJ9+8lBhEKVquPb63+KTdSvl7qkXasAyUrBTBXFwYztjb+EG6q9klJpNZ7K+DqFCuqQL/qV9txNssymHqU63fEylLNu3URcRTMEKdkTNvZTABw1kk3uxYU+VRB6BO6yp9Lr/anWM+qPwjE5+iGDpLBnoZioL9SxnTexO+YAnKA/VmtlWlA9vpZcTzkNhYUxyIZ4hg3HU5Tw5CPz7DISl+kwfmG8vG/le7qtJPS9HdZx5o60d1f69PnQmFC86L4VPy8puTkQg8TjBTEZZIHaT4I+ausulN3XBSVG7FhCGjJiFk5cmPAd2BaQG2GpBvofOdQiILvavwSts3NiKNZJQNFQ7D5u+Sr7ohfojKh5zUGLcV2D7e/Ork77r6/aPGBtpAFF/TDEOKl5kiSmYTaBhj3bCsH8ETldamEaKBgcUm2g3od25gbDDIBz4juzRCeOKY1f1D4+IkBD8dhETn1HQIKAvDF+dIcqU/yIeus9xFGOFRFtcQWUfA/UfJ74l1i5TknyF2O9cqwX7vI9ez/PEEooiIiCSU91iwFsOVe37evbkPO7RdsFYUY9pshps= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(1076003)(26005)(2616005)(6506007)(6512007)(83380400001)(5660300002)(7416002)(41300700001)(2906002)(4326008)(478600001)(6486002)(66946007)(8936002)(8676002)(316002)(66476007)(54906003)(6916009)(66556008)(33656002)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0BcBTaelb7kFCycCipzLQzRcElUN91/lSyFFkZ+DBZyqcT77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YKCXo1QfestCqaq5egdUYMQCkvT2fKYo/UNJsbXRzkbQu14dLHuVC?= =?us-ascii?Q?UN0Y5VBFKCyeBpDxqcp4Y05zA0d1QPdbAJYqQBNNetyzQeCPB32xpnH5uGdb?= =?us-ascii?Q?UBUbT88WOA20L4p0kEYjS1LTIgRpdg04um5Ah46kNP6xNKkM1Npx3cCork10?= =?us-ascii?Q?heos1uI6h73PhzM65c7zvwsW55WqpFiaqhpgDADF5kb2I0I+CzvX/6Pxk+06?= =?us-ascii?Q?WHuXjBscm20l9ji7H55VyxSmNZs71zImrtTSUgFcHmGNq9XD3i8OBNYF/jtW?= =?us-ascii?Q?tsZsYIIUbljry2rL9M5kNtVsvUnJFWHXEUewMwqs/CgbIAO/BsduzLF+IYsh?= =?us-ascii?Q?XsMY9CIuWllZpSDJMlORIBTUb7B14jaILhwZ96Sc0TWVg+Z53S4c9RsO+ZMy?= =?us-ascii?Q?2gZNNPPtsqkopqwdi3fm0dsXawJZtn6wwd80SEEDeP+VNDKQNdq/ywAnETxe?= =?us-ascii?Q?sMLm3t9g/Cxu7ciOvEHitncg9sOzzKsjDXNZVoajvGTdlPkoZm/4ny/7LviX?= =?us-ascii?Q?nl69g9y2n6ycw8jlY70o2XSWXb4Y963UpgJ5RHxFdq6I+v+sSJ/7Kbw4vQNJ?= =?us-ascii?Q?abXkH/vtM9MRc6J7KYopva7fmu8PRP1T8luIwPF9uSVvH+g70b0XELW031R8?= =?us-ascii?Q?GpYqJxffyBibHfg4tTR7hph34K2dC7cik0TyUQ0G?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2d80785-df60-43fe-fd54-08dbfa4bfa07 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 13:20:42.8520 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6USC606W1KUQG6muXesMZiz0WErARjrBK6U2Iy+mpyRkoxXXe0ke2lv1GxnJ9n9N X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4178 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:21:13 -0800 (PST) On Mon, Dec 11, 2023 at 08:35:09PM +0800, Yi Liu wrote: > > What iommufd object should receive the IOTLB invalidation command list: > > Intel: The Nesting domain. The command list has to be broken up per > > (vDomain-ID,PASID) and that batch delivered to the single > > nesting domain. Kernel ignores vDomain-ID/PASID and just > > invalidates whatever the nesting domain is actually attached to > > this is what we are doing in current series[1]. is it? I think so > > So.. In short.. Invalidation is a PITA. The idea is the same but > > annoying little details interfere with actually having a compltely > > common API here. IMHO the uAPI in this series is fine. It will support > > Intel invalidation and non-ATC invalidation on AMD/ARM. It should be > > setup to allow that the target domain object can be any HWPT. > > This HWPT is still nested domain. Is it? But it can represent a guest I/O > page table (VT-d), guest CD table (ARM), guest CR3 Table (AMD, it seems to > be a set of guest CR3 table pointers). May ARM and AMD guys keep me honest > here. I was thinking ARM would not want to use a nested domain because really the invalidation is global to the entire nesting parent. But, there is an issue with that - the nesting parent could be attached to multiple iommu instances but we only want to invalidate a single instance. However, specifying the nesting domain instead, and restricting the nesting domain to be single-instance would provide the kernel enough information without providing weird new APIs. So maybe it is best to just make everything use the nesting domain even if it is somewhat semantically weird on arm. > The Intel guest I/O page table case may be the simplest as userspace only > needs to provide the HWPT ID and the affected ranges for invalidating. As > mentioned above, kernel will find out the attached device/pasid and > invalidating cache with the device/pasid. For ARM and AMD case, extra > information is needed. Am I getting you correct? Yes > > Thus next steps: > > - Respin this and lets focus on Intel only (this will be tough for > > the holidays, but if it is available I will try) > > I've respinned the iommufd cache invalidation part with the change to > report error_code/error_data per invalidation entry. yet still busy on > making Intel VTd part to report the error_code. Besides, I didn't see > other respin needed for Intel VT-d invalidation. If I missed thing, please > do let me know.:) Lets see Jason