Christoph Egger
2008-Jun-10 14:09 UTC
[Xen-devel] [PATCH][TOOLS] libxc: mmap fixes for BSD
Hi! On BSD, mmap()ing files works on on-disk files but not on pseudo filesystems like kernfs or procfs. Therefore, attached patch mmap()s anonymous memory. Linux equivalents are sysfs and procfs to above BSD''s pseudo-filesystems. On Linux, mmap is implemented for sysfs but it is questionable to me how write operations work since (most) files in sysfs have static content. So this patch may fix some problems with a Linux Dom0, too. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Jun-10 14:21 UTC
Re: [Xen-devel] [PATCH][TOOLS] libxc: mmap fixes for BSD
On 10/6/08 15:09, "Christoph Egger" <Christoph.Egger@amd.com> wrote:> On BSD, mmap()ing files works on on-disk files but not on > pseudo filesystems like kernfs or procfs. > Therefore, attached patch mmap()s anonymous memory. > > Linux equivalents are sysfs and procfs to above BSD''s pseudo-filesystems. > On Linux, mmap is implemented for sysfs but it is questionable to me > how write operations work since (most) files in sysfs have > static content. So this patch may fix some problems > with a Linux Dom0, too.We can hide special setup in mmap(/proc/xen/privcmd) that is necessary for later foreign mapping operations. Perhaps xc_map_foreign_ranges() interface could be changed so that it does the mmap(), then fills in the .va field in the array of entries that it is passed, and finally return the address it got from mmap()? This would make xc_map_foreign_ranges() similar to our other xc_map*() functions, which all hide the mmap() invocation inside their implementation. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christoph Egger
2008-Jun-10 14:37 UTC
Re: [Xen-devel] [PATCH][TOOLS] libxc: mmap fixes for BSD
On Tuesday 10 June 2008 16:21:56 Keir Fraser wrote:> On 10/6/08 15:09, "Christoph Egger" <Christoph.Egger@amd.com> wrote: > > On BSD, mmap()ing files works on on-disk files but not on > > pseudo filesystems like kernfs or procfs. > > Therefore, attached patch mmap()s anonymous memory. > > > > Linux equivalents are sysfs and procfs to above BSD''s pseudo-filesystems. > > On Linux, mmap is implemented for sysfs but it is questionable to me > > how write operations work since (most) files in sysfs have > > static content. So this patch may fix some problems > > with a Linux Dom0, too. > > We can hide special setup in mmap(/proc/xen/privcmd) that is necessary for > later foreign mapping operations. Perhaps xc_map_foreign_ranges() interface > could be changed so that it does the mmap(), then fills in the .va field in > the array of entries that it is passed, and finally return the address it > got from mmap()? > > This would make xc_map_foreign_ranges() similar to our other xc_map*() > functions, which all hide the mmap() invocation inside their > implementation.That''s fine with me. Christoph -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christoph Egger
2008-Jul-23 15:11 UTC
Re: [Xen-devel] [PATCH][TOOLS] libxc: mmap fixes for BSD
On Tuesday 10 June 2008 16:21:56 Keir Fraser wrote:> On 10/6/08 15:09, "Christoph Egger" <Christoph.Egger@amd.com> wrote: > > On BSD, mmap()ing files works on on-disk files but not on > > pseudo filesystems like kernfs or procfs. > > Therefore, attached patch mmap()s anonymous memory. > > > > Linux equivalents are sysfs and procfs to above BSD''s pseudo-filesystems. > > On Linux, mmap is implemented for sysfs but it is questionable to me > > how write operations work since (most) files in sysfs have > > static content. So this patch may fix some problems > > with a Linux Dom0, too. > > We can hide special setup in mmap(/proc/xen/privcmd) that is necessary for > later foreign mapping operations. Perhaps xc_map_foreign_ranges() interface > could be changed so that it does the mmap(), then fills in the .va field in > the array of entries that it is passed, and finally return the address it > got from mmap()? > > This would make xc_map_foreign_ranges() similar to our other xc_map*() > functions, which all hide the mmap() invocation inside their > implementation. > > -- KeirHere is the patch. This also cleans up and fixes memory leaks in the error path. Christoph -- AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel