On 25 Jun 2014, at 17:50, Michael S. Tsirkin <m...@redhat.com> wrote:
> On Wed, Jun 25, 2014 at 03:46:04PM +0000, Damjan Marion (damarion) wrote: >> >> On 25 Jun 2014, at 17:29, Michael S. Tsirkin <m...@redhat.com> wrote: >> >>> On Wed, Jun 25, 2014 at 02:57:52PM +0000, Damjan Marion (damarion) wrote: >>>> >>>> On 25 Jun 2014, at 16:27, Michael S. Tsirkin <m...@redhat.com> wrote: >>>> >>>>> On Wed, Jun 25, 2014 at 02:20:56PM +0000, Damjan Marion (damarion) wrote: >>>>>> >>>>>> On 25 Jun 2014, at 16:13, Nikolay Nikolaev >>>>>> <n.nikol...@virtualopensystems.com> wrote: >>>>>> >>>>>>>>> - it will require changes on the user side also >>>>>>>> >>>>>>>> why would it? >>>>>>>> format seems unchanged, right? >>>>>>> >>>>>>> yes, but it will happen that multiple regions have same FD so call to >>>>>>> mmap() >>>>>>> should look different, I’m still playing with this on user side... >>>>>>> but then you shoudl somehow accumulate the sizes and send just a single >>>>>>> fd, something along these lines. >>>>>> >>>>>> Yes, so I’m not very happy with that approach and looking if there is >>>>>> better proposal, >>>>>> or at least wider agreement how to address this issue. >>>>>> >>>>>> Damjan >>>>> >>>>> still not sure what the issue is ... >>>>> >>>> >>>> No issue, just additional logic is needed on user side to calculate total >>>> size of shared regions and call mmap() once per FD. >>>> >>>> Agree? >>> >>> why not just call it multiple times? AFAIK linux handles this just fine. >> >> I need to specify size when calling mmap(), so i need to run trough all >> regions and sum sizes before calling mmap(). > > You can map same file in many places. > Just call mmap many times with offsets. agree, but in that case I need to know offset, which i need to calculate by finding 1st region in the list. I.e. My regions are: nregions: 4 region: gpa = 0x100000000 size = 3221225472 ua = 0x2aab6ac00000 region: gpa = 0xFFFC0000 size = 262144 ua = 0x7fc13d200000 region: gpa = 0x0 size = 655360 ua = 0x2aaaaac00000 region: gpa = 0xC0000 size = 3220439040 ua = 0x2aaaaacc0000 So, to calculate offset for 1st region I need to find region with GPA 0x0 which is region 3. Offset for region 1 is 0x2aab6ac00000 - 0x2aaaaac00000 = 0xC0000000. BTW Any idea what to do with region 2, it doesn’t look like the one belonging to the same place, but qemu_get_ram_fd() returns same FD for it.