Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2127551lqe; Tue, 9 Apr 2024 10:11:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGBb9TbUwerbm9e0FJhP1sogySQsKZcZlKLvbV1uiGQjNk/PUqpAr/iXwlVPtax+PUUdNsT2SLGEyUbsGjq9+64WXk/1cdNOnoOBNOIQ== X-Google-Smtp-Source: AGHT+IGre0BZLuyRlasjZfXyJqtLMJaa18sLiGmz7/kAL9L+N8ypgFF2KfY/PfycVwXYib0GniyQ X-Received: by 2002:a05:6820:1a0b:b0:5aa:6462:daa1 with SMTP id bq11-20020a0568201a0b00b005aa6462daa1mr545925oob.8.1712682704817; Tue, 09 Apr 2024 10:11:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712682704; cv=pass; d=google.com; s=arc-20160816; b=DJ0oVf491ponTx4BX6PMYlSAdMn5JbZUUXgV3nnlrhbPN5ss1Br8x4hwmm+74OnYvW Hjzowohx31h0UoAXOtbiDEF5qd49/AJs3cNM4I4nXh7/vaheo+TMClR67go9vwTBo+/E ddIExANG5XHh9+gIYS0omwU1D8K/8ygAuOVbdYAIv6BxsTv35c6LgjykZnueVjFKuXyg ylJBAghHz9t+5emyCZdoweqdpXnAno1NlEbMFnekjcMUjrU84pHriDS3frnSPvMm4/gA 0COFRWnsS77AVgrDRTJr6a2YenZL5Y/WjfNSBCE7WMDcExEUeWOggAegM3QG5EDnm+8S 2Ytg== 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=NbpWJn4KRkKjI4s4Kh7TlAXOSa4mKT+oKrv3tSPcdRM=; fh=rR8KC3MdVVkWqW1DLWNOtxrtJ4e446FIKUSpWnemrcA=; b=mTC3+hS95qMpo/12iRpXt4e9GS8iFYDk7nz5PuYuGRcuPTnXV7UByoPvzv+VZlss6s 6IGodbqCD47YwiLH1SsOTcJAgImcC0WK1y6Fp+ZeS/fH7BCRCJnlhQrtrRO6Er6iw0GK hRr5HRQdv4/AQXAFBRBjfzoK0me6YtLHNlz3YaXaTQAhlWULE1lCmc+s8mI0F72soII8 gAPWH4+je0c8Vz3YhAb5aQdFcuBxaAxEc7JUoeu+3T19OGxYLSdHW7OLksdNZf/975ch oeRAaBg+S67Yp4NF8b54sGc7RxYtVUhjxuHUoZC2Q6sqr2rhkwIl5aA722+G2IPqSEDy ym5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IvpsX8th; 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-137374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k9-20020a05622a03c900b00434f6c1b3a2si462476qtx.288.2024.04.09.10.11.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 10:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IvpsX8th; 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-137374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137374-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 841CC1C22CF6 for ; Tue, 9 Apr 2024 17:11:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2213315574A; Tue, 9 Apr 2024 17:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IvpsX8th"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="43mk2Ox9" 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 E355113E3E3; Tue, 9 Apr 2024 17:11:31 +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=1712682693; cv=none; b=P7EzFyLdPFjCS+6BNh6gQMfj0dyAZ/37GmAVM+83U6FRPpty06uMtk35pEkc0ELTv77jH5Uwrrm/T9KtptJFqg0Z7+vDaCLjxkVossakGbypmujViAskP9txV0N2/T9LkHKKSCIGW5sa17OH/2+lvz19ibJ+fJt6+Jgvns5JW3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712682693; c=relaxed/simple; bh=R5qGMOirGfZFbAaEUH30RR5x4sJCy7rmjxwpl66oPhY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WRWKC1+mdAmJBEjgfagKoifTp8xWMkvRLXq+vb1iSzbbSTp8vdkUZgfTjsWHBziCHw+fjMtaw78XjfMK7IK2aBiIJLDUoAy86vmd0ZZ2FmZYfVx2di1BhRjd1BZExbh8y/BdggxAtjMTYQwg4MO5Psxxn64zedPZ8B2d5Y1b/iU= 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=IvpsX8th; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=43mk2Ox9; 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, 09 Apr 2024 17:11:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712682690; 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=NbpWJn4KRkKjI4s4Kh7TlAXOSa4mKT+oKrv3tSPcdRM=; b=IvpsX8th7Im4Bj64Nh+wJig+sc1pyu5EMP7MZGlF9u0UNCLgnVa/wu67qfEfg4NgddRekO hH99djYSi0j1XxB6/4zjrZUhJannk0UNspohBMxd49zrqBkNOAhGgQuDN/27vQUp/I2XFZ T71yO0MDW9mYMy6NPgOeOcSXE5z1macUn/8mMJGPMw6CbFtUXRonqhQXUpi8YzlGCYLVWa aU+P4Nkwbt/CF9LtsWhFriWxkNS5+mIuZOFItt9u5+4nA9FOrj/dVkGwdGWLQ+QA4EQL+2 /GcMEXum0wQ4wds3O7olI6Yg0qlJdC5a822J6LVl0cwF//YxIQikFrLJLFDs9Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712682690; 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=NbpWJn4KRkKjI4s4Kh7TlAXOSa4mKT+oKrv3tSPcdRM=; b=43mk2Ox94BGP27DP50UTaAUWgXt+/dE2BY5aWn8+Q2F2QsAjesuAxatmwTjpeZjtRW6F2e 3BpkrjVInUFAUtCA== 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: <171268268951.10875.9396936465731791620.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: c3a3cb5c3d893d7ca75c773ddd107832f13e7b57 Gitweb: https://git.kernel.org/tip/c3a3cb5c3d893d7ca75c773ddd107832f13e7b57 Author: Borislav Petkov (AMD) AuthorDate: Tue, 30 Jan 2024 11:59:40 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 09 Apr 2024 18:15:03 +02: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 4b3378c..67dd7c3 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -233,6 +233,10 @@ static void noinline optimize_nops(const u8 * const instr, u8 *buf, size_t len) 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);