From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDD922D63F6 for ; Mon, 5 Jan 2026 08:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767600298; cv=none; b=gxzih1VW7ONLm25Yk1CLj6wos00EpBzRLmDcB2jo9HZhsWIDB5qhxP25WdbaSov0k/nRSLgT2ghTJ9k8DYK4zjXRxoWaklYtU+8K0eTpwpkSlr+uaAzvL2Es51L5sgXAcFepSQuSkEXFSCzbCHTGYFVVTjykbO/hwB2jGwm59ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767600298; c=relaxed/simple; bh=uD/tk0uTTNovjJifiGqDbwkmO0cn2n2XxV8h97xQ9sI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KHyXBSpqJ40VoJEdQ21ZNXcj6Agm5XqA+Ks76LZRTVyErfPilP9JBbNN9ipjuw7z3Wd0DIJDJ7occfm5zt5amipmNhQug92KF/JleMmJzrY+OKBeNwQexj/GlQwjJHy9tzQZUBLQm3DQr8dBVygU05j+rqlg6BDFTC4p6/LACEo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=k1FgKIOp; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=k1FgKIOp; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="k1FgKIOp"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="k1FgKIOp" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B663C5BE32; Mon, 5 Jan 2026 08:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1767600294; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=if6BkKaQQaV6LiMeqUqJOhxqf8xYYi48c9agHlUsS7w=; b=k1FgKIOpnO2ewJlJTeelU5pmeWxgyVwBTO6lZkOOs4j818Yyxl5IGAcMqKGRkD7wy5zKZZ ovT00CXcbbTZEV03+l6hY07xiXaR2UOxmfi4NMu3JkUN+dbI1cJJuNbBDPMCxcFPefuwne dOOhWWmz7qsJ3GhixsaL1SLOb8HgPg0= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1767600294; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=if6BkKaQQaV6LiMeqUqJOhxqf8xYYi48c9agHlUsS7w=; b=k1FgKIOpnO2ewJlJTeelU5pmeWxgyVwBTO6lZkOOs4j818Yyxl5IGAcMqKGRkD7wy5zKZZ ovT00CXcbbTZEV03+l6hY07xiXaR2UOxmfi4NMu3JkUN+dbI1cJJuNbBDPMCxcFPefuwne dOOhWWmz7qsJ3GhixsaL1SLOb8HgPg0= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 721FD3EA63; Mon, 5 Jan 2026 08:04:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4UViGqZwW2k9NQAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 08:04:54 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH v5 0/2] x86/alternative: Patch a single alternative location only once Date: Mon, 5 Jan 2026 09:04:50 +0100 Message-ID: <20260105080452.5064-1-jgross@suse.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -2.80 Instead of patching a single location potentially multiple times in case of nested ALTERNATIVE()s, do the patching only after having evaluated all alt_instr instances for that location. Changes in V2: - complete rework (Boris Petkov) Changes in V3: - split former V2 patch into 2 by introducing a helper function (Boris Petkov) - repost the small cleanup patch 1 which was taken before, but has somehow vanished from the tip x86/alternative branch (it is still in the tip master branch, but I couldn't find it in any other tip branch). Changes in V4: - use 3 helpers instead of 1 (Boris Petkov) Changes in V5: - dropped patch 1 of V4, as already applied - small cosmetic changes (Boris Petkov) Juergen Gross (2): x86/alternative: Use helper functions for patching alternatives x86/alternative: Patch a single alternative location only once arch/x86/kernel/alternative.c | 149 +++++++++++++++++++++------------- 1 file changed, 92 insertions(+), 57 deletions(-) -- 2.51.0