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

[Xen-devel] Changeset 20209 causes an issue in xen_in_range()

To: Keir Fraser <keir.fraser@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: [Xen-devel] Changeset 20209 causes an issue in xen_in_range()
From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Date: Thu, 14 Jan 2010 16:38:08 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 14 Jan 2010 00:38:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcqU9OXR7OdzzS1YRP6U+LDtZCJ8yQ==
Thread-topic: Changeset 20209 causes an issue in xen_in_range()
Currently PERCPU_SIZE is 2 4K-pages and only 1 page is used actually.

>From xen 20209 on, the second unused page is freed and returned to domheap in 
>debug=n build (MEMORY_GUARD is not defined):
percpu_free_unused_areas() -> free_xen_data() -> init_xenheap_pages().
Later the returned pages could be allocated to dom0 and dom0 could use them as 
DMA buffer.

However, in iommu_set_dom0_mapping(), xen_in_range() is still True for the 
freed pages above, so devices in Dom0 can meet with DMA fault.

We may have 2 options:
1) enhance xen_in_range() and check the freed pages. This means we should refer 
to the logic of percpu_free_unused_areas().
2) don't free the unused per_cpu pages: we will waste NR_CPUS pages. e.g., if 
NR_CPUS is 256, we'll waste 1M memory. Looks this is not a big issue?

I personally perfer option 2 as it's simple :-)
And actually long ago we also had frame_table checked in xen_in_range(), but  
gave up the checking later as it's not easy to implement the exact checking.

Any suggestions?

PS,  in percpu_free_unused_areas():
  data_size = (data_size + PAGE_SIZE + 1) & PAGE_MASK;
here "PAGE_SIZE + 1" should be "PAGE_SIZE - 1"?
 
Thanks,
-- Dexuan
 

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