From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754069AbcJZHUB convert rfc822-to-8bit (ORCPT ); Wed, 26 Oct 2016 03:20:01 -0400 Received: from mga04.intel.com ([192.55.52.120]:1414 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751792AbcJZHUA (ORCPT ); Wed, 26 Oct 2016 03:20:00 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,549,1473145200"; d="scan'208";a="23826768" From: "Tian, Kevin" To: Alex Williamson , Kirti Wankhede CC: "pbonzini@redhat.com" , "kraxel@redhat.com" , "cjia@nvidia.com" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "Song, Jike" , "bjsdjshi@linux.vnet.ibm.com" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Thread-Topic: [PATCH v9 04/12] vfio iommu: Add support for mediated devices Thread-Index: AQHSLZ79BmkVI1BjmUO0dBoYd8wwo6C6Vkhg Date: Wed, 26 Oct 2016 07:19:54 +0000 Message-ID: References: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> <1476739332-4911-5-git-send-email-kwankhede@nvidia.com> <20161019150231.19e32b84@t450s.home> <3aee74c1-f984-74e3-502b-18b5e1ea6fc7@nvidia.com> <20161023203216.70b2fde3@t450s.home> In-Reply-To: <20161023203216.70b2fde3@t450s.home> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTRlN2E1YTEtNTg2Ni00MmQzLWJiMGMtMzNhMWJjMDhlZGM3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkowWUFUK1ltQXNTdUlqRFk1NmhzcGh2bTRCaGRkeVpDTDFCRlV4d05PMHM9In0= 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Alex Williamson [mailto:alex.williamson@redhat.com] > Sent: Monday, October 24, 2016 10:32 AM > > > >> -static long vfio_unpin_pages(unsigned long pfn, long npage, > > >> - int prot, bool do_accounting) > > >> +static long __vfio_unpin_pages_remote(struct vfio_iommu *iommu, > > >> + unsigned long pfn, long npage, int prot, > > >> + bool do_accounting) > > > > > > Have you noticed that it's kind of confusing that > > > __vfio_{un}pin_pages_remote() uses current, which does a > > > get_user_pages_fast() while "local" uses a provided task_struct and > > > uses get_user_pages_*remote*()? And also what was effectively local > > > (ie. we're pinning for our own use here) is now "remote" and pinning > > > for a remote, vendor driver consumer, is now "local". It's not very > > > intuitive. > > > I questioned this confusing naming in v8 too... > > > > 'local' in local_domain was suggested to describe the domain for local > > page tracking. Earlier suggestions to have 'mdev' or 'noimmu' in this > > name were discarded. May be we should revisit what the name should be. > > Any suggestion? > > > > For local_domain, to pin pages, flow is: > > > > for local_domain > > |- vfio_pin_pages() > > |- vfio_iommu_type1_pin_pages() > > |- __vfio_pin_page_local() > > |- vaddr_get_pfn(task->mm) > > |- get_user_pages_remote() > > > > __vfio_pin_page_local() --> get_user_pages_remote() > > > In vfio.c we have the concept of an external user, perhaps that could > be continued here. An mdev driver would be an external, or remote > pinning. > I prefer to use remote here. It's aligned with underlying mm operations Thanks Kevin From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzIVJ-0000Hc-BY for qemu-devel@nongnu.org; Wed, 26 Oct 2016 03:20:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzIVE-0002bt-EK for qemu-devel@nongnu.org; Wed, 26 Oct 2016 03:20:05 -0400 Received: from mga02.intel.com ([134.134.136.20]:63445) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzIVE-0002bj-6F for qemu-devel@nongnu.org; Wed, 26 Oct 2016 03:20:00 -0400 From: "Tian, Kevin" Date: Wed, 26 Oct 2016 07:19:54 +0000 Message-ID: References: <1476739332-4911-1-git-send-email-kwankhede@nvidia.com> <1476739332-4911-5-git-send-email-kwankhede@nvidia.com> <20161019150231.19e32b84@t450s.home> <3aee74c1-f984-74e3-502b-18b5e1ea6fc7@nvidia.com> <20161023203216.70b2fde3@t450s.home> In-Reply-To: <20161023203216.70b2fde3@t450s.home> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for mediated devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson , Kirti Wankhede Cc: "pbonzini@redhat.com" , "kraxel@redhat.com" , "cjia@nvidia.com" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "Song, Jike" , "bjsdjshi@linux.vnet.ibm.com" , "linux-kernel@vger.kernel.org" > From: Alex Williamson [mailto:alex.williamson@redhat.com] > Sent: Monday, October 24, 2016 10:32 AM >=20 > > >> -static long vfio_unpin_pages(unsigned long pfn, long npage, > > >> - int prot, bool do_accounting) > > >> +static long __vfio_unpin_pages_remote(struct vfio_iommu *iommu, > > >> + unsigned long pfn, long npage, int prot, > > >> + bool do_accounting) > > > > > > Have you noticed that it's kind of confusing that > > > __vfio_{un}pin_pages_remote() uses current, which does a > > > get_user_pages_fast() while "local" uses a provided task_struct and > > > uses get_user_pages_*remote*()? And also what was effectively local > > > (ie. we're pinning for our own use here) is now "remote" and pinning > > > for a remote, vendor driver consumer, is now "local". It's not very > > > intuitive. > > > I questioned this confusing naming in v8 too... > > > > 'local' in local_domain was suggested to describe the domain for local > > page tracking. Earlier suggestions to have 'mdev' or 'noimmu' in this > > name were discarded. May be we should revisit what the name should be. > > Any suggestion? > > > > For local_domain, to pin pages, flow is: > > > > for local_domain > > |- vfio_pin_pages() > > |- vfio_iommu_type1_pin_pages() > > |- __vfio_pin_page_local() > > |- vaddr_get_pfn(task->mm) > > |- get_user_pages_remote() > > > > __vfio_pin_page_local() --> get_user_pages_remote() >=20 >=20 > In vfio.c we have the concept of an external user, perhaps that could > be continued here. An mdev driver would be an external, or remote > pinning. >=20 I prefer to use remote here. It's aligned with underlying mm operations Thanks Kevin