From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932320AbcLLGyK (ORCPT ); Mon, 12 Dec 2016 01:54:10 -0500 Received: from terminus.zytor.com ([198.137.202.10]:49728 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbcLLGyI (ORCPT ); Mon, 12 Dec 2016 01:54:08 -0500 Date: Sun, 11 Dec 2016 22:49:43 -0800 From: tip-bot for Peter Zijlstra Message-ID: Cc: tglx@linutronix.de, akataria@vmware.com, hpa@zytor.com, peterz@infradead.org, rusty@rustcorp.com.au, chrisw@sous-sol.org, linux-kernel@vger.kernel.org, jeremy@goop.org, torvalds@linux-foundation.org, pbonzini@redhat.com, mingo@kernel.org, bp@alien8.de, xiaolong.ye@intel.com, xinhui.pan@linux.vnet.ibm.com Reply-To: peterz@infradead.org, tglx@linutronix.de, akataria@vmware.com, hpa@zytor.com, linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, chrisw@sous-sol.org, pbonzini@redhat.com, jeremy@goop.org, torvalds@linux-foundation.org, xinhui.pan@linux.vnet.ibm.com, xiaolong.ye@intel.com, mingo@kernel.org, bp@alien8.de In-Reply-To: <20161208154349.270616999@infradead.org> References: <20161208154349.270616999@infradead.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] x86/paravirt: Fix native_patch() Git-Commit-ID: 45dbea5f55c05980cbb4c30047c71a820cd3f282 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 45dbea5f55c05980cbb4c30047c71a820cd3f282 Gitweb: http://git.kernel.org/tip/45dbea5f55c05980cbb4c30047c71a820cd3f282 Author: Peter Zijlstra AuthorDate: Thu, 8 Dec 2016 16:42:14 +0100 Committer: Ingo Molnar CommitDate: Sun, 11 Dec 2016 13:09:19 +0100 x86/paravirt: Fix native_patch() While chasing a regression I noticed we potentially patch the wrong code in native_patch(). If we do not select the native code sequence, we must use the default patcher, not fall-through the switch case. Signed-off-by: Peter Zijlstra (Intel) Cc: Alok Kataria Cc: Borislav Petkov Cc: Chris Wright Cc: Jeremy Fitzhardinge Cc: Linus Torvalds Cc: Pan Xinhui Cc: Paolo Bonzini Cc: Peter Anvin Cc: Peter Zijlstra Cc: Rusty Russell Cc: Thomas Gleixner Cc: kernel test robot Fixes: 3cded4179481 ("x86/paravirt: Optimize native pv_lock_ops.vcpu_is_preempted()") Link: http://lkml.kernel.org/r/20161208154349.270616999@infradead.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/paravirt_patch_32.c | 4 ++++ arch/x86/kernel/paravirt_patch_64.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/kernel/paravirt_patch_32.c b/arch/x86/kernel/paravirt_patch_32.c index ff03dbd..33cdec2 100644 --- a/arch/x86/kernel/paravirt_patch_32.c +++ b/arch/x86/kernel/paravirt_patch_32.c @@ -58,15 +58,19 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf, end = end_pv_lock_ops_queued_spin_unlock; goto patch_site; } + goto patch_default; + case PARAVIRT_PATCH(pv_lock_ops.vcpu_is_preempted): if (pv_is_native_vcpu_is_preempted()) { start = start_pv_lock_ops_vcpu_is_preempted; end = end_pv_lock_ops_vcpu_is_preempted; goto patch_site; } + goto patch_default; #endif default: +patch_default: ret = paravirt_patch_default(type, clobbers, ibuf, addr, len); break; diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c index e61dd97..b0fceff 100644 --- a/arch/x86/kernel/paravirt_patch_64.c +++ b/arch/x86/kernel/paravirt_patch_64.c @@ -70,15 +70,19 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf, end = end_pv_lock_ops_queued_spin_unlock; goto patch_site; } + goto patch_default; + case PARAVIRT_PATCH(pv_lock_ops.vcpu_is_preempted): if (pv_is_native_vcpu_is_preempted()) { start = start_pv_lock_ops_vcpu_is_preempted; end = end_pv_lock_ops_vcpu_is_preempted; goto patch_site; } + goto patch_default; #endif default: +patch_default: ret = paravirt_patch_default(type, clobbers, ibuf, addr, len); break;