Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2953861pxj; Sun, 23 May 2021 16:53:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrmGDgZhMvWvnuTu/mW+4F13myjhQxnS3oddWWoeIN7TIttER6ma5qaTfGfJ02ZjsW7B/M X-Received: by 2002:a05:6402:2714:: with SMTP id y20mr22392196edd.348.1621814032208; Sun, 23 May 2021 16:53:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621814032; cv=pass; d=google.com; s=arc-20160816; b=sYb6w6q6N8qf8OpBX0rPMXvs2Yyb5dBWiYTa297AzpO35CCEp2JW6SIhTUOwRF2Qpc Z2lSpcEvqhPlChLVPwWfU46Z/ysXx2J9BInqIiu6mVJwKZWu5fW9n1i+228IIs5FuW5Q 5c6Fw3cCpyiDSS/7H2qHiYMIF4i2dB8xB5NET0/mbp6P1zHGFJ3xYKiUmzF6iI8VpmAD YIz7mWIDbTeSR2xlHA1bInRZREUqJc2sd1TS41PFpMU03iQwpaHRJ39qXWOxV0ElpGH2 Pqhv2GBeraxPIz7t+1PQm2hLaBLYABFkaaq1+MGuyETAdsq89b1yQYy6s/MYzrSNSMTx cmsg== 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=OizVID9a2GgPqO+Nuh1jEJa0shpthBBczexqGXWdaaw=; b=W1nsfRewqm6RPjaLvjqkrAjjbfSzGyBs+89ctF1hpl0jiXtmcxU8bycEkak+H/6bS0 JDfE3N7l3D23G2Lf8FRx71+oYv+iNjDSn3I2E5anv/XbPD3xZ51MCkqQxJ+pVg9PclGw jmgm7uGaVM0Q6laQUjOi4zayECeFQtGSeP9yxwPmr0FCUNVqQkyf5MMmqN4HSJEaz6lT 9AB/DnDtl5q6M3tWUmCAvX/IA7IcBDQO+3W35wiquZDtjHI6cGbTjwtsdXoxvBqV5WDR N3DLXHlW5mKTzAyAr6kgFH+33brXydtylho4Xqw3fVaXExl0nN44Q0h3Z8xRXa5X0WDA NDZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SUrwO+X7; 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=NONE 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 re1si9019567ejb.747.2021.05.23.16.53.29; Sun, 23 May 2021 16:53:52 -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=SUrwO+X7; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232060AbhEWXvy (ORCPT + 99 others); Sun, 23 May 2021 19:51:54 -0400 Received: from mail-bn8nam12on2072.outbound.protection.outlook.com ([40.107.237.72]:28832 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232021AbhEWXvy (ORCPT ); Sun, 23 May 2021 19:51:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fbHEPBzMxxHq1Q5srzdG1TxjqpU/7D/l4hgo5TnPx7+hJyb49Owr8oCHZ63fzC8+P6VWtDWiT273+tdEKRlH4daklTWVOP1LzHiHm/TyMgHeRIFBVe15wCjDb9WBkhauGhUmS868dPD/zIOMowrQBPId/KB1ZDONWmnAgtCaWe2IBS7ErNCQRi/j+KtgUf/H3FzG8n9n4+NwqsdQccaZgEVe/okUDRNl2Ol/jaT1cooCONJnPQRcrxd74N8hDN8YJ/iaDWoAfHWjVHSLBJ2Ff2KvQqqv88yPbYGOQA4zLMvm+Uq0thsCwXtQ5orwwAuri1rPngl6vYXlXFLY4fUO9Q== 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=OizVID9a2GgPqO+Nuh1jEJa0shpthBBczexqGXWdaaw=; b=Xij4ut4ueXn+kHBz7abhjaLKtq0KbBrqZoQhOBJEslThAZ9YBfTym1TSc7oh716Qzo5GRPM+RtH4JikjFE1Zw2yfZ8nmwlLsC4U0Xxn8SfYGVQa7u8v+xlP4aDy8zzGHWFd/MJt8EtbvW7JBQq9gbgSCajzhhIkWKXue2dZ/Tp/iEMG4bp6K8CmMNXS13XZIRlIXJQjlPvJhmxCEyW6lKDvoB+pFrGT8I+85CoTgpPpg9iOHeaaFvlGLjdhp5uhZY5kt9dD0JUVhHAn0vLrIM7LXlhx878JZ4yYuL+bhOnIdXT6KVPy+i+7lEkjbU5Dwy5JySYAWbYoCOapSh+fg7g== 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=OizVID9a2GgPqO+Nuh1jEJa0shpthBBczexqGXWdaaw=; b=SUrwO+X7RYJlrK8AB8Mz3/g8MLMeD8Ti4bDJZJBHvAV9XIISo5dKycZ+Iq8j5tMNivtIxoDYra0BfxfKRrb1O3s5ifkHz/8DTNyRQyMmJlz4UzXGBJA1IsfYODzsqCRFC7HWT9aqIDD203GzWlr0JQlJC8jq53aJ4y44Fe7MCsU0ZSPnUFspzILIP8Gcmr3VPgRFDhfGRkz3iTRi8RfTUAI6UTopu+VdRYD5FzDkd9UCjIMyjIfb7e74hn0zV67w3p6PR+tLL2wVr8NxM+D93aBCQug1LJurGxfPCkQ7v6cK+bG+NF5VtSj4wdCs0StgKlO5gmvzitcVzpB+/5ZY2Q== 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 (52.135.46.150) by BL1PR12MB5063.namprd12.prod.outlook.com (13.101.96.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23; Sun, 23 May 2021 23:50:25 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e%7]) with mapi id 15.20.4150.027; Sun, 23 May 2021 23:50:25 +0000 Date: Sun, 23 May 2021 20:50:23 -0300 From: Jason Gunthorpe To: Dave Jiang Cc: alex.williamson@redhat.com, kwankhede@nvidia.com, tglx@linutronix.de, vkoul@kernel.org, megha.dey@intel.com, jacob.jun.pan@intel.com, ashok.raj@intel.com, yi.l.liu@intel.com, baolu.lu@intel.com, kevin.tian@intel.com, sanjay.k.kumar@intel.com, tony.luck@intel.com, dan.j.williams@intel.com, eric.auger@redhat.com, pbonzini@redhat.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v6 15/20] vfio/mdev: idxd: ims domain setup for the vdcm Message-ID: <20210523235023.GL1002214@nvidia.com> References: <162164243591.261970.3439987543338120797.stgit@djiang5-desk3.ch.intel.com> <162164283796.261970.11020270418798826121.stgit@djiang5-desk3.ch.intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <162164283796.261970.11020270418798826121.stgit@djiang5-desk3.ch.intel.com> X-Originating-IP: [206.223.160.26] X-ClientProxiedBy: YTBPR01CA0027.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:14::40) 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 YTBPR01CA0027.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:14::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27 via Frontend Transport; Sun, 23 May 2021 23:50:25 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lkxrT-00DV1j-OZ; Sun, 23 May 2021 20:50:23 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a3386bf-6e3d-4c10-9615-08d91e45895c X-MS-TrafficTypeDiagnostic: BL1PR12MB5063: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:196; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ph+bLuJYHw9geYEFta/nHRDhnt7kU4WHmYSpwxvouwcfi9i0rKDz2sURBzXvpfXKiwYnWq8p5RoNsb+dl+kE1xrVPNlUQ8fqLkSGlMm0+6UMiYImQya8phUFw/1Z8UHWKcv/e4QJRX2+h6qy9BDvk920kF2mPMNUQlrmYjOTOV5at3TRTF+nAg/c+1Xh39gvgRXMMU7IJnv7LY3YutuMRSQbsul5PNRm/PiRQrAB/8S/z71R/lon9l9TkzOblE4tHw5/nggyvqMbjEZ/SZGl7rm+w1xAbGDuGqVsce6b0B7GiBSXzGDOcBcVUGVeye7EicrHy9vVzE+Vmiuw40L/PM0WlPuRhLDaP2CCyhfauA8xZAOb+P08050r3BJC8z7OQgE/7zaEyfyoy/JNphOzhrTWVGTCILF48HrO6p4VbDL8xQClJqbKo5E/x6jxskTbyVUfp95/5oU7/VWmnz3XBMJeaeP8qipfxCel9E9FEegOxhwBHr3IsGKeqqhCNW6IaFtwpIkhVLqJZCeyFKpsAsktwnmcjpSjcJ9tXDJuGLb8Jrr2YIFVYPiUEekwEBhQuXfIoNVp+xd14MYdgU5bMKLiWSrRBbfi0mcEitv53BI= 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)(366004)(396003)(346002)(39860400002)(376002)(136003)(33656002)(86362001)(2616005)(38100700002)(426003)(8936002)(2906002)(186003)(4326008)(9746002)(9786002)(316002)(6916009)(478600001)(66556008)(66476007)(8676002)(26005)(7416002)(5660300002)(66946007)(83380400001)(1076003)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?KQObtdSaL93AZaqvQPEsF5Vc9PwCAlSoGaExy1b1Tqs4sJUowFoust4Px4xM?= =?us-ascii?Q?a6IBCwQm6uWva4gXlkvLvvlorKijHQ/9fZhQjoQ2dNns+TQqtTGMrrmQY9z6?= =?us-ascii?Q?gWdIR3E+krfuqmlOrxIkDWUhweVH778Owd+1POhlHDM7kG8DcRdaqS3ZOUOa?= =?us-ascii?Q?TU14/Hvy2hV3yzXxKoppXBilEiLzYteeHO61xHw+uRnLrm9oMaGtn6rQWzca?= =?us-ascii?Q?lKx//pi/ZBWrYJUJY0RljN6EC/l5fJHyBErAKHGd3095eeF5EdkqtPtgiZUs?= =?us-ascii?Q?P236l0JpW11/RZ/HiEu8O6F3+7EFEpC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ascii?Q?OWBEJ5l39TvuJzAIM19hthRU+zqq+TBm4+ja/5DOAgfxUdbexEbbZV3Zt1lb?= =?us-ascii?Q?3zZIKh44KHdydbvCa23xZJ2ZTzvWjbt/5JoTx/KF16yJsJpdHWrTa+sRt0X6?= =?us-ascii?Q?3x46NQ9dDGU4IykRv4epuBFp?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3386bf-6e3d-4c10-9615-08d91e45895c X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2021 23:50:25.7182 (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: MiZqSr+nICfnwR30r+WLMtKq1xq+A+uwaf1XchGcJOnqVLjr2RHqfpKc7HLWbO1r X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5063 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 05:20:37PM -0700, Dave Jiang wrote: > @@ -77,8 +80,18 @@ int idxd_mdev_host_init(struct idxd_device *idxd, struct mdev_driver *drv) > return rc; > } > > + ims_info.max_slots = idxd->ims_size; > + ims_info.slots = idxd->reg_base + idxd->ims_offset; > + idxd->ims_domain = pci_ims_array_create_msi_irq_domain(idxd->pdev, &ims_info); > + if (!idxd->ims_domain) { > + dev_warn(dev, "Fail to acquire IMS domain\n"); > + iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_AUX); > + return -ENODEV; > + } I'm quite surprised that every mdev doesn't create its own ims_domain in its probe function. This places a global total limit on the # of vectors which makes me ask what was the point of using IMS in the first place ? The entire idea for IMS was to make the whole allocation system fully dynamic based on demand. > rc = mdev_register_device(dev, drv); > if (rc < 0) { > + irq_domain_remove(idxd->ims_domain); > iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_AUX); > return rc; > } This really wants a goto error unwind Jason