From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: Need help with fixing the Xen waitqueue feature Date: Wed, 23 Nov 2011 19:21:46 +0000 Message-ID: References: <20111123183148.GA26869@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20111123183148.GA26869@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Olaf Hering Cc: xen-devel@lists.xensource.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org On 23/11/2011 18:31, "Olaf Hering" wrote: > On Wed, Nov 23, Keir Fraser wrote: > >> We have quite a big waitqueue problem actually. The current scheme of >> per-cpu stacks doesn't work nicely, as the stack pointer will change if a >> vcpu goes to sleep and then wakes up on a different cpu. This really doesn't >> work nicely with preempted C code, which may implement frame pointers and/or >> arbitrarily take the address of on-stack variables. The result will be >> hideous cross-stack corruptions, as these frame pointers and cached >> addresses of automatic variables will reference the wrong cpu's stack! >> Fixing or detecting this in general is not possible afaics. > > Yes, I was thinking about that wakeup on different cpu as well. > As a quick fix/hack, perhaps the scheduler could make sure the vcpu > wakes up on the same cpu? Could save old affinity and then vcpu_set_affinity. That will have to do for now. Actually it should work okay as long as toolstack doesn't mess with affinity meanwhile. I'll sort out a patch for this. -- Keir > Olaf