Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
On Mon, Apr 28, 2014 at 05:27:46PM -0500, suravee.suthikulpa...@amd.com wrote: > From: Jay Cornwall > > get_user_pages requires caller to hold a read lock on mmap_sem. > > Signed-off-by: Jay Cornwall > Signed-off-by: Suravee Suthikulpanit Applied, thanks Jay and Suravee. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
On Mon, Apr 28, 2014 at 05:27:46PM -0500, suravee.suthikulpa...@amd.com wrote: From: Jay Cornwall jay.cornw...@amd.com get_user_pages requires caller to hold a read lock on mmap_sem. Signed-off-by: Jay Cornwall jay.cornw...@amd.com Signed-off-by: Suravee Suthikulpanit suravee.suthikulpa...@amd.com Applied, thanks Jay and Suravee. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
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 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
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 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
On Mon, Apr 28, 2014 at 05:27:46PM -0500, Suthikulpanit, Suravee wrote: > From: Jay Cornwall > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
On Mon, Apr 28, 2014 at 05:27:46PM -0500, Suthikulpanit, Suravee wrote: From: Jay Cornwall jay.cornw...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
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.cornw...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
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.cornw...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
From: Jay Cornwall get_user_pages requires caller to hold a read lock on mmap_sem. Signed-off-by: Jay Cornwall Signed-off-by: Suravee Suthikulpanit --- 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(>state->mm->mmap_sem); npages = get_user_pages(fault->state->task, fault->state->mm, fault->address, 1, write, 0, , NULL); + up_read(>state->mm->mmap_sem); if (npages == 1) { put_page(page); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
From: Jay Cornwall jay.cornw...@amd.com get_user_pages requires caller to hold a read lock on mmap_sem. Signed-off-by: Jay Cornwall jay.cornw...@amd.com Signed-off-by: Suravee Suthikulpanit suravee.suthikulpa...@amd.com --- 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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/