From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754582AbbGCP53 (ORCPT ); Fri, 3 Jul 2015 11:57:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33572 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755640AbbGCP5U (ORCPT ); Fri, 3 Jul 2015 11:57:20 -0400 Date: Fri, 03 Jul 2015 17:57:17 +0200 Message-ID: From: Takashi Iwai To: Paolo Bonzini Cc: Peter Zijlstra , Pontus Fuchs , Linus Torvalds , mingo@redhat.com, "linux-kernel@vger.kernel.org" , gleb@kernel.org Subject: Re: [PATCH] sched,kvm: Fix KVM preempt_notifier usage In-Reply-To: <5596AE3E.4030706@redhat.com> References: <20150625120949.GZ3644@twins.programming.kicks-ass.net> <558BF0E4.50602@gmail.com> <20150625125514.GA3644@twins.programming.kicks-ass.net> <55966E0B.7060100@redhat.com> <20150703121907.GH19282@twins.programming.kicks-ass.net> <5596809D.4000905@redhat.com> <20150703131712.GJ19282@twins.programming.kicks-ass.net> <20150703151642.GQ18673@twins.programming.kicks-ass.net> <5596A997.5060705@redhat.com> <5596AC82.6080706@redhat.com> <20150703154245.GL25159@twins.programming.kicks-ass.net> <5596AE3E.4030706@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Fri, 3 Jul 2015 17:46:06 +0200, Paolo Bonzini wrote: > > > > On 03/07/2015 17:42, Peter Zijlstra wrote: > > On Fri, Jul 03, 2015 at 05:38:42PM +0200, Paolo Bonzini wrote: > >> So basically this. Can you reply with SoB and maybe Acked-by? > > > > Ah, thanks for doing that! > > > >> ------------- 8< --------------- > >> From: Peter Zijlstra > >> Subject: [PATCH] sched, preempt_notifier: separate notifier registration from static_key inc/dec > >> > >> Commit 1cde2930e154 ("sched/preempt: Add static_key() to preempt_notifiers") > >> had two problems. First, the preempt-notifier API needs to sleep with the > >> addition of the static_key, we do however need to hold off preemption > >> while modifying the preempt notifier list, otherwise a preemption could > >> observe an inconsistent list state. KVM correctly registers and > >> unregisters preempt notifiers with preemption disabled, so the sleep > >> caused dmesg splats. > >> > >> Second, KVM registers and unregisters preemption notifiers very often > >> (in vcpu_load/vcpu_put). With a single uniprocessor guest the static key > >> would move between 0 and 1 continuously, hitting the slow path on every > >> userspace exit. > >> > >> To fix this, wrap the static_key inc/dec in a new API, and call it from > >> KVM. > >> > >> Fixes: 1cde2930e154 ("sched/preempt: Add static_key() to preempt_notifiers") > >> Reported-by: Pontus Fuchs > >> Reported-by: Takashi Iwai > > > > Signed-off-by: Peter Zijlstra (Intel) > > Ok, I'm crossing fingers and including this in my pull request in order > to preserve bisectability. Thanks. I checked the patch now and confirmed that it fixes the regressions (the warnings and the sluggish mouse pointer). Feel free to my tested-by tag, if any. Tested-by: Takashi Iwai Thanks! Takashi