Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp453584ybb; Fri, 3 Apr 2020 06:03:04 -0700 (PDT) X-Google-Smtp-Source: APiQypLNJ9cWkGUdxuKDbcA6yTUqVGWN6vvWQGYERriU4kxhjhOeLKtLPb7+ijcKNo77Rkjg9PBv X-Received: by 2002:aca:5c44:: with SMTP id q65mr2872124oib.139.1585918984226; Fri, 03 Apr 2020 06:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585918984; cv=none; d=google.com; s=arc-20160816; b=bq3QU7LKJDj+MbOWC47w7zGjJi+54MOHm7i3L88M0tTqQcTSdsSYNISKL290NOq6Hk AAnF8sNKQmH0lJRxlS5htT0QVCxH5dLUR5NrQ6F0E2GOIPOwaZZ3lls2oDlkexwt+VGH KbfFlt0r3pbpzQJtunR7q3bo/5wksK9js43mzkwnX3AWroC+gCjdDSVTwTP8lmAkPBSC EDexA5n/W3QMQ+ISi7EKrHmr/MK6szu09QCxOYWmwpynoywob53NTBqELFdSKg+q4c/e QnOS2VL0tul0sJIEzuE4wIyzk05Z0nIg+q75KITuL4voeiSoll0B6S3e6Jk3N4Ru4Gmp jRCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=KOO4xnXqJLJMXs00N2unazI5K7kUzZa6eBlrKn/xe+s=; b=oWLdzURv/KWDRxa6oOGvSDq0b7fD8igRIp2Bg0dirDa1Vp0ClEImeQuJpNhI3Dea1M EpR5jOHlASZnIVtPtg9FzpwgzI79CGK/O3cVanR8sBwJ21W6F5IxQ7quRGda4I1NfgoD H5Ox1yHQ1p7XS3qbGoEvC8lMqJ586WV2Ac+Fy3WWRzonFypnxJvKooocXLDPTIH99j7s faJ86ivkYV31p6FT+wtAt6xW/a8QVs45QgHD5AZgpTsMgwLS5OU5SGA+DdPU5V310/i4 /THzRbOTeyPKMFEOTle6eS7bMbagATMGyvyYlYW9EgJ0d6/s4pOun00j9fV9tG7off6w anJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si3451083oim.179.2020.04.03.06.02.42; Fri, 03 Apr 2020 06:03:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390826AbgDCMo5 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 3 Apr 2020 08:44:57 -0400 Received: from mga11.intel.com ([192.55.52.93]:34643 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727965AbgDCMo4 (ORCPT ); Fri, 3 Apr 2020 08:44:56 -0400 IronPort-SDR: RLPhhYI1UXHqWbFud3UOcrlUK/ErWkiqrAU2MJWpezrRXqLlxO2X1SvUlVJrXSwOtEVvgPqr1s ImQS9V1DdSzA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2020 05:44:56 -0700 IronPort-SDR: FIByPhSWdOnN913/D0S6XqXWgpwqP9R8Y5o3SECqUjmkpTTNF6mFEYXqyZxYOkHQre5oHzJlEz TAdvK2BZqRGA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,339,1580803200"; d="scan'208";a="241115423" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 03 Apr 2020 05:44:56 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 05:44:55 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 05:44:55 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.225]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Fri, 3 Apr 2020 20:44:51 +0800 From: "Liu, Yi L" To: Jean-Philippe Brucker CC: "alex.williamson@redhat.com" , "eric.auger@redhat.com" , "Tian, Kevin" , "jacob.jun.pan@linux.intel.com" , "joro@8bytes.org" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "peterx@redhat.com" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Wu, Hao" Subject: RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) Thread-Topic: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) Thread-Index: AQHWAEUbC4GB74LMekup8jIcF6WIFqhlZUwAgAH1tzD//4hGgIAAhuqA Date: Fri, 3 Apr 2020 12:44:51 +0000 Message-ID: References: <1584880325-10561-1-git-send-email-yi.l.liu@intel.com> <1584880325-10561-2-git-send-email-yi.l.liu@intel.com> <20200402135240.GE1176452@myrica> <20200403123951.GA1410438@myrica> In-Reply-To: <20200403123951.GA1410438@myrica> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Jean-Philippe Brucker > Sent: Friday, April 3, 2020 8:40 PM > Subject: Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > On Fri, Apr 03, 2020 at 11:56:09AM +0000, Liu, Yi L wrote: > > > > /** > > > > + * VFIO_MM objects - create, release, get, put, search > > > > + * Caller of the function should have held vfio.vfio_mm_lock. > > > > + */ > > > > +static struct vfio_mm *vfio_create_mm(struct mm_struct *mm) { > > > > + struct vfio_mm *vmm; > > > > + struct vfio_mm_token *token; > > > > + int ret = 0; > > > > + > > > > + vmm = kzalloc(sizeof(*vmm), GFP_KERNEL); > > > > + if (!vmm) > > > > + return ERR_PTR(-ENOMEM); > > > > + > > > > + /* Per mm IOASID set used for quota control and group operations */ > > > > + ret = ioasid_alloc_set((struct ioasid_set *) mm, > > > > > > Hmm, either we need to change the token of ioasid_alloc_set() to > > > "void *", or pass an actual ioasid_set struct, but this cast doesn't > > > look good :) > > > > > > As I commented on the IOASID series, I think we could embed a struct > > > ioasid_set into vfio_mm, pass that struct to all other ioasid_* > > > functions, and get rid of ioasid_sid. > > > > I think change to "void *" is better as we needs the token to ensure > > all threads within a single VM share the same ioasid_set. > > Don't they share the same vfio_mm? that's right. then both works well for me. Regards, Yi Liu