public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
To: Yisheng Xie <xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Mark Rutland <Mark.Rutland-5wv7dgnIgG8@public.gmane.org>,
	"ilias.apalodimas-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<ilias.apalodimas-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"xuzaibo-hv44wF8Li93QT0dZR+AlfA@public.gmane.org"
	<xuzaibo-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
	"okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org"
	<okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"bharatku-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org"
	<bharatku-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	"linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
	"rfranz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org"
	<rfranz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	"lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org"
	<bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org"
	<dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	rjw-LthD3rsA81gHJAlzAAQw8A@public.gmane.org
Subject: Re: [PATCH 37/37] vfio: Add support for Shared Virtual Addressing
Date: Wed, 21 Mar 2018 13:40:13 +0000	[thread overview]
Message-ID: <09ecbaf4-477c-1a06-4f37-523391e5b92e@arm.com> (raw)
In-Reply-To: <e3ae1693-0ed8-65e1-352a-07f79038dcbd-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

On 19/03/18 09:47, Yisheng Xie wrote:
> Hi Jean,
> 
> vfio can be compiled as module, however you use some functions which are not
> exported.

Oh right. I remember the kbuild test robot warning about this once, I
wonder why it didn't find this one.

> comment inline:
> 
> [...]
>> Add two new ioctl for VFIO containers. VFIO_IOMMU_BIND_PROCESS creates a
>> bond between a container and a process address space, identified by a
>> device-specific ID named PASID. This allows the device to target DMA
>> transactions at the process virtual addresses without a need for mapping
>> and unmapping buffers explicitly in the IOMMU. The process page tables are
>> shared with the IOMMU, and mechanisms such as PCI ATS/PRI are used to
>> handle faults. VFIO_IOMMU_UNBIND_PROCESS removes a bond created with
>> VFIO_IOMMU_BIND_PROCESS.
>>
>> Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
>> ---
> [...]
>> +static struct mm_struct *vfio_iommu_get_mm_by_vpid(pid_t vpid)
>> +{
>> +	struct mm_struct *mm;
>> +	struct task_struct *task;
>> +
>> +	rcu_read_lock();
>> +	task = find_task_by_vpid(vpid);
> 
> Maybe can use?
> 	task = pid_task(find_vpid(params.vpid), PIDTYPE_PID)

I'd rather submit a patch requesting to export the symbol. Especially
since this function can be further simplified by using the brand new
find_get_task_by_vpid() helper, introduced by 2ee0826085d1.

>> +	if (task)
>> +		get_task_struct(task);
>> +	rcu_read_unlock();
>> +	if (!task)
>> +		return ERR_PTR(-ESRCH);
>> +
>> +	/* Ensure that current has RW access on the mm */
>> +	mm = mm_access(task, PTRACE_MODE_ATTACH_REALCREDS);
> 
> You will try to export mm_access, I find Felix have tried to, but seems give up:
> 
>  https://patchwork.kernel.org/patch/9744281/

Thanks for the pointer, I'll try to revive this.

Thanks,
Jean

  parent reply	other threads:[~2018-03-21 13:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1519280641-30258-1-git-send-email-xieyisheng1@huawei.com>
     [not found] ` <1519280641-30258-3-git-send-email-xieyisheng1@huawei.com>
     [not found]   ` <1519280641-30258-3-git-send-email-xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-02-22  9:03     ` [PATCH 03/37] iommu/sva: Manage process address spaces Yisheng Xie
     [not found]       ` <63e4b545-c6e5-f4b4-3ba1-cf7a142b64ec-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-02-22 13:17         ` Jean-Philippe Brucker
     [not found] ` <1519280641-30258-37-git-send-email-xieyisheng1@huawei.com>
     [not found]   ` <1519280641-30258-37-git-send-email-xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-03-19  9:47     ` [PATCH 37/37] vfio: Add support for Shared Virtual Addressing Yisheng Xie
     [not found]       ` <e3ae1693-0ed8-65e1-352a-07f79038dcbd-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-03-21 13:40         ` Jean-Philippe Brucker [this message]
     [not found] ` <1519280641-30258-27-git-send-email-xieyisheng1@huawei.com>
     [not found]   ` <1519280641-30258-27-git-send-email-xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-03-19 11:03     ` [PATCH 27/37] iommu/arm-smmu-v3: Register fault workqueue Yisheng Xie
     [not found]       ` <f2841aac-4c5e-4ac2-fa4d-81d6b2857503-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-03-21 13:24         ` Jean-Philippe Brucker
     [not found]           ` <cabd71fd-c54c-c21a-a5b7-227e69fa4286-5wv7dgnIgG8@public.gmane.org>
2018-03-22  1:09             ` Yisheng Xie
     [not found]               ` <c4f0a441-e975-395a-fc38-3686db21227d-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-04-04 10:13                 ` Jean-Philippe Brucker
2018-02-12 18:33 [PATCH 00/37] Shared Virtual Addressing for the IOMMU Jean-Philippe Brucker
2018-02-12 18:33 ` [PATCH 37/37] vfio: Add support for Shared Virtual Addressing Jean-Philippe Brucker
     [not found]   ` <20180212183352.22730-38-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-02-16 19:33     ` Alex Williamson
     [not found]       ` <20180216123329.10f6dc23-DGNDKt5SQtizQB+pC5nmwQ@public.gmane.org>
2018-02-20 11:26         ` Jean-Philippe Brucker
2018-02-28  1:26     ` Sinan Kaya
     [not found]       ` <1e76c66c-952e-71bd-d831-d3a1ded9559c-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-02-28 16:25         ` Jean-Philippe Brucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09ecbaf4-477c-1a06-4f37-523391e5b92e@arm.com \
    --to=jean-philippe.brucker-5wv7dgnigg8@public.gmane.org \
    --cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
    --cc=ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=bharatku-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=ilias.apalodimas-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=rfranz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=rjw-LthD3rsA81gHJAlzAAQw8A@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=xuzaibo-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox