WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] mmap in PV xen-4.0.1

To: Eric Camachat <eric.camachat@xxxxxxxxx>
Subject: Re: [Xen-devel] mmap in PV xen-4.0.1
From: Ranjith Ravi <ranjith.ravi@xxxxxxxxx>
Date: Mon, 15 Aug 2011 20:13:37 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Wei Liu <liuw@xxxxxxxxx>
Delivery-date: Mon, 15 Aug 2011 20:14:35 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=uUGrweB8+dGjZy4csVVXJxRJOTl8IYGzqiHpibfjkmU=; b=rErGtd2/vDTmyjVy2FJh+6RIyAGV5sZEPt5LU5OTL9vCJ+WAh9+L/STEBp230kqf7A gpGZXC+2FR9eLPQRSvkHxs3IG/4jn/+nLJ8iGeclraKTobYzE1g7Utx1U1RMN6auOGTU Aj69h3VGRHknpj/DMLms3MTqycr3o+gqkTI8E=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CACeEFf69kcwe4mg1LH3iDzcmLPjCDgK83-5eFRW7Ccbi1p9zww@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CACeEFf77eOLLNgsJwEYdzeiuxm+qDcO2zs09FK-Waas0sxcwLQ@xxxxxxxxxxxxxx> <CACeEFf5yDb3dh+M3nycmYMaW5Vf+6C57QXZjXEBQZhrwkTHkHg@xxxxxxxxxxxxxx> <20110810091256.GA1537@limbo> <CACeEFf6HoD10k5PUP7gNBNteyY=Wh3XTJCOZEmvs+Us+WfahNw@xxxxxxxxxxxxxx> <20110810192546.GA2875@xxxxxxxxxxxx> <CACeEFf5B08guZ2XNKGcuUSP-W=NiqMHxT3o0ghi5ky7QJOeRKg@xxxxxxxxxxxxxx> <20110811013104.GB1889@limbo> <CACeEFf72bXGhgb=O9U-eavV7yqBNAepx_EZ+Lp5nPFa7KK_zeQ@xxxxxxxxxxxxxx> <CACeEFf7X1cCwPxDfaCGuUGF0qTnrBO_jnMa_UNd_Ni2=AosAoA@xxxxxxxxxxxxxx> <20110812042608.GA2760@limbo> <CACeEFf69kcwe4mg1LH3iDzcmLPjCDgK83-5eFRW7Ccbi1p9zww@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

> Looking into the kernel source, a check in range_is_allowed failed so
> I just can't map /dev/mem with specified range (-EPERM).

 mmap() and read access  works on 2.6.37.6 
( dom0 - fc13 xen 4.0.2)
Tried it after disabling 'CONFIG_STRICT_DEVMEM' in kernel config.

Can someone point out the changes/patches in 2.6.37.6 which fixes mmap() problem ?

Thanks
Ranjith


On Fri, Aug 12, 2011 at 10:20 AM, Eric Camachat <eric.camachat@xxxxxxxxx> wrote:
On Thu, Aug 11, 2011 at 9:26 PM, Wei Liu <liuw@xxxxxxxxx> wrote:
> On Thu, Aug 11, 2011 at 10:11:20AM -0700, Eric Camachat wrote:
>>
>> Let us back to my original concern:
>> Why remap_pfn_range() woks with my own device node, but deesn't work
>> with /dev/mem node?
>> This behavior is confused me.
>>
>> /Eric
>
> Well, I slightly modify your code -- remove the ioctl and hardcoded
> *base into mapper, and run on my box in dom0 (Xen 4.2 + 2.6.39 PVOPS),
> I get following output and kernel log:
>
> paddr = 0x6d368000
>  mem = 0xffffffffffffffff
>  map = 0x7fa928e88000
> map[0]= 1234
> map[1]= abcd
>
> [  405.039120] memtest: registering /dev/memtest (886)
> [  405.039125] memtest: size of phys_addr_t is 8 bytes
> [  405.039132] memtest: _vbase = 0xffff88006d368000
> [  405.039134] memtest: _pbase = 0x6d368000
> [  405.039135] memtest: _mbase = 0x6fbaa000
> [  781.414747] Program mapper tried to access /dev/mem between 6d368000->6d36c000.
> [  781.414764] memtest_vma_open: virt 0x7f327a275000, phys 0x6d368000
> [  781.414942] mapper[2744]: segfault at ffffffffffffffff ip 00000000004008d7 sp 00007fff233638e0 error 4 in mapper[400000+1000]
> [  781.415064] memtest_vma_close
> [  891.350796] Program mapper tried to access /dev/mem between 6d368000->6d36c000.
> [  891.350813] memtest_vma_open: virt 0x7fa928e88000, phys 0x6d368000
> [  891.350987] mapper[2811]: segfault at ffffffffffffffff ip 00000000004008d7 sp 00007fffc154efd0 error 4 in mapper[400000+1000]
> [  891.351102] memtest_vma_close
>
> Looking into the kernel source, a check in range_is_allowed failed so
> I just can't map /dev/mem with specified range (-EPERM).
>
> But please note that my output of map[0] and map[1] are correct, while
> your output is not correct ('4C4C4C4C'), which you ignored

That's I memset() 'L' to _vbase. Sorry, I pasted wrong output.

> previously. Why not make sure your mapper works correctly? Or can you
> try newer kernel and Xen?
>
> Wei.
>

It works with newer kernel (like 2.6.37), so I think its not XEN's problem.
Thanks for your help!

/Eric

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel