Displaying 20 results from an estimated 23 matches for "write_address".
2010 Nov 29
1
[PATCH] vhost: correctly set bits of dirty pages
When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE,
and also make log_write() can correctly process the request across
pages with write_address not start at page boundary.
Signed-off-by: Jason Wang <jasowang at redhat.com>
---
drivers/vhost/vhost.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a29d91c..576300b 100644
--- a/drivers/vho...
2010 Nov 29
1
[PATCH] vhost: correctly set bits of dirty pages
When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE,
and also make log_write() can correctly process the request across
pages with write_address not start at page boundary.
Signed-off-by: Jason Wang <jasowang at redhat.com>
---
drivers/vhost/vhost.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a29d91c..576300b 100644
--- a/drivers/vho...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...arch_futex_atomic_op_inuser(FUTEX_OP_ADD, 1 << nr, &old, addr);
+ /* TODO: fallback to kmap() when -ENOSYS? */
+
set_page_dirty_lock(page);
put_page(page);
- return 0;
+ return r;
}
-static int log_write(void __user *log_base,
+static int log_write(u32 __user *log_base,
u64 write_address, u64 write_length)
{
u64 write_page = write_address / VHOST_PAGE_SIZE;
@@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base,
return 0;
write_length += write_address % VHOST_PAGE_SIZE;
for (;;) {
- u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...arch_futex_atomic_op_inuser(FUTEX_OP_ADD, 1 << nr, &old, addr);
+ /* TODO: fallback to kmap() when -ENOSYS? */
+
set_page_dirty_lock(page);
put_page(page);
- return 0;
+ return r;
}
-static int log_write(void __user *log_base,
+static int log_write(u32 __user *log_base,
u64 write_address, u64 write_length)
{
u64 write_page = write_address / VHOST_PAGE_SIZE;
@@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base,
return 0;
write_length += write_address % VHOST_PAGE_SIZE;
for (;;) {
- u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;...
2019 May 09
0
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...e road a variant that does not need tricks like this is
still nice to have.
> set_page_dirty_lock(page);
> put_page(page);
> - return 0;
> + return r;
> }
>
> -static int log_write(void __user *log_base,
> +static int log_write(u32 __user *log_base,
> u64 write_address, u64 write_length)
> {
> u64 write_page = write_address / VHOST_PAGE_SIZE;
> @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base,
> return 0;
> write_length += write_address % VHOST_PAGE_SIZE;
> for (;;) {
> - u64 base = (u64)(unsigned long)log_base;
&...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...et me post a V3.
Thanks
>
>
>> set_page_dirty_lock(page);
>> put_page(page);
>> - return 0;
>> + return r;
>> }
>>
>> -static int log_write(void __user *log_base,
>> +static int log_write(u32 __user *log_base,
>> u64 write_address, u64 write_length)
>> {
>> u64 write_page = write_address / VHOST_PAGE_SIZE;
>> @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base,
>> return 0;
>> write_length += write_address % VHOST_PAGE_SIZE;
>> for (;;) {
>> - u64 base...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...et me post a V3.
Thanks
>
>
>> set_page_dirty_lock(page);
>> put_page(page);
>> - return 0;
>> + return r;
>> }
>>
>> -static int log_write(void __user *log_base,
>> +static int log_write(u32 __user *log_base,
>> u64 write_address, u64 write_length)
>> {
>> u64 write_page = write_address / VHOST_PAGE_SIZE;
>> @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base,
>> return 0;
>> write_length += write_address % VHOST_PAGE_SIZE;
>> for (;;) {
>> - u64 base...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...if (r)
+ goto err;
+ mutex_unlock(&vhost_log_lock);
+ }
return 0;
+err:
+ mutex_unlock(&vhost_log_lock);
+ return r;
}
static int log_write(void __user *log_base,
@@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base,
if (!write_length)
return 0;
write_length += write_address % VHOST_PAGE_SIZE;
+ log_base = (void __user *)((u64)log_base & ~0x3ULL);
+ write_page += ((u64)log_base & 0x3ULL) * 8;
for (;;) {
- u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;
- int bit = write_page % 8;
- if ((u64)(unsigned long)log != log)
- return...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...if (r)
+ goto err;
+ mutex_unlock(&vhost_log_lock);
+ }
return 0;
+err:
+ mutex_unlock(&vhost_log_lock);
+ return r;
}
static int log_write(void __user *log_base,
@@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base,
if (!write_length)
return 0;
write_length += write_address % VHOST_PAGE_SIZE;
+ log_base = (void __user *)((u64)log_base & ~0x3ULL);
+ write_page += ((u64)log_base & 0x3ULL) * 8;
for (;;) {
- u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;
- int bit = write_page % 8;
- if ((u64)(unsigned long)log != log)
- return...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...inatomic(&old_log, addr, 0, 0);
+ if (r < 0)
+ return r;
+
+ old_log |= 1 << nr;
+ r = put_user(old_log, addr);
+ if (r < 0)
+ return r;
+
set_page_dirty_lock(page);
put_page(page);
return 0;
@@ -1727,8 +1730,8 @@ static int log_write(void __user *log_base,
write_length += write_address % VHOST_PAGE_SIZE;
for (;;) {
u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;
- int bit = write_page % 8;
+ u64 log = base + write_page / 32;
+ int bit = write_page % 32;
if ((u64)(unsigned long)log != log)
return -EFAULT;
r = set_bit_to_user(bit, (voi...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...inatomic(&old_log, addr, 0, 0);
+ if (r < 0)
+ return r;
+
+ old_log |= 1 << nr;
+ r = put_user(old_log, addr);
+ if (r < 0)
+ return r;
+
set_page_dirty_lock(page);
put_page(page);
return 0;
@@ -1727,8 +1730,8 @@ static int log_write(void __user *log_base,
write_length += write_address % VHOST_PAGE_SIZE;
for (;;) {
u64 base = (u64)(unsigned long)log_base;
- u64 log = base + write_page / 8;
- int bit = write_page % 8;
+ u64 log = base + write_page / 32;
+ int bit = write_page % 32;
if ((u64)(unsigned long)log != log)
return -EFAULT;
r = set_bit_to_user(bit, (voi...
2019 May 08
0
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...instead.
> +
> + old_log |= 1 << nr;
> + r = put_user(old_log, addr);
> + if (r < 0)
> + return r;
> +
> set_page_dirty_lock(page);
> put_page(page);
> return 0;
> @@ -1727,8 +1730,8 @@ static int log_write(void __user *log_base,
> write_length += write_address % VHOST_PAGE_SIZE;
> for (;;) {
> u64 base = (u64)(unsigned long)log_base;
> - u64 log = base + write_page / 8;
> - int bit = write_page % 8;
> + u64 log = base + write_page / 32;
> + int bit = write_page % 32;
> if ((u64)(unsigned long)log != log)
> return -...
2009 Nov 02
1
[PATCHv6 3/3] vhost_net: a kernel-level virtio server
...* 8;
+ int r;
+ r = get_user_pages_fast(log, 1, 1, &page);
+ if (r)
+ return r;
+ base = kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USERO);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /= VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base = (u64)log_base;
+ u64 log = base + write_address / 8;
+ int bit = write_address % 8;
+ if ((u64)(unsigned long)log != log)
+ return -EFAULT;
+ r = set_bit_to_user(bit...
2009 Nov 02
1
[PATCHv6 3/3] vhost_net: a kernel-level virtio server
...* 8;
+ int r;
+ r = get_user_pages_fast(log, 1, 1, &page);
+ if (r)
+ return r;
+ base = kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USERO);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /= VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base = (u64)log_base;
+ u64 log = base + write_address / 8;
+ int bit = write_address % 8;
+ if ((u64)(unsigned long)log != log)
+ return -EFAULT;
+ r = set_bit_to_user(bit...
2019 May 14
0
[PATCH net] vhost: don't use kmap() to log dirty pages
...ct.
> return 0;
> +err:
> + mutex_unlock(&vhost_log_lock);
> + return r;
> }
>
> static int log_write(void __user *log_base,
> @@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base,
> if (!write_length)
> return 0;
> write_length += write_address % VHOST_PAGE_SIZE;
> + log_base = (void __user *)((u64)log_base & ~0x3ULL);
> + write_page += ((u64)log_base & 0x3ULL) * 8;
> for (;;) {
> - u64 base = (u64)(unsigned long)log_base;
> - u64 log = base + write_page / 8;
> - int bit = write_page % 8;
> - if ((u64)(u...
2009 Nov 09
3
[PATCHv9 3/3] vhost_net: a kernel-level virtio server
...* 8;
+ int r;
+ r = get_user_pages_fast(log, 1, 1, &page);
+ if (r)
+ return r;
+ base = kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USER0);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /= VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base = (u64)(unsigned long)log_base;
+ u64 log = base + write_address / 8;
+ int bit = write_address % 8;
+ if ((u64)(unsigned long)log != log)
+ return -EFAULT;
+ r = set_...
2009 Nov 09
3
[PATCHv9 3/3] vhost_net: a kernel-level virtio server
...* 8;
+ int r;
+ r = get_user_pages_fast(log, 1, 1, &page);
+ if (r)
+ return r;
+ base = kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USER0);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /= VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base = (u64)(unsigned long)log_base;
+ u64 log = base + write_address / 8;
+ int bit = write_address % 8;
+ if ((u64)(unsigned long)log != log)
+ return -EFAULT;
+ r = set_...
2009 Nov 17
0
No subject
...if (r)
+ return r;
+ base =3D kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USER0);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /=3D VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base =3D (u64)(unsigned long)log_base;
+ u64 log =3D base + write_address / 8;
+ int bit =3D write...
2009 Nov 17
0
No subject
...if (r)
+ return r;
+ base =3D kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USER0);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /=3D VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base =3D (u64)(unsigned long)log_base;
+ u64 log =3D base + write_address / 8;
+ int bit =3D write...
2009 Nov 04
1
[PATCHv8 3/3] vhost_net: a kernel-level virtio server
...* 8;
+ int r;
+ r = get_user_pages_fast(log, 1, 1, &page);
+ if (r)
+ return r;
+ base = kmap_atomic(page, KM_USER0);
+ set_bit(bit, base);
+ kunmap_atomic(base, KM_USER0);
+ set_page_dirty_lock(page);
+ put_page(page);
+ return 0;
+}
+
+static int log_write(void __user *log_base,
+ u64 write_address, u64 write_length)
+{
+ int r;
+ if (!write_length)
+ return 0;
+ write_address /= VHOST_PAGE_SIZE;
+ for (;;) {
+ u64 base = (u64)(unsigned long)log_base;
+ u64 log = base + write_address / 8;
+ int bit = write_address % 8;
+ if ((u64)(unsigned long)log != log)
+ return -EFAULT;
+ r = set_...