Based on different interfaces used by /dev/mem and /dev/kmem (direct_remap_pfn_range for former, and remap_pfn_range for the latter), could I think that /dev/mem is the interface for dom0 to map machine memory directly, while /dev/kmem is still geared to dom0''s own memory? If yes, then I may understand how Xserver can map VGABIOS and why DOMID_IO is used for /dev/mem... :-) Thanks, Kevin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> Based on different interfaces used by /dev/mem and /dev/kmem > (direct_remap_pfn_range for former, and remap_pfn_range for the > latter), could I think that /dev/mem is the interface for dom0 to map > machine memory directly, while /dev/kmem is still geared to dom0''s > own memory? If yes, then I may understand how Xserver can map > VGABIOS and why DOMID_IO is used for /dev/mem... :-)Yes, that''s about right. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] >Sent: 2007年3月21日 18:08 > >> Based on different interfaces used by /dev/mem and /dev/kmem >> (direct_remap_pfn_range for former, and remap_pfn_range for the >> latter), could I think that /dev/mem is the interface for dom0 to map >> machine memory directly, while /dev/kmem is still geared to dom0''s >> own memory? If yes, then I may understand how Xserver can map >> VGABIOS and why DOMID_IO is used for /dev/mem... :-) > >Yes, that''s about right. > > -- KeirSo how about applications which simply use /dev/mem to map normal domain memory? Seems this breaks compatibility in user level though desired for above Xserver case... Or such case is rare? BTW, I didn''t find code to protect Xen to be mapped in this path, like in get_page_from_l1e(). Could you help pointing out? Thanks, Kevin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 21/3/07 12:35, "Tian, Kevin" <kevin.tian@intel.com> wrote:> So how about applications which simply use /dev/mem to map > normal domain memory? Seems this breaks compatibility > in user level though desired for above Xserver case... Or such > case is rare?This case seems not to occur in practise (no complaints so far and our /dev/mem has had this limitation since day one). This is perhaps not surprising: really not much good can come out of direct grokking of kernel-maintained memory without the kernel''s knowledge.> BTW, I didn''t find code to protect Xen to be mapped in this path, > like in get_page_from_l1e(). Could you help pointing out?Not sure how you mean. Only pages that explicitly are owned by a domain and have a non-zero refcount can have get_page() succeed on them. So random Xen-owned pages are safe. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] >Sent: 2007年3月22日 0:33 > >On 21/3/07 12:35, "Tian, Kevin" <kevin.tian@intel.com> wrote: > >> So how about applications which simply use /dev/mem to map >> normal domain memory? Seems this breaks compatibility >> in user level though desired for above Xserver case... Or such >> case is rare? > >This case seems not to occur in practise (no complaints so far and our >/dev/mem has had this limitation since day one). This is perhaps not >surprising: really not much good can come out of direct grokking of >kernel-maintained memory without the kernel''s knowledge. > >> BTW, I didn''t find code to protect Xen to be mapped in this path, >> like in get_page_from_l1e(). Could you help pointing out? > >Not sure how you mean. Only pages that explicitly are owned by a >domain and >have a non-zero refcount can have get_page() succeed on them. So >random >Xen-owned pages are safe. > > -- KeirI just wanted to know how to prevent dom0 from mapping xen-owned pages. You''re right and I missed the get_page() point here. :-) Thanks, Kevin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> > So how about applications which simply use /dev/mem to map > > normal domain memory? Seems this breaks compatibility > > in user level though desired for above Xserver case... Or such > > case is rare? > > This case seems not to occur in practise (no complaints so far and our > /dev/mem has had this limitation since day one). This is perhaps not > surprising: really not much good can come out of direct grokking of > kernel-maintained memory without the kernel''s knowledge.IIRC the Linux /dev/mem didn''t support mapping "real" memory for ages anyhow (causing a certain amount of confusion to users / developers) so it''s not surprising if nobody out there is using it! It was mainly there to keep X happy. Cheers, Mark> > BTW, I didn''t find code to protect Xen to be mapped in this path, > > like in get_page_from_l1e(). Could you help pointing out? > > Not sure how you mean. Only pages that explicitly are owned by a domain and > have a non-zero refcount can have get_page() succeed on them. So random > Xen-owned pages are safe. > > -- Keir > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel-- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel