All of lore.kernel.org
 help / color / mirror / Atom feed
* Problem with MMAP on Xen kernel
@ 2015-01-16 18:24 Dugger, Donald D
  2015-01-16 18:44 ` David Vrabel
  0 siblings, 1 reply; 6+ messages in thread
From: Dugger, Donald D @ 2015-01-16 18:24 UTC (permalink / raw)
  To: xen-devel; +Cc: Ronciak, John, Szwed, Maciej


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

One of our engineers, Maciek, is working on a driver and stumbled upon what looks like a bug in the Xen kernel.  The report I got was:

We recently started to provide mmap functionality in our driver for Linux. Function for this:

int
NalMmap(
    struct file*                            File,
    struct vm_area_struct*  Vma
    )
{
    if(remap_pfn_range(Vma,
        Vma->vm_start,
        Vma->vm_pgoff,
        Vma->vm_end - Vma->vm_start,
        Vma->vm_page_prot))
    {
        return -EAGAIN;
    }

    return 0;
}

We discovered that this doesn't work for xen kernels (but it doesn't return any error, just does not map). I found that it is suggested to use io_remap_pfn_range instead of remap_pfn_range. After switching function everything still works on standard kernel, but on xen this time it returns error.

--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
Ph: 303/443-3786


[-- Attachment #1.2: Type: text/html, Size: 4967 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Problem with MMAP on Xen kernel
  2015-01-16 18:24 Problem with MMAP on Xen kernel Dugger, Donald D
@ 2015-01-16 18:44 ` David Vrabel
  2015-01-20 13:49   ` Szwed, Maciej
  2015-01-21 14:38   ` Szwed, Maciej
  0 siblings, 2 replies; 6+ messages in thread
From: David Vrabel @ 2015-01-16 18:44 UTC (permalink / raw)
  To: Dugger, Donald D, xen-devel; +Cc: Ronciak, John, Szwed, Maciej

On 16/01/15 18:24, Dugger, Donald D wrote:
> One of our engineers, Maciek, is working on a driver and stumbled upon
> what looks like a bug in the Xen kernel.  The report I got was:
> 
>  
> 
> We recently started to provide mmap functionality in our driver for
> Linux. Function for this:
> 
>  
> 
> /int/
> 
> /NalMmap(/
> 
> /    struct file*                            File,/
> 
> /    struct vm_area_struct*  Vma/
> 
> /    )/
> 
> /{/
> 
> /    if(remap_pfn_range(Vma,/
> 
> /        Vma->vm_start,/
> 
> /        Vma->vm_pgoff,/
> 
> /        Vma->vm_end - Vma->vm_start,/
> 
> /        Vma->vm_page_prot))/
> 
> /    {/
> 
> /        return -EAGAIN;/
> 
> /    }/
> 
> / /
> 
> /    return 0;/
> 
> /}/
> 
>  
> 
> We discovered that this doesn’t work for xen kernels (but it doesn’t
> return any error, just does not map). I found that it is suggested to
> use io_remap_pfn_range instead of remap_pfn_range. After switching
> function everything still works on standard kernel, but on xen this time
> it returns error.

Not a lot to go on here.  What kernel version?  What PFNs are you trying
to map (RAM? MMIO?)  What error do you get?

Can you provide a minimal driver that shows the problem?

David

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

* Re: Problem with MMAP on Xen kernel
  2015-01-16 18:44 ` David Vrabel
@ 2015-01-20 13:49   ` Szwed, Maciej
  2015-01-21 14:38   ` Szwed, Maciej
  1 sibling, 0 replies; 6+ messages in thread
From: Szwed, Maciej @ 2015-01-20 13:49 UTC (permalink / raw)
  To: David Vrabel, Dugger, Donald D, xen-devel; +Cc: Ronciak, John

Hi,
Sorry for late response. I will provide required information tomorrow. 

Regards,
Maciej

-----Original Message-----
From: David Vrabel [mailto:david.vrabel@citrix.com] 
Sent: Friday, January 16, 2015 7:45 PM
To: Dugger, Donald D; xen-devel@lists.xen.org
Cc: Ronciak, John; Szwed, Maciej
Subject: Re: [Xen-devel] Problem with MMAP on Xen kernel

On 16/01/15 18:24, Dugger, Donald D wrote:
> One of our engineers, Maciek, is working on a driver and stumbled upon 
> what looks like a bug in the Xen kernel.  The report I got was:
> 
>  
> 
> We recently started to provide mmap functionality in our driver for 
> Linux. Function for this:
> 
>  
> 
> /int/
> 
> /NalMmap(/
> 
> /    struct file*                            File,/
> 
> /    struct vm_area_struct*  Vma/
> 
> /    )/
> 
> /{/
> 
> /    if(remap_pfn_range(Vma,/
> 
> /        Vma->vm_start,/
> 
> /        Vma->vm_pgoff,/
> 
> /        Vma->vm_end - Vma->vm_start,/
> 
> /        Vma->vm_page_prot))/
> 
> /    {/
> 
> /        return -EAGAIN;/
> 
> /    }/
> 
> / /
> 
> /    return 0;/
> 
> /}/
> 
>  
> 
> We discovered that this doesn't work for xen kernels (but it doesn't 
> return any error, just does not map). I found that it is suggested to 
> use io_remap_pfn_range instead of remap_pfn_range. After switching 
> function everything still works on standard kernel, but on xen this 
> time it returns error.

Not a lot to go on here.  What kernel version?  What PFNs are you trying to map (RAM? MMIO?)  What error do you get?

Can you provide a minimal driver that shows the problem?

David
--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

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

* Re: Problem with MMAP on Xen kernel
  2015-01-16 18:44 ` David Vrabel
  2015-01-20 13:49   ` Szwed, Maciej
@ 2015-01-21 14:38   ` Szwed, Maciej
  2015-01-21 14:44     ` David Vrabel
  1 sibling, 1 reply; 6+ messages in thread
From: Szwed, Maciej @ 2015-01-21 14:38 UTC (permalink / raw)
  To: David Vrabel, Dugger, Donald D, xen-devel; +Cc: Ronciak, John

Hi again,
Error that I'm getting is:
EBUSY           16      /* Device or resource busy */

Kernel version is: 
Linux XXX 3.12.28-2-xen #1 SMP Mon Sep 8 11:15:37 UTC 2014 (aff039d) x86_64 x86_64 x86_64 GNU/Linux

I'm trying to map the memory of NIC with our own driver.

Regards,
Maciej

-----Original Message-----
From: Szwed, Maciej 
Sent: Tuesday, January 20, 2015 2:49 PM
To: David Vrabel; Dugger, Donald D; xen-devel@lists.xen.org
Cc: Ronciak, John
Subject: RE: [Xen-devel] Problem with MMAP on Xen kernel

Hi,
Sorry for late response. I will provide required information tomorrow. 

Regards,
Maciej

-----Original Message-----
From: David Vrabel [mailto:david.vrabel@citrix.com]
Sent: Friday, January 16, 2015 7:45 PM
To: Dugger, Donald D; xen-devel@lists.xen.org
Cc: Ronciak, John; Szwed, Maciej
Subject: Re: [Xen-devel] Problem with MMAP on Xen kernel

On 16/01/15 18:24, Dugger, Donald D wrote:
> One of our engineers, Maciek, is working on a driver and stumbled upon 
> what looks like a bug in the Xen kernel.  The report I got was:
> 
>  
> 
> We recently started to provide mmap functionality in our driver for 
> Linux. Function for this:
> 
>  
> 
> /int/
> 
> /NalMmap(/
> 
> /    struct file*                            File,/
> 
> /    struct vm_area_struct*  Vma/
> 
> /    )/
> 
> /{/
> 
> /    if(remap_pfn_range(Vma,/
> 
> /        Vma->vm_start,/
> 
> /        Vma->vm_pgoff,/
> 
> /        Vma->vm_end - Vma->vm_start,/
> 
> /        Vma->vm_page_prot))/
> 
> /    {/
> 
> /        return -EAGAIN;/
> 
> /    }/
> 
> / /
> 
> /    return 0;/
> 
> /}/
> 
>  
> 
> We discovered that this doesn't work for xen kernels (but it doesn't 
> return any error, just does not map). I found that it is suggested to 
> use io_remap_pfn_range instead of remap_pfn_range. After switching 
> function everything still works on standard kernel, but on xen this 
> time it returns error.

Not a lot to go on here.  What kernel version?  What PFNs are you trying to map (RAM? MMIO?)  What error do you get?

Can you provide a minimal driver that shows the problem?

David
--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

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

* Re: Problem with MMAP on Xen kernel
  2015-01-21 14:38   ` Szwed, Maciej
@ 2015-01-21 14:44     ` David Vrabel
  2015-01-21 14:54       ` David Vrabel
  0 siblings, 1 reply; 6+ messages in thread
