public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <JGross@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen: fix ring resize of /dev/evtchn
Date: Wed, 4 May 2016 16:34:48 +0100	[thread overview]
Message-ID: <572A1698.2010907@citrix.com> (raw)
In-Reply-To: <5729F984.4040807@citrix.com>

On 04/05/16 14:30, David Vrabel wrote:
> On 04/05/16 14:02, Jan Beulich wrote:
>> The copying of ring data was wrong for two cases: For a full ring
>> nothing got copied at all (as in that case the canonicalized producer
>> and consumer indexes are identical). And in case one or both of the
>> canonicalized (after the resize) indexes would point into the second
>> half of the buffer, the copied data ended up in the wrong (free) part
>> of the new buffer. In both cases uninitialized data would get passed
>> back to the caller.
>>
>> Fix this by simply copying the old ring contents twice: Once to the
>> low half of the new buffer, and a second time to the high half.
>>
>> This addresses the inability to boot a HVM guest with 64 or more
>> vCPU-s, which was reported by Konrad Rzeszutek Wilk
>> <konrad.wilk@oracle.com>.
> [...]
> 
> Can you include the commit that introduced this regression and which
> kernel versions it affects as this is a stable candidate.
> 
>> @@ -344,22 +343,13 @@ static int evtchn_resize_ring(struct per
>>  	spin_lock_irq(&u->ring_prod_lock);
>>  
>>  	/*
>> -	 * Copy the old ring contents to the new ring.
>> -	 *
>> -	 * If the ring contents crosses the end of the current ring,
>> -	 * it needs to be copied in two chunks.
>> -	 *
>> -	 * +---------+    +------------------+
>> -	 * |34567  12| -> |       1234567    |
>> -	 * +-----p-c-+    +------------------+
>> +	 * Copy the old ring contents to the new ring. To take care of
>> +	 * wrapping, a full ring, and the new canonicalized index pointing
>> +	 * into the second half, simply copy the old contents twice.
> 
> Could you keep the ascii art?
> 
> e.g.,
> 
>  * +---------+    +------------------+
>  * |34567  12| -> |34567  1234567  12|
>  * +-----p-c-+    +-------c------p---+
> 
> So it is obvious that the double copy does the right thing.

Never mind, I wanted to send a pull request so I've fixed this up myself.

David

  reply	other threads:[~2016-05-04 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 13:02 [PATCH] xen: fix ring resize of /dev/evtchn Jan Beulich
2016-05-04 13:30 ` [Xen-devel] " David Vrabel
2016-05-04 15:34   ` David Vrabel [this message]
2016-05-04 15:42     ` Jan Beulich

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=572A1698.2010907@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=JGross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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