From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 586AF30505E for ; Wed, 19 Nov 2025 16:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763568266; cv=none; b=OkzRCa7dd2aIZvmxl3wotlJH/tBzqw8t9lBjfaQ6HZu0QJbtyUlKVAaj9ICCHi+2PM6XesGPuIbxJQpmUxGwGCxpwBxRgNT34BHEdaVU4yIsjcKJUPi+sGd7AIhWObrv23b6dloBILKcPE6ITkU3sZellUhfET4neTtcs3x3Ty8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763568266; c=relaxed/simple; bh=BevIKByF9bYOXvtX2T5P4sw1TPtQP0lgz0Tgo+qmyw4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oMbmbm/0oMK0hqk2Qv41G/jjXUvVgNN0IU5x6iH4It5RklYxOM1kb48CJUFrv0fdOr0i4v+MG3K445AIGBQi8ykPBNg/3NETdlvfu+WNjxVpZ4zygMOsaMUbc3dhAKYAQpJpJ8f2l/zbu1kzhUCU5uvermCYhrENhpbrwFYsaWc= 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=jaENqLOH; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=jaENqLOH; arc=none smtp.client-ip=195.135.223.130 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="jaENqLOH"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="jaENqLOH" 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-out1.suse.de (Postfix) with ESMTPS id 5FB7121206; Wed, 19 Nov 2025 16:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1763568262; 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=yL6fchIT2a6z2iiFJZNp0gVXVg4X/GJKBWOWMrWE5Ao=; b=jaENqLOHZIh33BmDYFgJ0PBSDpwVkt8Dj+yqgSqchqei87+6hUScuNxPmhCrzYa0f0mQ7Z nhcmS8a1yNm3HQPIobC+L7J2yeG8FbWhfw15db8n9j/zBn/+dWttS4PdfHVcamhuQQY/9J /i3W6FmBhrFy3ca1KzaLNjqz2SQVkPI= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1763568262; 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=yL6fchIT2a6z2iiFJZNp0gVXVg4X/GJKBWOWMrWE5Ao=; b=jaENqLOHZIh33BmDYFgJ0PBSDpwVkt8Dj+yqgSqchqei87+6hUScuNxPmhCrzYa0f0mQ7Z nhcmS8a1yNm3HQPIobC+L7J2yeG8FbWhfw15db8n9j/zBn/+dWttS4PdfHVcamhuQQY/9J /i3W6FmBhrFy3ca1KzaLNjqz2SQVkPI= 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 1A8163EA62; Wed, 19 Nov 2025 16:04:22 +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 C7XyBIbqHWlsUgAAD6G6ig (envelope-from ); Wed, 19 Nov 2025 16:04:22 +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 v4 0/3] x86/alternative: Patch a single alternative location only once Date: Wed, 19 Nov 2025 17:04:17 +0100 Message-ID: <20251119160420.22160-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)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-Spam-Level: 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) Juergen Gross (3): x86/alternative: Drop not needed test after call of alt_replace_call() x86/alternative: Use helper functions for patching alternatives x86/alternative: Patch a single alternative location only once arch/x86/kernel/alternative.c | 147 ++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 60 deletions(-) -- 2.51.0