* [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
@ 2014-04-28 22:27 suravee.suthikulpanit-5C7GfCeVMHo
2014-05-06 18:14 ` Joerg Roedel
[not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
0 siblings, 2 replies; 5+ messages in thread
From: suravee.suthikulpanit-5C7GfCeVMHo @ 2014-04-28 22:27 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
joro-zLv9SwRftAIdnm+yROfE0A
Cc: jay.cornwall-5C7GfCeVMHo, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kim.naru-5C7GfCeVMHo
From: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>
get_user_pages requires caller to hold a read lock on mmap_sem.
Signed-off-by: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
---
drivers/iommu/amd_iommu_v2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 5208828..203b2e6 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -504,8 +504,10 @@ static void do_fault(struct work_struct *work)
write = !!(fault->flags & PPR_FAULT_WRITE);
+ down_read(&fault->state->mm->mmap_sem);
npages = get_user_pages(fault->state->task, fault->state->mm,
fault->address, 1, write, 0, &page, NULL);
+ up_read(&fault->state->mm->mmap_sem);
if (npages == 1) {
put_page(page);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
2014-04-28 22:27 [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages suravee.suthikulpanit-5C7GfCeVMHo
@ 2014-05-06 18:14 ` Joerg Roedel
2014-05-06 19:11 ` Suravee Suthikulanit
[not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2014-05-06 18:14 UTC (permalink / raw)
To: suravee.suthikulpanit; +Cc: iommu, linux-kernel, kim.naru, jay.cornwall
On Mon, Apr 28, 2014 at 05:27:46PM -0500, Suthikulpanit, Suravee wrote:
> From: Jay Cornwall <jay.cornwall@amd.com>
>
> get_user_pages requires caller to hold a read lock on mmap_sem.
Right, but can't we just switch to get_user_pages_fast instead?
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
2014-05-06 18:14 ` Joerg Roedel
@ 2014-05-06 19:11 ` Suravee Suthikulanit
2014-05-06 19:27 ` Suravee Suthikulanit
0 siblings, 1 reply; 5+ messages in thread
From: Suravee Suthikulanit @ 2014-05-06 19:11 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel, kim.naru, jay.cornwall
On 5/6/2014 1:14 PM, Joerg Roedel wrote:
> On Mon, Apr 28, 2014 at 05:27:46PM -0500, Suthikulpanit, Suravee wrote:
>> From: Jay Cornwall <jay.cornwall@amd.com>
>>
>> get_user_pages requires caller to hold a read lock on mmap_sem.
>
> Right, but can't we just switch to get_user_pages_fast instead?
>
>
> Joerg
>
You're right. I think it can. Let me spin out another patch.
Suravee
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
2014-05-06 19:11 ` Suravee Suthikulanit
@ 2014-05-06 19:27 ` Suravee Suthikulanit
0 siblings, 0 replies; 5+ messages in thread
From: Suravee Suthikulanit @ 2014-05-06 19:27 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel, kim.naru, jay.cornwall
On 5/6/2014 2:11 PM, Suravee Suthikulanit wrote:
> On 5/6/2014 1:14 PM, Joerg Roedel wrote:
>> On Mon, Apr 28, 2014 at 05:27:46PM -0500, Suthikulpanit, Suravee wrote:
>>> From: Jay Cornwall <jay.cornwall@amd.com>
>>>
>>> get_user_pages requires caller to hold a read lock on mmap_sem.
>>
>> Right, but can't we just switch to get_user_pages_fast instead?
>>
>>
>> Joerg
>>
>
> You're right. I think it can. Let me spin out another patch.
>
> Suravee
>
Actually, we would have to provide the pointer to task_struct for the
corresponding PASID which is not necessary "current". So I take it
back. I don't think we can use _fast.
Suravee
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
[not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
@ 2014-05-12 19:04 ` Joerg Roedel
0 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2014-05-12 19:04 UTC (permalink / raw)
To: suravee.suthikulpanit-5C7GfCeVMHo
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jay.cornwall-5C7GfCeVMHo, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kim.naru-5C7GfCeVMHo
On Mon, Apr 28, 2014 at 05:27:46PM -0500, suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org wrote:
> From: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>
>
> get_user_pages requires caller to hold a read lock on mmap_sem.
>
> Signed-off-by: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
Applied, thanks Jay and Suravee.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-12 19:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 22:27 [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages suravee.suthikulpanit-5C7GfCeVMHo
2014-05-06 18:14 ` Joerg Roedel
2014-05-06 19:11 ` Suravee Suthikulanit
2014-05-06 19:27 ` Suravee Suthikulanit
[not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
2014-05-12 19:04 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).