linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
@ 2015-11-10 20:10 Boris Ostrovsky
  2015-11-26 17:48 ` [Xen-devel] " David Vrabel
  2016-11-10 16:26 ` Olaf Hering
  0 siblings, 2 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2015-11-10 20:10 UTC (permalink / raw)
  To: konrad.wilk, david.vrabel
  Cc: xen-devel, linux-kernel, boris.ostrovsky, stable

Doing so will cause the grant to be unmapped and then, during
fault handling, the fault to be mistakenly treated as NUMA hint
fault.

In addition, even if those maps could partcipate in NUMA
balancing, it wouldn't provide any benefit since we are unable
to determine physical page's node (even if/when VNUMA is
implemented).

Marking grant maps' VMAs as VM_IO will exclude them from being
part of NUMA balancing.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: stable@vger.kernel.org
---

- Added stable@vger.kernel.org

 drivers/xen/gntdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 67b9163..bf312df 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -802,7 +802,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 
 	vma->vm_ops = &gntdev_vmops;
 
-	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
 
 	if (use_ptemod)
 		vma->vm_flags |= VM_DONTCOPY;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2015-11-10 20:10 [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing Boris Ostrovsky
@ 2015-11-26 17:48 ` David Vrabel
  2016-11-10 16:26 ` Olaf Hering
  1 sibling, 0 replies; 9+ messages in thread
From: David Vrabel @ 2015-11-26 17:48 UTC (permalink / raw)
  To: Boris Ostrovsky, konrad.wilk, david.vrabel
  Cc: linux-kernel, stable, xen-devel

On 10/11/15 20:10, Boris Ostrovsky wrote:
> Doing so will cause the grant to be unmapped and then, during
> fault handling, the fault to be mistakenly treated as NUMA hint
> fault.
> 
> In addition, even if those maps could partcipate in NUMA
> balancing, it wouldn't provide any benefit since we are unable
> to determine physical page's node (even if/when VNUMA is
> implemented).
> 
> Marking grant maps' VMAs as VM_IO will exclude them from being
> part of NUMA balancing.

Applied to for-linus-4.4, thanks.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2015-11-10 20:10 [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing Boris Ostrovsky
  2015-11-26 17:48 ` [Xen-devel] " David Vrabel
@ 2016-11-10 16:26 ` Olaf Hering
  2016-11-10 16:39   ` Boris Ostrovsky
  1 sibling, 1 reply; 9+ messages in thread
From: Olaf Hering @ 2016-11-10 16:26 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: konrad.wilk, david.vrabel, linux-kernel, stable, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

On Tue, Nov 10, Boris Ostrovsky wrote:

> Doing so will cause the grant to be unmapped and then, during
> fault handling, the fault to be mistakenly treated as NUMA hint
> fault.
> 
> In addition, even if those maps could partcipate in NUMA
> balancing, it wouldn't provide any benefit since we are unable
> to determine physical page's node (even if/when VNUMA is
> implemented).
> 
> Marking grant maps' VMAs as VM_IO will exclude them from being
> part of NUMA balancing.

This breaks qdisk+aio because now such pages are rejected with -EFAULT:

check_vma_flags
__get_user_pages
__get_user_pages_locked
__get_user_pages_unlocked
get_user_pages_fast
iov_iter_get_pages
dio_refill_pages
do_direct_IO
do_blockdev_direct_IO
do_blockdev_direct_IO
ext4_direct_IO_read
generic_file_read_iter
aio_run_iocb

domU.cfg:
builder=hvm
disk=['vdev=xvda, direct-io-safe, backendtype=qdisk, target=img.raw']

> @@ -802,7 +802,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
> -	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
> +	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;


Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 16:26 ` Olaf Hering
@ 2016-11-10 16:39   ` Boris Ostrovsky
  2016-11-10 16:42     ` Olaf Hering
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Ostrovsky @ 2016-11-10 16:39 UTC (permalink / raw)
  To: Olaf Hering; +Cc: konrad.wilk, david.vrabel, linux-kernel, stable, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1373 bytes --]

On 11/10/2016 11:26 AM, Olaf Hering wrote:
> On Tue, Nov 10, Boris Ostrovsky wrote:

Perfect timing. This is from Nov. 10 2015.

>
>> Doing so will cause the grant to be unmapped and then, during
>> fault handling, the fault to be mistakenly treated as NUMA hint
>> fault.
>>
>> In addition, even if those maps could partcipate in NUMA
>> balancing, it wouldn't provide any benefit since we are unable
>> to determine physical page's node (even if/when VNUMA is
>> implemented).
>>
>> Marking grant maps' VMAs as VM_IO will exclude them from being
>> part of NUMA balancing.
> This breaks qdisk+aio because now such pages are rejected with -EFAULT:

Is this something new? Because this patch has been there for a year.

-boris

>
> check_vma_flags
> __get_user_pages
> __get_user_pages_locked
> __get_user_pages_unlocked
> get_user_pages_fast
> iov_iter_get_pages
> dio_refill_pages
> do_direct_IO
> do_blockdev_direct_IO
> do_blockdev_direct_IO
> ext4_direct_IO_read
> generic_file_read_iter
> aio_run_iocb
>
> domU.cfg:
> builder=hvm
> disk=['vdev=xvda, direct-io-safe, backendtype=qdisk, target=img.raw']
>
>> @@ -802,7 +802,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
>> -	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
>> +	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
>
> Olaf



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 16:39   ` Boris Ostrovsky
@ 2016-11-10 16:42     ` Olaf Hering
  2016-11-10 17:34       ` Boris Ostrovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Olaf Hering @ 2016-11-10 16:42 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: konrad.wilk, david.vrabel, linux-kernel, stable, xen-devel

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Thu, Nov 10, Boris Ostrovsky wrote:

> Is this something new? Because this patch has been there for a year.

It was just tested now, cycling through all the combinations for a
disk=[]. Removing "direct-is-save" will use different code paths and the
error is not seen.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 16:42     ` Olaf Hering
@ 2016-11-10 17:34       ` Boris Ostrovsky
  2016-11-10 17:47         ` Olaf Hering
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Ostrovsky @ 2016-11-10 17:34 UTC (permalink / raw)
  To: Olaf Hering; +Cc: konrad.wilk, david.vrabel, linux-kernel, stable, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 471 bytes --]

