public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Alexandre Oliva <aoliva@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [PATCH] Add memory clobber to hypercalls (v2)
Date: Mon, 30 Jun 2008 09:54:20 -0500	[thread overview]
Message-ID: <1214837660.7257.3.camel@localhost.localdomain> (raw)
In-Reply-To: <4865B348.1050207@qumranet.com>

On Sat, 2008-06-28 at 06:43 +0300, Avi Kivity wrote:
> Anthony Liguori wrote:
> > Hypercalls can modify arbitrary regions of memory.  Make sure to indicate this
> > in the clobber list.  This fixes a hang when using KVM_GUEST kernel built with
> > GCC 4.3.0.
> >
> > This was originally spotted and analyzed by Marcelo.
> >
> > Since v1, I've also added a "m" constraint for the inputs to the hypercall.
> > This was suggested by Christian since it's not entirely clear whether a memory
> > clobber will force the data to be in memory before the asm statement.  In the
> > very least, it helps to be more conservative.
> >
> > Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> >
> > @@ -80,7 +81,9 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
> >  	long ret;
> >  	asm volatile(KVM_HYPERCALL
> >  		     : "=a"(ret)
> > -		     : "a"(nr), "b"(p1));
> > +		     : "a"(nr), "b"(p1),
> > +		       "m"(*(char *)p1)
> > +		     : "memory");
> >  	return ret;
> >  }
> >  
> >   
> 
> Those are physical addresses, not virtual, and on i386 the addresses are 
> split across multiple registers.
> 
> However a small test program shows that the memory clobber does work 
> with gcc 4.3, so I'll pick the earlier patch.

What about gcc 4.4? 4.5? 5.0?

-- 
Hollis Blanchard
IBM Linux Technology Center


  reply	other threads:[~2008-06-30 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 18:25 [PATCH] Add memory clobber to hypercalls (v2) Anthony Liguori
2008-06-27 21:05 ` Hollis Blanchard
2008-06-28  3:43 ` Avi Kivity
2008-06-30 14:54   ` Hollis Blanchard [this message]
2008-06-30 15:59     ` Avi Kivity
2008-07-01 19:02       ` Hollis Blanchard

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=1214837660.7257.3.camel@localhost.localdomain \
    --to=hollisb@us.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=aoliva@redhat.com \
    --cc=avi@qumranet.com \
    --cc=borntraeger@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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