From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EAEC40BCCE for ; Tue, 16 Jun 2026 07:53:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781596419; cv=none; b=O1ZS36mMPz+U7KfgPXayvBatGGBiK3DTPjpOKTYNEGFQXJJNy45NyDa4rAPUkt6bkqK2+TBZz5Vzh6gzpwCDFS6l0AzCmAkmf9RWvDspow3mG4mGmLWcTU8/B5WlfOZkh6L4iw15cWtXBUL2zw+upaliVbK42iH/+LK33EbngDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781596419; c=relaxed/simple; bh=fJ3dnkcHNwp9ZR5AJ9d5sBOa2DgEQ2jeZIDaqCnH7vA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jBTYMlzusmUoqsc3ytCPsIygmTKuFDpCY2k72PeYRT5ybpmkCmv3EETbcWThhyEf1FZ9fHl9RZrYpr89++r5djrlLrMqJkbfBVuuy6ffnAhZBuWyzwAZQB3DrOSiVs9dnWdMaiglbqGTM6EFGillFpDsHkj5kdmGjr7I1dgjNfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=WyBF448y; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WyBF448y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6/OqfCdm0cCV0MQhJLaBkefXlwypy1kVyxeDVna7JW4=; b=WyBF448yv7lVABkiYg7I6oEkkp wEwagBJ7nobOzPycwDKC7xT6E64WO44ESWt9R+3mudjT1Ne1WJnmcegmRw/V/HrvjMZRJyPZQdPnV 1o6AQTQk2iYlQ2IJtc9qnOGNk4NYfd/l9oHcd8O19JbnUENsznpAYjjDM0WXMG+bi/tu7LGfoA9/d D6KZZznIPpLVpdaggTfKiT2GZTS42vp6WcxO1cp+Rgzoma/AhbCL8DVa+bTM8OonhlePio0LgaqxR EYeaWLzP+MpAK4kj/YIVAPju+aO83gZASYzHw+exx78n/R2xvxFPz5n6P4xgc20PgVYK+SGme/WUf quKq0R8w==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wZOc0-0000000ALto-1GMg; Tue, 16 Jun 2026 07:53:33 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BBABB30036F; Tue, 16 Jun 2026 09:53:31 +0200 (CEST) Date: Tue, 16 Jun 2026 09:53:31 +0200 From: Peter Zijlstra To: "H. Peter Anvin" Cc: tglx@kernel.org, mingo@redhat.com, bp@alien8.de, Nathan Chancellor , Calvin Owens , Dave Hansen , torvalds@linux-foundation.org, x86-ML , LKML Subject: Re: 8aeb879baf12 - significant system call latency regression, bisected Message-ID: <20260616075331.GP48970@noisy.programming.kicks-ass.net> References: <20260613085919.GF42921@noisy.programming.kicks-ass.net> <203E61B7-290F-4F87-860F-B352D0072703@zytor.com> <338ead9a-91f4-4579-9954-e18911fa3f68@zytor.com> <01ac45a8-b558-4d4d-9f8f-e7a4e725d5d2@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01ac45a8-b558-4d4d-9f8f-e7a4e725d5d2@zytor.com> On Sun, Jun 14, 2026 at 07:07:50PM -0700, H. Peter Anvin wrote: > It uses the same hack as the Makefile to deal with function alignment with a > prefix: it adds unnecessary NOPs so that the pre-alignment and > post-alignment are the same. At the end of the day this really ought to be > fixed in gcc. And clang, but I don't think they can, it wrecks the 'ABI' they have in place with the current set of arguments. Which I agree is somewhat unfortunate, but it is what it is. > diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c > index 71f032504e73..337e3e53d262 100644 > --- a/arch/x86/entry/syscall_64.c > +++ b/arch/x86/entry/syscall_64.c > @@ -9,6 +9,14 @@ > #include > #include > > +#ifdef CONFIG_CALL_PADDING > +# define _pfe(x) __attribute((patchable_function_entry(x,x))) > +#else > +# define _pfe(x) > +#endif > +#define _align_func(x) __aligned(x) _pfe(x-CONFIG_FUNCTION_ALIGNMENT+CONFIG_FUNCTION_PADDING_BYTES) > +#define align_func(x) _align_func((x) < CONFIG_FUNCTION_ALIGNMENT ? CONFIG_FUNCTION_ALIGNMENT : (x)) > + > #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); > #define __SYSCALL_NORETURN(nr, sym) extern long __noreturn __x64_##sym(const struct pt_regs *); > #include > @@ -32,7 +40,7 @@ const sys_call_ptr_t sys_call_table[] = { > #undef __SYSCALL > > #define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); > -long x64_sys_call(const struct pt_regs *regs, unsigned int nr) > +long align_func(32) x64_sys_call(const struct pt_regs *regs, unsigned int nr) > { > switch (nr) { > #include > @@ -41,7 +49,7 @@ long x64_sys_call(const struct pt_regs *regs, unsigned int nr) > } > > #ifdef CONFIG_X86_X32_ABI > -long x32_sys_call(const struct pt_regs *regs, unsigned int nr) > +long align_func(32) x32_sys_call(const struct pt_regs *regs, unsigned int nr) > { > switch (nr) { > #include This more or less works by accident, in general your align_func() macro is horrendously broken when you consider kCFI. By changing the patchable_function_entry attribute like this, the kCFI hash ends up at a different location and things go side-ways really really fast. The only reason it works here is that this function is never indirectly called and so the kCFI ABI violation is immaterial.