From: Peter Zijlstra Subject: Re: [PATCH 00/33] Compile-time stack metadata validation Date: Fri, 12 Feb 2016 21:10:11 +0100 Message-ID: <20160212201011.GW6357@twins.programming.kicks-ass.net> References: <56BDB5A8.9030006@suse.cz> <20160212144543.GA29004@treble.redhat.com> <20160212171037.GV6357@twins.programming.kicks-ass.net> <20160212183206.GB29004@treble.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jiri Slaby , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, live-patching-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Marek , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , Pedro Alves , Namhyung Kim , Bernd Petrovitsch , Chris J Arges , Andrew Morton , Arnaldo Carvalho de Melo , David Vrabel , Borislav Petkov , Konrad Rzeszutek Wilk , Boris Ostrovsky , Jeremy Fitzhardinge , Chris Wright , To: Josh Poimboeuf Return-path: Content-Disposition: inline In-Reply-To: <20160212183206.GB29004-8wJ5/zUtDR0XGNroddHbYwC/G2K4zDHf@public.gmane.org> Sender: linux-watchdog-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org On Fri, Feb 12, 2016 at 12:32:06PM -0600, Josh Poimboeuf wrote: > What I actually see in the listing is: > > decl __percpu_prefix:__preempt_count > je 1f: > .... > 1: > call ___preempt_schedule > > So it puts the "call ___preempt_schedule" in the slow path. Ah yes indeed. Same difference though. > I also don't see how that would be related to the use of the asm > statement in the __preempt_schedule() macro. Doesn't the use of > unlikely() in preempt_enable() put the call in the slow path? Sadly no, unlikely() and asm_goto don't work well together. But the slow path or not isn't the reason we do the asm call thing. > #define preempt_enable() \ > do { \ > barrier(); \ > if (unlikely(preempt_count_dec_and_test())) \ > preempt_schedule(); \ > } while (0) > > Also, why is the thunk needed? Any reason why preempt_enable() can't be > called directly from C? That would make the call-site save registers and increase the size of every preempt_enable(). By using the thunk we can do callee saved registers and avoid blowing up the call site. -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html