Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, aliguori@us.ibm.com
Subject: Re: [PATCH 3/9] allow intersecting region to be on the boundary.
Date: Tue, 23 Sep 2008 13:18:26 -0300	[thread overview]
Message-ID: <20080923161826.GB3583@poweredge.glommer> (raw)
In-Reply-To: <48D8C551.6000207@redhat.com>

On Tue, Sep 23, 2008 at 01:30:41PM +0300, Avi Kivity wrote:
> Glauber Costa wrote:
>> On Sat, Sep 20, 2008 at 11:32:48AM -0700, Avi Kivity wrote:
>>   
>>> Glauber Costa wrote:
>>>     
>>>> Signed-off-by: Glauber Costa <glommer@redhat.com>
>>>> ---
>>>>  libkvm/libkvm.c |    4 ++--
>>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
>>>> index e768e44..fa65c30 100644
>>>> --- a/libkvm/libkvm.c
>>>> +++ b/libkvm/libkvm.c
>>>> @@ -130,8 +130,8 @@ int get_intersecting_slot(unsigned long phys_addr)
>>>>  	int i;
>>>>   	for (i = 0; i < KVM_MAX_NUM_MEM_REGIONS ; ++i)
>>>> -		if (slots[i].len && slots[i].phys_addr < phys_addr &&
>>>> -		    (slots[i].phys_addr + slots[i].len) > phys_addr)
>>>> +		if (slots[i].len && slots[i].phys_addr <= phys_addr &&
>>>> +		    (slots[i].phys_addr + slots[i].len) >= phys_addr)
>>>>  			return i;
>>>>  	return -1;
>>>>         
>>> consider
>>>
>>>  slots[i].phys_addr = 0
>>>  slots[i].len = 1
>>>  phys_addr = 1
>>>
>>> with the new calculation, i (well, not me personally) will be 
>>> considered  an intersecting slot.
>>>
>>> Not that I (me this time) can understand how you can calculate 
>>> interval  intersection without the entire interval.
>>>     
>> would you be fine with checking only the left interval?
>>
>>   
>
> You mean the left edge?  That's what we're doing now.  No checking or  
> complete checking are understandable, but partial checking seems an  
> invitation for something to break.
>
>> But to be honest, look at:
>>
>>     r = kvm_is_containing_region(kvm_context, start_addr, size);
>>     if (r)
>>         return;
>>
>>     [ sip ]
>>
>>     r = kvm_is_intersecting_mem(kvm_context, start_addr);
>>     if (r) {
>>         printf("Ignoring intersecting memory %llx (%lx)\n", start_addr, size);
>>
>> We don't really do anything, which is the same action as the containing region case.
>> So maybe we should just merge the two checks, and do the same thing (nothing) on both?
>>   
>
> Yes.  So long as it's self-consistent, which the current code (before  
> your patches) isn't.
I have an updated version that just gets rid of the check, and it seems to work well.
I'm still thinking about adding sanity checkings to make sure for example, that we never
span two slots, etc. But maybe this can be done later?

>
> Does no one read this code before merging it?!
>
> -- 
> error compiling committee.c: too many arguments to function
>

  reply	other threads:[~2008-09-23 16:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 16:08 [PATCHEY 0/9] Rrrreplace the ol' scurvy memory registration Glauber Costa
2008-09-19 16:08 ` [PATCH 1/9] Don't separate registrations with IO_MEM_ROM set Glauber Costa
2008-09-19 16:08 ` [PATCH 2/9] do not use mem_hole anymore Glauber Costa
2008-09-19 16:08 ` [PATCH 3/9] allow intersecting region to be on the boundary Glauber Costa
2008-09-20 18:32   ` Avi Kivity
2008-09-22 13:48     ` Glauber Costa
2008-09-23 10:30       ` Avi Kivity
2008-09-23 16:18         ` Glauber Costa [this message]
2008-09-19 16:08 ` [PATCH 4/9] substitute is_allocated_mem with more general is_containing_region Glauber Costa
2008-09-20 18:33   ` Avi Kivity
2008-09-22 13:51     ` Glauber Costa
2008-09-23  7:35       ` Avi Kivity
2008-09-23 16:19         ` Glauber Costa
2008-09-19 16:08 ` [PATCH 5/9] add debuging facilities to memory registration at libkvm Glauber Costa
2008-09-20 18:34   ` Avi Kivity
2008-09-22 13:52     ` Glauber Costa
2008-09-19 16:08 ` [PATCH 6/9] unregister memory area depending on their flags Glauber Costa
2008-09-19 16:08 ` [PATCH 7/9] register mmio slots Glauber Costa
2008-09-20 18:38   ` Avi Kivity
2008-09-22 13:55     ` Glauber Costa
2008-09-23  7:31       ` Avi Kivity
2008-09-23 16:48         ` Glauber Costa
2008-09-19 16:08 ` [PATCH 8/9] coalesce mmio regions with an explicit call Glauber Costa
2008-09-20 18:39   ` Avi Kivity
2008-09-22 13:56     ` Glauber Costa
2008-09-23  7:29       ` Avi Kivity
2008-09-23 16:22         ` Glauber Costa
2008-09-24 11:10           ` Avi Kivity
2008-09-24 21:59             ` Glauber Costa
2008-09-25  7:08               ` Avi Kivity
2008-09-25 11:19                 ` Glauber Costa
2009-04-17 14:04   ` Dmitry Eremin-Solenikov
2008-09-19 16:08 ` [PATCH 9/9] move kvm memory registration inside qemu's Glauber Costa
2008-09-19 16:33   ` Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2008-09-12 15:10 [PATCH 0/9] Simplify memory registration Glauber Costa
2008-09-12 15:10 ` [PATCH 3/9] allow intersecting region to be on the boundary Glauber Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080923161826.GB3583@poweredge.glommer \
    --to=glommer@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox