Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3126383rdb; Tue, 13 Feb 2024 07:37:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1I4OM7xVQBbi0Apt4ytjSG0nBzxeK64ss5Y8x4WqUWM1p6AgyEHVv4wiyjGJR/4BjzjU/ X-Received: by 2002:a17:902:db02:b0:1da:25a9:ba12 with SMTP id m2-20020a170902db0200b001da25a9ba12mr10259212plx.28.1707838628206; Tue, 13 Feb 2024 07:37:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707838628; cv=pass; d=google.com; s=arc-20160816; b=mRMbFe7A+UPcTQAuu1aVL6YX6lerJegNOT9991tuCfjbnfYa6wvZDg7NGtUWTj5mcc PMD+Ff+ET4+Vy9+smMoUFuMrnq1xYnF8z/QtRD4rkppnSuvcyGlIhITrkZ7tJRK8SHoN ZyNCQtqUNaUP4uStQhaRm0A0Ksqfys3L3GUunyki2UAgPfRorMQr8eLgG4ncGJyw0ybv ClPFw4+XF+e7Qxgnm1ttA5IguNcM23KcGo7B+I0PftXGA1gKlOHhyYqehoH29t3O8azD QWPsdgCUIRL4BY7R14bfy+pcQGufEo5ftnYdCEkqfpp2n/zW5yE/xxWvq8Ac2ZLEtSCQ 75lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=GcR9hvL1CX0aruis7esP8PW843z4Ww57swVAevIUlHU=; fh=yyBDYKbumbu4zFP32qTObuLph6mq08BUZDV44FC2rps=; b=NqdLdiUhEZgCJL87GredRiknh1L23W/BLCMmhBMdlIGZm1qFtFAjR+Tfo6gQomiChr TB6GlVCUb45XX/QlwROktSw7p2FKsDzHkwlzZkOf601s41s7RENvSs4HsOlJI5XB3JTW qvPm6KPCTBiT2uhFzM0XY3SVCIUN+WwJ6u2yAXOh4FzXfriq8xLvfzLm7xJy5CeTDmDK BRN3IPqJf8ELilXV8SM5HSvjSCWfe21P8nwHuA/s+he4znN/R9qn0bVW0Ko1QLBoKw1Y M3YvifqO8eiARtxq2MD2DstyVguXBZbhRy/PcCHlxhj99Yjvbvqs1475E9AJRlnvd6q+ IIqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yOJUExvk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-63814-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCWxKPFBUfWX0VEgEpzhAOw9GyMvuB4eYXm8JrADA8C9wagyc85vDAdP7Zc+t1E950JEgyv5ZiCCXoiGKMDhxEIiwfimEraJ6qBO4SlwDA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q24-20020a170902789800b001db3f0cf2f4si879624pll.555.2024.02.13.07.37.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:37:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63814-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yOJUExvk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-63814-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A589285B27 for ; Tue, 13 Feb 2024 15:36:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B55FE5F867; Tue, 13 Feb 2024 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yOJUExvk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LaO30LZW" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 720735F847; Tue, 13 Feb 2024 15:36:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707838562; cv=none; b=Oo/UBrQFIRLQQVVd4Z5ykH4EsU1mA9qEgunDPa0t8I3ULatmJ7JtjNbr3iWydAFIGH5yaz+vhdTnvoivKjOXOHY7rtffNBwB6aLOXCB0Hfiv3PNw2Dz0d74XOwt7GeGKFSrcQg593CIFJ7rF22SFAsdsw6vYZdlJ7uiYt6tL+28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707838562; c=relaxed/simple; bh=M0jJHh1BuDjl82V5lMEXCO2eAecuSsYLY3XSQfcrJ70=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Gi6q1e6Rtpg8GgaeuRmpv0ADvAzazpIagmwF99LSvT44VVQ9I7ZMqTymhOvIad4sRX9MpOlvQAuQtrtTjq0ARjbOZzlTxrf674fVAagQEDX2/HX89z9T1Ebq+7C0CkqrFrbR6VEo54Iozd+ua1RsA93PNyuhArs15O1tAn863/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yOJUExvk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LaO30LZW; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 13 Feb 2024 15:35:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707838559; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GcR9hvL1CX0aruis7esP8PW843z4Ww57swVAevIUlHU=; b=yOJUExvkl9XcmSg8WD7FonyI07gs7U4zzLvheYLNp25egHiLHi0clgQlR0o/kxMRsOZTbb zch+2uXWmnUg47DMo4SdWQcOCicYMVuCNuaCzgJTPXEdSsJWNTGzTxuJ4tvSfWfJBEHn4q Xc11IxxjQ1eOc+jwGiBettYx/G22xFBumDamItahj3g6Sha4TzAn6fQixfZrAK85U0HYVX un617e0RvqHd6LaRG1e4d4SiCe14jG/ZDWPtEGcpcmHWUJMW94Xx7ua4jIMxm9LX1GVWc9 HC/k2gNhzosYTdxIFR5cPGFYM/gukdo+I/BcVP96fubyc/M9qdPIhDhOukxkSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707838559; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GcR9hvL1CX0aruis7esP8PW843z4Ww57swVAevIUlHU=; b=LaO30LZW9o7rT4PehZkgKfkhW5may1mhwAKC/W/QAn2/xR8IXDSELPxFVznncWkS8YopKb 8vk4MiX7zT6Z55Ag== From: "tip-bot2 for Borislav Petkov (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/alternatives] x86/alternatives: Optimize optimize_nops() Cc: "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240130105941.19707-4-bp@alien8.de> References: <20240130105941.19707-4-bp@alien8.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170783855882.398.12172953906300246762.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/alternatives branch of tip: Commit-ID: f7045230fa2933bf3b38c9c92b5ba46486ef33f9 Gitweb: https://git.kernel.org/tip/f7045230fa2933bf3b38c9c92b5ba46486ef33f9 Author: Borislav Petkov (AMD) AuthorDate: Tue, 30 Jan 2024 11:59:40 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 13 Feb 2024 16:26:56 +01:00 x86/alternatives: Optimize optimize_nops() Return early if NOPs have already been optimized. Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20240130105941.19707-4-bp@alien8.de --- arch/x86/kernel/alternative.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index cdbece3..1ceaaab 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -233,6 +233,10 @@ static void __init_or_module noinline optimize_nops(const u8 * const instr, u8 * if (insn_is_nop(&insn)) { int nop = i; + /* Has the NOP already been optimized? */ + if (i + insn.length == len) + return; + next = skip_nops(buf, next, len); add_nop(buf + nop, next - nop);