From: David Vrabel @ 2015-01-21 14:44 UTC (permalink / raw)
  To: Szwed, Maciej, Dugger, Donald D, xen-devel; +Cc: Ronciak, John

On 21/01/15 14:38, Szwed, Maciej wrote:
> Hi again,
> Error that I'm getting is:
> EBUSY           16      /* Device or resource busy */
> 
> Kernel version is: 
> Linux XXX 3.12.28-2-xen #1 SMP Mon Sep 8 11:15:37 UTC 2014 (aff039d) x86_64 x86_64 x86_64 GNU/Linux
> 
> I'm trying to map the memory of NIC with our own driver.

If the MMIO BARs you are trying to map are above the end of RAM you need
at least 3.16 for this to work.

Specifically you need "x86/xen: set regions above the end of RAM as 1:1"
(25b884a83d4) and its prerequisites (at least: "x86/xen: compactly store
large identity ranges in the p2m" (3cb83e46d032) but probably others).

David

> -----Original Message-----
> From: Szwed, Maciej 
> Sent: Tuesday, January 20, 2015 2:49 PM
> To: David Vrabel; Dugger, Donald D; xen-devel@lists.xen.org
> Cc: Ronciak, John
> Subject: RE: [Xen-devel] Problem with MMAP on Xen kernel
> 
> Hi,
> Sorry for late response. I will provide required information tomorrow. 
> 
> Regards,
> Maciej
> 
> -----Original Message-----
> From: David Vrabel [mailto:david.vrabel@citrix.com]
> Sent: Friday, January 16, 2015 7:45 PM
> To: Dugger, Donald D; xen-devel@lists.xen.org
> Cc: Ronciak, John; Szwed, Maciej
> Subject: Re: [Xen-devel] Problem with MMAP on Xen kernel
> 
> On 16/01/15 18:24, Dugger, Donald D wrote:
>> One of our engineers, Maciek, is working on a driver and stumbled upon 
>> what looks like a bug in the Xen kernel.  The report I got was:
>>
>>  
>>
>> We recently started to provide mmap functionality in our driver for 
>> Linux. Function for this:
>>
>>  
>>
>> /int/
>>
>> /NalMmap(/
>>
>> /    struct file*                            File,/
>>
>> /    struct vm_area_struct*  Vma/
>>
>> /    )/
>>
>> /{/
>>
>> /    if(remap_pfn_range(Vma,/
>>
>> /        Vma->vm_start,/
>>
>> /        Vma->vm_pgoff,/
>>
>> /        Vma->vm_end - Vma->vm_start,/
>>
>> /        Vma->vm_page_prot))/
>>
>> /    {/
>>
>> /        return -EAGAIN;/
>>
>> /    }/
>>
>> / /
>>
>> /    return 0;/
>>
>> /}/
>>
>>  
>>
>> We discovered that this doesn't work for xen kernels (but it doesn't 
>> return any error, just does not map). I found that it is suggested to 
>> use io_remap_pfn_range instead of remap_pfn_range. After switching 
>> function everything still works on standard kernel, but on xen this 
>> time it returns error.
> 
> Not a lot to go on here.  What kernel version?  What PFNs are you trying to map (RAM? MMIO?)  What error do you get?
> 
> Can you provide a minimal driver that shows the problem?
> 
> David

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

* Re: Problem with MMAP on Xen kernel
  2015-01-21 14:44     ` David Vrabel
@ 2015-01-21 14:54       ` David Vrabel
  0 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2015-01-21 14:54 UTC (permalink / raw)
  To: David Vrabel, Szwed, Maciej, Dugger, Donald D, xen-devel; +Cc: Ronciak, John

On 21/01/15 14:44, David Vrabel wrote:
> On 21/01/15 14:38, Szwed, Maciej wrote:
>> Hi again,
>> Error that I'm getting is:
>> EBUSY           16      /* Device or resource busy */
>>
>> Kernel version is: 
>> Linux XXX 3.12.28-2-xen #1 SMP Mon Sep 8 11:15:37 UTC 2014 (aff039d) x86_64 x86_64 x86_64 GNU/Linux
                      ^^^^
Hmm. Is this a Suse kernel?  You'll need to ask them about it.

David

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

end of thread, other threads:[~2015-01-21 14:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 18:24 Problem with MMAP on Xen kernel Dugger, Donald D
2015-01-16 18:44 ` David Vrabel
2015-01-20 13:49   ` Szwed, Maciej
2015-01-21 14:38   ` Szwed, Maciej
2015-01-21 14:44     ` David Vrabel
2015-01-21 14:54       ` David Vrabel

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.