public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Hollis Blanchard <hollisb@us.ibm.com>,
	Alexandre Oliva <aoliva@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [PATCH] Add memory clobber to hypercalls (v2)
Date: Sat, 28 Jun 2008 06:43:04 +0300	[thread overview]
Message-ID: <4865B348.1050207@qumranet.com> (raw)
In-Reply-To: <1214504729-16880-1-git-send-email-aliguori@us.ibm.com>

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.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  parent reply	other threads:[~2008-06-28  3:43 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 [this message]
2008-06-30 14:54   ` Hollis Blanchard
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=4865B348.1050207@qumranet.com \
    --to=avi@qumranet.com \
    --cc=aliguori@us.ibm.com \
    --cc=aoliva@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=hollisb@us.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