From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 8A1CF230D14 for ; Wed, 26 Nov 2025 10:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154621; cv=none; b=ZJbhydDVAYXpSQk3lJp7HV8kxkrIYWnq4Uyx17xUAiqyTizgBnXLvNsLpTNwG3bpTemjDwDck86OedBQimcuk0v3mAwjY/tUAUaTw8glT0h5l6Fz6/t88Uf+LwX6+4xYRxu9MJS4Hof6lKUnB4pEd9232swn3qwNyFyzeWY30Rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154621; c=relaxed/simple; bh=L0wcU2kyxYOuwt3Jzn/cTE+DdNuboNHzzvIs5Ewxq84=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eSpPeeJhEAfZkfyE5fl5Fuk448hFMWiXPlDHKDR+JSrDT+SM4jMRLQve/BrfRTAnIQyKWLDcVlu98wes3ye2vixwEoRcLz4TWP3R0zFz5ZvsjpRLmgB8rzH9knSaMZDwFBufoF2LyZqyZBt1CxQ63fu/gzonUQUXAnS2Roh1l0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eKBqK6zI; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none 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="eKBqK6zI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=P4pzvD7HHUkTUhLrGcFgr2knGfnK1ZjZ5yGs96ZhGXA=; b=eKBqK6zIAFCUAE8SjkSOWzkNZ5 zxb9JiVmEnjJ8YAqfzWy/N76Bu6igKDBPWh1WAFawLi5QV/YHgZdfV2+bdxWNDjc+LHffxEonqr20 8zYRkyMgVP+Kl8np/4jJae7U5J1ba7xbBaZwPZZZTAGruEVO+2dk7WYmY85YHIXac7YyN/J0i4EX0 0+lILK70Zd24nhI9Ne4KXpJ4MFeL3ioNkJAjoWScO9ItTby8GRxs8DeAir+mtXbBkVCK2vVs0Sxne SYgpUp6dK0WhHjDVUvkbhyzwiiNlHEUUwDZJiF0m3wTwwH7u2ESwTWO/dCkUPR9imk0iUv/tqfiyd eS55aVLw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vOCL4-00000007lka-1qYk; Wed, 26 Nov 2025 10:01:30 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 9E5E830036B; Wed, 26 Nov 2025 11:56:51 +0100 (CET) Date: Wed, 26 Nov 2025 11:56:51 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: x86@kernel.org, ardb@kernel.org, linux-kernel@vger.kernel.org, kees@kernel.org, acarmina@redhat.com, jpoimboe@kernel.org, mark.rutland@arm.com, maciej.wieczor-retman@intel.com Subject: Re: [PATCH v2 08/12] x86/bug: Add BUG_FORMAT basics Message-ID: <20251126105651.GX3245006@noisy.programming.kicks-ass.net> References: <20251110114633.202485143@infradead.org> <20251110115757.980264454@infradead.org> <20251125111750.GS4067720@noisy.programming.kicks-ass.net> <20251125123301.GO4068168@noisy.programming.kicks-ass.net> <20251125151739.GP4068168@noisy.programming.kicks-ass.net> 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: On Tue, Nov 25, 2025 at 08:27:50AM -0800, Linus Torvalds wrote: > (Slightly related thing: could we perhaps just make x86-32 also use > the relative format, and get rid of some of the horrid #ifdef's in the > x86 implementation? Because that "__BUG_REL" thing is not > a thing of beauty either). This builds and appears to work. I'll slap a changelog on and stick on top of those other patches. --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -381,7 +381,7 @@ config GENERIC_CSUM config GENERIC_BUG def_bool y depends on BUG - select GENERIC_BUG_RELATIVE_POINTERS if X86_64 + select GENERIC_BUG_RELATIVE_POINTERS config GENERIC_BUG_RELATIVE_POINTERS bool --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -42,16 +42,10 @@ extern void __WARN_trap(struct bug_entry #ifdef CONFIG_GENERIC_BUG -#ifdef CONFIG_X86_32 -#define __BUG_REL(val) ".long " val -#else -#define __BUG_REL(val) ".long " val " - ." -#endif - #ifdef CONFIG_DEBUG_BUGVERBOSE #define __BUG_ENTRY_VERBOSE(file, line) \ - "\t" __BUG_REL(file) "\t# bug_entry::file\n" \ - "\t.word " line "\t# bug_entry::line\n" + "\t.long " file " - .\t# bug_entry::file\n" \ + "\t.word " line "\t# bug_entry::line\n" #else #define __BUG_ENTRY_VERBOSE(file, line) #endif @@ -59,7 +53,7 @@ extern void __WARN_trap(struct bug_entry #if defined(CONFIG_X86_64) || defined(CONFIG_DEBUG_BUGVERBOSE_DETAILED) #define HAVE_ARCH_BUG_FORMAT #define __BUG_ENTRY_FORMAT(format) \ - "\t" __BUG_REL(format) "\t# bug_entry::format\n" + "\t.long " format " - .\t# bug_entry::format\n" #else #define __BUG_ENTRY_FORMAT(format) #endif @@ -69,7 +63,7 @@ extern void __WARN_trap(struct bug_entry #endif #define __BUG_ENTRY(format, file, line, flags) \ - __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \ + "\t.long 1b - ." "\t# bug_entry::bug_addr\n" \ __BUG_ENTRY_FORMAT(format) \ __BUG_ENTRY_VERBOSE(file, line) \ "\t.word " flags "\t# bug_entry::flags\n"