On 11/10/2016 11:42 AM, Olaf Hering wrote:
> On Thu, Nov 10, Boris Ostrovsky wrote:
>
>> Is this something new? Because this patch has been there for a year.
> It was just tested now, cycling through all the combinations for a
> disk=[]. Removing "direct-is-save" will use different code paths and the
> error is not seen.

Are you sure it's this patch that causes the failure?

I commented out '| VM_IO' and still unable to boot with this option.

-boris


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 17:34       ` Boris Ostrovsky
@ 2016-11-10 17:47         ` Olaf Hering
  2016-11-10 17:49           ` David Vrabel
  0 siblings, 1 reply; 9+ messages in thread
From: Olaf Hering @ 2016-11-10 17:47 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: konrad.wilk, david.vrabel, linux-kernel, stable, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On Thu, Nov 10, Boris Ostrovsky wrote:

> Are you sure it's this patch that causes the failure?
> 
> I commented out '| VM_IO' and still unable to boot with this option.

Yes, this works for me, sles12sp2 dom0+domU, which is linux-4.4 based:

+++ b/drivers/xen/gntdev.c
@@ -804,7 +804,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 
        vma->vm_ops = &gntdev_vmops;
 
-       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
+       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP /*| VM_IO*/;
 
        if (use_ptemod)
                vma->vm_flags |= VM_DONTCOPY;

with this domU.cfg:

name="x"
memory=1024
serial="pty"
builder="hvm"
disk=[ 'vdev=xvda, direct-io-safe, backendtype=qdisk, target=x.raw', ]
vif=[ 'bridge=br0' ]
keymap="de"
cmdline="linemode=1 console=ttyS0,115200 ignore_loglevel install=http://host/sles_dvd1/ start_shell"
kernel= "/sles_dvd1/boot/x86_64/vmlinuz-xen"
ramdisk="/sles_dvd1/boot/x86_64/initrd-xen"


Without VM_IO 'fdisk -l /dev/xvda' works, with VM_IO 'fdisk -l
/dev/xvda' gives IO errors.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 17:47         ` Olaf Hering
@ 2016-11-10 17:49           ` David Vrabel
  2016-11-10 18:09             ` Boris Ostrovsky
  0 siblings, 1 reply; 9+ messages in thread
From: David Vrabel @ 2016-11-10 17:49 UTC (permalink / raw)
  To: Olaf Hering, Boris Ostrovsky; +Cc: konrad.wilk, linux-kernel, stable, xen-devel

On 10/11/16 17:47, Olaf Hering wrote:
> On Thu, Nov 10, Boris Ostrovsky wrote:
> 
>> Are you sure it's this patch that causes the failure?
>>
>> I commented out '| VM_IO' and still unable to boot with this option.
> 
> Yes, this works for me, sles12sp2 dom0+domU, which is linux-4.4 based:
> 
> +++ b/drivers/xen/gntdev.c
> @@ -804,7 +804,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
>  
>         vma->vm_ops = &gntdev_vmops;
>  
> -       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
> +       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP /*| VM_IO*/;
>  
>         if (use_ptemod)
>                 vma->vm_flags |= VM_DONTCOPY;

I think we need a custom policy for this VMA with MPOL_F_MOF cleared.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xen-devel] [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-11-10 17:49           ` David Vrabel
@ 2016-11-10 18:09             ` Boris Ostrovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-11-10 18:09 UTC (permalink / raw)
  To: David Vrabel, Olaf Hering; +Cc: konrad.wilk, linux-kernel, stable, xen-devel

On 11/10/2016 12:49 PM, David Vrabel wrote:
> On 10/11/16 17:47, Olaf Hering wrote:
>> On Thu, Nov 10, Boris Ostrovsky wrote:
>>
>>> Are you sure it's this patch that causes the failure?
>>>
>>> I commented out '| VM_IO' and still unable to boot with this option.
>> Yes, this works for me, sles12sp2 dom0+domU, which is linux-4.4 based:

I've never tested on 4.4, this was added for 4.5 (with CC to stable#4.4)
and now I am testing on 4.7)

>>
>> +++ b/drivers/xen/gntdev.c
>> @@ -804,7 +804,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
>>  
>>         vma->vm_ops = &gntdev_vmops;
>>  
>> -       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
>> +       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP /*| VM_IO*/;
>>  
>>         if (use_ptemod)
>>                 vma->vm_flags |= VM_DONTCOPY;
> I think we need a custom policy for this VMA with MPOL_F_MOF cleared.

I think you are right, I remember when I was looking at this adding a
policy was the other option. Let me look at this again.


-boris

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-10 18:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 20:10 [PATCH RESEND] xen/gntdev: Grant maps should not be subject to NUMA balancing Boris Ostrovsky
2015-11-26 17:48 ` [Xen-devel] " David Vrabel
2016-11-10 16:26 ` Olaf Hering
2016-11-10 16:39   ` Boris Ostrovsky
2016-11-10 16:42     ` Olaf Hering
2016-11-10 17:34       ` Boris Ostrovsky
2016-11-10 17:47         ` Olaf Hering
2016-11-10 17:49           ` David Vrabel
2016-11-10 18:09             ` Boris Ostrovsky

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).