Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp541822pxv; Thu, 15 Jul 2021 09:51:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVdivbaaCQK7w/zj3R9/USQvIUvQGzo46zrGmooLmGWzwOW5WwW4JHwHZPpHMoLns558wV X-Received: by 2002:aa7:d8c6:: with SMTP id k6mr8423704eds.374.1626367872459; Thu, 15 Jul 2021 09:51:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626367872; cv=pass; d=google.com; s=arc-20160816; b=iQY6Cew0d97AOxXY6eKuXA0fxJhNWWU0g+7dGvHJaOh+KqWUyZxyE1xPBm17KjMecE gKrK5DL7CfnC7AginwgvjFB2vG637OkMFsPyTLx9vJF0n/QZ+zAAssNQo+LAzRKkXUyz RL9xfBIEhAXKHnqu/Vs0C8O6JLmKMF4tURxHGUkbwYRudG89AopeAhPYCupxQRpD7qW/ dd4SVGMhMPugYUBwihRk9GpzqPZcqvNstndTO4IXSUJHd8FrNvuyXGCQW1ma1nI2MHUv 8NGSHHjr33hlSsWhNqtEtf7BQ5rfpkiiNX5lka8mVVTe30nrVfPlcBzHAY+rYkNm3V4D tbEQ== 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=VDOMs9645LbwKHJphhKgsfJVMcdvlpjNUnV63Bmr3PI=; b=DD8NSROJejeRElxxGxKwM9FGR/PNLLM3f7TOkNigtM3+BO0e5AsST6oL9yAt11b2hz tXjxjgXAbxUkwx7Rd/6aTuImS0mOlgPDdGz6VOEWpmoV3RKYxm8rH7kow4kIM0D1hgf2 lEsjw2qaOFhh+hJScaJuUwFR0dKu7tJOZCkYUuO2+KA2GfhmtVxGBzQTrcWc6+i6JhWA PECrw6sjlKNTpPpT58qhClSwmrGpMaDIb8YNnewHVbX/Bwe0OviYZmiDx/gnhfxPWIzz I030eNrnR3W3zocntGHxLVSVN+G801sb2rOA/cVj+HXauAWO5jqK4NuCqgpYuSRnrHKo QAgg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=klXmDCKF; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si8235557edw.524.2021.07.15.09.50.49; Thu, 15 Jul 2021 09:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=klXmDCKF; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbhGOP0Z (ORCPT + 99 others); Thu, 15 Jul 2021 11:26:25 -0400 Received: from mail-co1nam11on2052.outbound.protection.outlook.com ([40.107.220.52]:26304 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231438AbhGOP0W (ORCPT ); Thu, 15 Jul 2021 11:26:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ilaw+MTJaAAu6H0HsXMdS6XAuuzdVCmxYtMckkCn/woV/4IWaEk4H9AzD4AJpbCIWEknhCKNJFUeaHOW976CyirgTiPMq6oreMW7DsLIWr7J913Ir/juAnX9n+1Gjt0e9EmFVULxln3tq/fj7WM+PAqLkqMcarnPMalSZmj1l/WJ9b54I5nrCFrN7ywsmwThv88V067OdHUZ0Po02jtFBiy9M6MFNnbCJt+X2UEhRbWkbrfy16/dn2txlkyAllF6Y9Tf5PISqpduiD1ssz8r+brn91v9oYRxepYzymW7wJ96DN6+WblmvescdL6/cXo79cvefr8F0w4kVDSzV+7H0w== 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-SenderADCheck; bh=VDOMs9645LbwKHJphhKgsfJVMcdvlpjNUnV63Bmr3PI=; b=Lq8hxMcRaM2dzyPuLPGTtIRbKggl797C2XZGpPjkq+lE6sEBrXOTn9O9/4xR+W6TesVxrUOQfOFPou77Vp0n/l+sGwKrqoy3RgBNtNb189E4Za9bowmhjnO0wc86MzRUO0uewBMPSpl3ln9ptowtloihKR/by3KTifOLpM41x0wIofXBsODJJYbK5NlykEbJ6vuJpIUz9m6c+pWsNB7OJmLrFlSZ5keiL/IhPpeMiNZHbWQLW+ZOJPIDIE4E1pVbBwQNQL+SlQ9s88K8Vo3vrOhnppl5LNWPyjHCS1NjqG8VEhXyrZgNv4zSn7sjwCGLC8DFY37S2yO/aTKFsb2wXQ== 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=VDOMs9645LbwKHJphhKgsfJVMcdvlpjNUnV63Bmr3PI=; b=klXmDCKFIjBgAFvYvVLUam3di7mEXnyPCuGyhap/LijG7BVVr+MDHoWh4NBDrbRetS68lk3rr7zzNPfa3l1bCoca62q7ho7yZ0lGD12YXhTdHgRjoBVJU609cS6pbfD4duZZ+DlfoDouy0RqfmQLhubstWDPXR4dOXN7sO+ByxuvxOhDTt3EDIXckKiN/45PmQuvZbsYu0Gf8bt7TR6PrJepjulFW+hLSo+lu2wO9UCqSXZ+0Zmz2yaNVkm+1Untq+kLKfGYbyS87QKUcZY7VxSt3f5HBiaG3FgcJ/QpHM54iaUwkng/A6KMCvcc53wyFGViLSuGxwdXmLij8hXQDg== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5125.namprd12.prod.outlook.com (2603:10b6:208:309::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Thu, 15 Jul 2021 15:23:27 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::d017:af2f:7049:5482]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::d017:af2f:7049:5482%5]) with mapi id 15.20.4331.024; Thu, 15 Jul 2021 15:23:27 +0000 Date: Thu, 15 Jul 2021 12:23:25 -0300 From: Jason Gunthorpe To: "Raj, Ashok" Cc: "Tian, Kevin" , Shenming Lu , "Alex Williamson (alex.williamson@redhat.com)" , Jean-Philippe Brucker , David Gibson , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Joerg Roedel , Eric Auger , Jonathan Corbet , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Kirti Wankhede , Robin Murphy , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , David Woodhouse , LKML , Lu Baolu , "wanghaibin.wang@huawei.com" Subject: Re: [RFC v2] /dev/iommu uAPI proposal Message-ID: <20210715152325.GF543781@nvidia.com> References: <7ea349f8-8c53-e240-fe80-382954ba7f28@huawei.com> <20210715124813.GC543781@nvidia.com> <20210715135757.GC590891@otc-nc-03> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715135757.GC590891@otc-nc-03> X-ClientProxiedBy: YT1PR01CA0058.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::27) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (206.223.160.26) by YT1PR01CA0058.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Thu, 15 Jul 2021 15:23:27 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1m43Cv-002ha0-Iu; Thu, 15 Jul 2021 12:23:25 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91fad6ea-7906-4b51-5f3d-08d947a47e7f X-MS-TrafficTypeDiagnostic: BL1PR12MB5125: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4dcDuQGnfo0Rf/ybninHetQedXdHHevsbfMcB+OyDSs+B1WQvlxVmKRMUg9FGRRinb4LVuOJD86LgSKC1XNBS7g+UKoimZlmbUinprXoTAp9pKzrfChKbE6rfohpAGr3gFXxWUPNxH/nxQ0cNYEkshj854joyYla3nyzSLx4mER5sA5S7/gPGoUkV3W5fVwnzs1QG34smCr1FDXUK2uDiALSmzJro955UvcrOSztIchF8SZ1IaqJ4pugWxTbbY9o6iWA8y90QoZqfS42l4+AFYcBxhl7F61SwSEyJgf1N0mBgQnE24at03nmoj/o34Jj4cgWx/qMjpAtM8p1p8aI9DqaluDaLAAJ5+jnrrX024oP35owng20aI4QOUk0BFOhIIhvhrnUYiPT6bdp328yfgCHXHataXh3cb9SEVy0pj8JM/UNHyCPLfuccfsq7QHdlggvULgjEGSixt6DNKD5/Is8ezTh7dGVsd/qIhaOetTn7U8cZEgwLEPvxft5L8ERdkS5Dw8f3GhEU4t2a5BnDYVN77iNKKJOSrvhHWpM2RgUjIs71NELq2kxorggQNBjAjdUPZWBTulTV/Oia9RVzNnLSDtw/V99dUQpwSFcob+6jHMJb4YJcroyRuW/bEhK00nmcOPkjNN83JG8WQcx5xxc3PY2MfawaQ9k+d3a77LtNIPQ15A0Oavp0FhVXgMWC4vHLHp6pXKwnWxuef5Z6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(39860400002)(366004)(346002)(376002)(316002)(54906003)(5660300002)(86362001)(36756003)(186003)(26005)(66556008)(6916009)(7416002)(66476007)(66946007)(2906002)(9786002)(9746002)(2616005)(426003)(4326008)(1076003)(478600001)(38100700002)(33656002)(8936002)(8676002)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+LA1qGvwRrKFy16GnW1mClHVhY30A9XpFkRu32rnOVLQgAcxXt9f+VxEYE5v?= =?us-ascii?Q?6RzPvKNdY18YW1AlF9GuuxQ5sSrcvDuPpuOkOwbQ22yL+HF/8sNs+bwhQc5u?= =?us-ascii?Q?VPHiK8l0oxf5641w/f7M8OBPcnzjv+JbIn7cgF6AwSuEgnawhjmofEACCJlU?= =?us-ascii?Q?vJBX1Hp25cWXMokboDH0vt3tgMQKBNtauZJ/KGu9OSqHhmKGELS14J6buQLK?= =?us-ascii?Q?3Z1X7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ERld9SYMlCvFh2OdTKesewz?= =?us-ascii?Q?YQa991i27ViD67u4ev2spYpRQH0k0zGZoSYTaXFl/QetkYqE0eWQcTs2TI1+?= =?us-ascii?Q?HGwGgUMisg+q4vTBOGuaCEox4uakJf8hpy96cWhT7UWynBnOzCTJTYPeI9JK?= =?us-ascii?Q?++lMH6j8Wv4GuRDT6pkqJ5888egJg5jpdIY62cHjKqW8OEV6JD/eKFkjouuV?= =?us-ascii?Q?80m+47oR3luFNYhL40A3aPaU?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91fad6ea-7906-4b51-5f3d-08d947a47e7f X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2021 15:23:27.4630 (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: GXq4a+XILdfx4cBdpYSJSpQcgZdGOUXIu7GRfjlQC2FXOzFFd0OyUYW4Hxvcs9ce X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5125 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 06:57:57AM -0700, Raj, Ashok wrote: > On Thu, Jul 15, 2021 at 09:48:13AM -0300, Jason Gunthorpe wrote: > > On Thu, Jul 15, 2021 at 06:49:54AM +0000, Tian, Kevin wrote: > > > > > No. You are right on this case. I don't think there is a way to > > > differentiate one mdev from the other if they come from the > > > same parent and attached by the same guest process. In this > > > case the fault could be reported on either mdev (e.g. the first > > > matching one) to get it fixed in the guest. > > > > If the IOMMU can't distinguish the two mdevs they are not isolated > > and would have to share a group. Since group sharing is not supported > > today this seems like a non-issue > > Does this mean we have to prevent 2 mdev's from same pdev being assigned to > the same guest? No, it means that the IOMMU layer has to be able to distinguish them. This either means they are "SW mdevs" which does not involve the IOMMU layer and puts both the responsibility for isolation and idenfication on the mdev driver. Or they are some "PASID mdev" which does allow the IOMMU to isolate them. What can't happen is to comingle /dev/iommu control over the pdev between two mdevs. ie we can't talk about faults for IOMMU on SW mdevs - faults do not come from the IOMMU layer, they have to come from inside the mdev it self, somehow. Jason