From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753979AbcLORU2 (ORCPT ); Thu, 15 Dec 2016 12:20:28 -0500 Received: from merlin.infradead.org ([205.233.59.134]:43806 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752312AbcLORU1 (ORCPT ); Thu, 15 Dec 2016 12:20:27 -0500 Date: Thu, 15 Dec 2016 18:20:15 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , x86@kernel.org, Kyle Huey , Andy Lutomirski Subject: Re: [patch 1/3] x86/process: Optimize TIF checks in switch_to_extra() Message-ID: <20161215172015.GZ3124@twins.programming.kicks-ass.net> References: <20161215162648.061449202@linutronix.de> <20161215164240.736387680@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161215164240.736387680@linutronix.de> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 15, 2016 at 04:44:02PM -0000, Thomas Gleixner wrote: > void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, > struct tss_struct *tss) > { > struct thread_struct *prev, *next; > + unsigned long tifp, tifn; > > prev = &prev_p->thread; > next = &next_p->thread; > > + tifn = task_thread_info(next_p)->flags; > + tifp = task_thread_info(prev_p)->flags; > + switch_to_bitmap(tss, prev, next, tifp, tifn); > + > + propagate_user_return_notify(prev_p, next_p); > + > + if ((tifp ^ tifn) & _TIF_BLOCKSTEP) { > unsigned long debugctl = get_debugctlmsr(); > > debugctl &= ~DEBUGCTLMSR_BTF; > + if (tifn & _TIF_BLOCKSTEP) > debugctl |= DEBUGCTLMSR_BTF; > update_debugctlmsr(debugctl); > } Going by the toggle patter you have elsewhere, wouldn't that then be: if ((tifp ^ tifn) & _TIF_BLOCKSTEP) { unsigned long debugctl = get_debugctlmsr(); debugctl ^= DEBUGCTLMSR_BTF; update_debugctlmsr(debugctl); } ?