From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: mmap in PV xen-4.0.1 Date: Fri, 12 Aug 2011 12:26:08 +0800 Message-ID: <20110812042608.GA2760@limbo> References: <20110810091256.GA1537@limbo> <20110810192546.GA2875@dumpdata.com> <20110811013104.GB1889@limbo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Eric Camachat Cc: xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org 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 previously. Why not make sure your mapper works correctly? Or can you try newer kernel and Xen? Wei.