* [PATCH] ia64/err-inject: Use get_user_pages_fast()
@ 2018-01-22 17:21 ` Davidlohr Bueso
0 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-01-22 17:21 UTC (permalink / raw)
To: tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, dave, Davidlohr Bueso
At the point of sysfs callback, the call to gup is
done without mmap_sem (or any lock for that matter).
This is racy. As such, use the get_user_pages_fast()
alternative and safely avoid taking the lock, if possible.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
arch/ia64/kernel/err_inject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 85bba43e7d5d..658a8e06a69b 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
u64 virt_addr=simple_strtoull(buf, NULL, 16);
int ret;
- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
if (ret<=0) {
#ifdef ERR_INJ_DEBUG
printk("Virtual address %lx is not existing.\n",virt_addr);
--
2.13.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ia64/err-inject: Use get_user_pages_fast()
@ 2018-01-22 17:21 ` Davidlohr Bueso
0 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-01-22 17:21 UTC (permalink / raw)
To: tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, dave, Davidlohr Bueso
At the point of sysfs callback, the call to gup is
done without mmap_sem (or any lock for that matter).
This is racy. As such, use the get_user_pages_fast()
alternative and safely avoid taking the lock, if possible.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
arch/ia64/kernel/err_inject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 85bba43e7d5d..658a8e06a69b 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
u64 virt_addr=simple_strtoull(buf, NULL, 16);
int ret;
- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
if (ret<=0) {
#ifdef ERR_INJ_DEBUG
printk("Virtual address %lx is not existing.\n",virt_addr);
--
2.13.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ia64/err-inject: Use get_user_pages_fast()
2018-01-22 17:21 ` Davidlohr Bueso
@ 2018-02-13 22:22 ` Davidlohr Bueso
-1 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-02-13 22:22 UTC (permalink / raw)
To: tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, Davidlohr Bueso
ping
On Mon, 22 Jan 2018, Davidlohr Bueso wrote:
>At the point of sysfs callback, the call to gup is
>done without mmap_sem (or any lock for that matter).
>This is racy. As such, use the get_user_pages_fast()
>alternative and safely avoid taking the lock, if possible.
>
>Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
>---
> arch/ia64/kernel/err_inject.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
>index 85bba43e7d5d..658a8e06a69b 100644
>--- a/arch/ia64/kernel/err_inject.c
>+++ b/arch/ia64/kernel/err_inject.c
>@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
> u64 virt_addr=simple_strtoull(buf, NULL, 16);
> int ret;
>
>- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
>+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
> if (ret<=0) {
> #ifdef ERR_INJ_DEBUG
> printk("Virtual address %lx is not existing.\n",virt_addr);
>--
>2.13.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ia64/err-inject: Use get_user_pages_fast()
@ 2018-02-13 22:22 ` Davidlohr Bueso
0 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-02-13 22:22 UTC (permalink / raw)
To: tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, Davidlohr Bueso
ping
On Mon, 22 Jan 2018, Davidlohr Bueso wrote:
>At the point of sysfs callback, the call to gup is
>done without mmap_sem (or any lock for that matter).
>This is racy. As such, use the get_user_pages_fast()
>alternative and safely avoid taking the lock, if possible.
>
>Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
>---
> arch/ia64/kernel/err_inject.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
>index 85bba43e7d5d..658a8e06a69b 100644
>--- a/arch/ia64/kernel/err_inject.c
>+++ b/arch/ia64/kernel/err_inject.c
>@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
> u64 virt_addr=simple_strtoull(buf, NULL, 16);
> int ret;
>
>- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
>+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
> if (ret<=0) {
> #ifdef ERR_INJ_DEBUG
> printk("Virtual address %lx is not existing.\n",virt_addr);
>--
>2.13.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ia64/err-inject: Use get_user_pages_fast()
2018-01-22 17:21 ` Davidlohr Bueso
@ 2018-02-27 17:16 ` Davidlohr Bueso
-1 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-02-27 17:16 UTC (permalink / raw)
To: akpm, tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, Davidlohr Bueso
Andrew, if you're ok with the patch below, could it be routed
your way?
Thanks,
Davidlohr
On Mon, 22 Jan 2018, Davidlohr Bueso wrote:
>At the point of sysfs callback, the call to gup is
>done without mmap_sem (or any lock for that matter).
>This is racy. As such, use the get_user_pages_fast()
>alternative and safely avoid taking the lock, if possible.
>
>Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
>---
> arch/ia64/kernel/err_inject.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
>index 85bba43e7d5d..658a8e06a69b 100644
>--- a/arch/ia64/kernel/err_inject.c
>+++ b/arch/ia64/kernel/err_inject.c
>@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
> u64 virt_addr=simple_strtoull(buf, NULL, 16);
> int ret;
>
>- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
>+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
> if (ret<=0) {
> #ifdef ERR_INJ_DEBUG
> printk("Virtual address %lx is not existing.\n",virt_addr);
>--
>2.13.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ia64/err-inject: Use get_user_pages_fast()
@ 2018-02-27 17:16 ` Davidlohr Bueso
0 siblings, 0 replies; 6+ messages in thread
From: Davidlohr Bueso @ 2018-02-27 17:16 UTC (permalink / raw)
To: akpm, tony.luck, fenghua.yu; +Cc: linux-ia64, linux-kernel, Davidlohr Bueso
Andrew, if you're ok with the patch below, could it be routed
your way?
Thanks,
Davidlohr
On Mon, 22 Jan 2018, Davidlohr Bueso wrote:
>At the point of sysfs callback, the call to gup is
>done without mmap_sem (or any lock for that matter).
>This is racy. As such, use the get_user_pages_fast()
>alternative and safely avoid taking the lock, if possible.
>
>Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
>---
> arch/ia64/kernel/err_inject.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
>index 85bba43e7d5d..658a8e06a69b 100644
>--- a/arch/ia64/kernel/err_inject.c
>+++ b/arch/ia64/kernel/err_inject.c
>@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
> u64 virt_addr=simple_strtoull(buf, NULL, 16);
> int ret;
>
>- ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
>+ ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
> if (ret<=0) {
> #ifdef ERR_INJ_DEBUG
> printk("Virtual address %lx is not existing.\n",virt_addr);
>--
>2.13.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-27 17:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 17:21 [PATCH] ia64/err-inject: Use get_user_pages_fast() Davidlohr Bueso
2018-01-22 17:21 ` Davidlohr Bueso
2018-02-13 22:22 ` Davidlohr Bueso
2018-02-13 22:22 ` Davidlohr Bueso
2018-02-27 17:16 ` Davidlohr Bueso
2018-02-27 17:16 ` Davidlohr Bueso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.