Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1065492imu; Wed, 16 Jan 2019 12:08:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN7hsig4wRKTz3nkGYJ69NM/AuVbtb642bsFwgAlPtFHktFjq6jocR/Z0lTjx7PoiSDeAdZ7 X-Received: by 2002:a63:4c04:: with SMTP id z4mr10580938pga.312.1547669294244; Wed, 16 Jan 2019 12:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547669294; cv=none; d=google.com; s=arc-20160816; b=08I8t0ZL3SpQc3NNtE9Phnv87OmUUxRy6vMDDqRZLEVAT3B+fnCnGYaQn6H5tUx4bA N+nwPdnHLHk7qs7Xzsj8HPLWeR76pmoZ4VQERcajWBxCO7nB8Jv3tW8Q63Wu/R2krvRc GEhgaO1N4acJXOZzXkovKdtnOSk+AMeQl/EsSVn5iDDjlbstmtmjIEGucCoKK92h5j/w ytAUhOQzHapQ2Mv7xA5oBrxK2FleMKDRrnjI+j6/7L6eX1AiER2q+Kz/T5bQwoXknXZ0 uLWZf7u4qs1DQPRO3S45S5Q2gX070okQOXw3bnKeZxNRmKWTJvSLXbMAmQ719VmtnxQX jxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=A1ylqvMeAnzek2SkH3HEO9TrSUXaL9OTt+6huf/16Ws=; b=LNcFp6cu4G4knhjvhizSmqvlnngn5ibVJGCEWXkkkK/srfInAOTo3H2pCa2aTenUF2 HyW0QxwJZEjDr0yHyhVzPmpEk912a5/PihGOms3uih98Ih5aWe22BUIRX4KQ+Mtsh9MG IVe4Itdzo/oEbLvpwSaRivIkMk402UNhAxM4nKFrWHNzbs7DggJnagfrlQr7nGbH4T7O WXWZgC4XLdhJ7qLg5Jf3B32BwSPlGCKZZl3Dqieoeas24liKbNq43TOADVa0wkYXOBDs VbgUV5vEGwqO9nfxbTPOiUOwqb9grAMF/Pe/NbgbIUjhzlA8jmc+IlDb+xPq8xU0fxj3 VTzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c65si7393734pfa.148.2019.01.16.12.07.54; Wed, 16 Jan 2019 12:08:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389708AbfAPL6V (ORCPT + 99 others); Wed, 16 Jan 2019 06:58:21 -0500 Received: from terminus.zytor.com ([198.137.202.136]:41875 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732248AbfAPL6S (ORCPT ); Wed, 16 Jan 2019 06:58:18 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x0GBvwIe252864 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Jan 2019 03:57:58 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x0GBvspF252860; Wed, 16 Jan 2019 03:57:54 -0800 Date: Wed, 16 Jan 2019 03:57:54 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Borislav Petkov Message-ID: Cc: jpoimboe@redhat.com, x86@kernel.org, thomas.lendacky@amd.com, hpa@zytor.com, mingo@kernel.org, bp@suse.de, linux-kernel@vger.kernel.org, luto@amacapital.net, tglx@linutronix.de, peterz@infradead.org Reply-To: mingo@kernel.org, bp@suse.de, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, luto@amacapital.net, jpoimboe@redhat.com, x86@kernel.org, hpa@zytor.com, thomas.lendacky@amd.com In-Reply-To: <20181211222326.14581-2-bp@alien8.de> References: <20181211222326.14581-2-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/alternatives] x86/alternatives: Add macro comments Git-Commit-ID: 1c1ed4731cc81942a5b25f284a85257573829b9e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_12_24 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1c1ed4731cc81942a5b25f284a85257573829b9e Gitweb: https://git.kernel.org/tip/1c1ed4731cc81942a5b25f284a85257573829b9e Author: Borislav Petkov AuthorDate: Mon, 10 Dec 2018 12:21:48 +0100 Committer: Borislav Petkov CommitDate: Wed, 16 Jan 2019 12:40:07 +0100 x86/alternatives: Add macro comments ... so that when one stares at the .s output, one can find her way around the resulting asm magic. With it, ALTERNATIVE looks like this now: # ALT: oldnstr 661: ... 662: # ALT: padding .skip ... 663: .pushsection .altinstructions,"a" ... .popsection .pushsection .altinstr_replacement, "ax" # ALT: replacement 1 6641: ... 6651: .popsection Merge __OLDINSTR() into OLDINSTR(), while at it. No functional changes. Signed-off-by: Borislav Petkov Cc: Andy Lutomirski Cc: "H. Peter Anvin" Cc: Josh Poimboeuf Cc: Peter Zijlstra Cc: Tom Lendacky Cc: X86 ML Link: https://lkml.kernel.org/r/20181211222326.14581-2-bp@alien8.de --- arch/x86/include/asm/alternative.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index 0660e14690c8..373e2baca6ce 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -94,13 +94,12 @@ static inline int alternatives_text_reserved(void *start, void *end) #define alt_total_slen alt_end_marker"b-661b" #define alt_rlen(num) e_replacement(num)"f-"b_replacement(num)"f" -#define __OLDINSTR(oldinstr, num) \ +#define OLDINSTR(oldinstr, num) \ + "# ALT: oldnstr\n" \ "661:\n\t" oldinstr "\n662:\n" \ + "# ALT: padding\n" \ ".skip -(((" alt_rlen(num) ")-(" alt_slen ")) > 0) * " \ - "((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" - -#define OLDINSTR(oldinstr, num) \ - __OLDINSTR(oldinstr, num) \ + "((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" \ alt_end_marker ":\n" /* @@ -116,7 +115,9 @@ static inline int alternatives_text_reserved(void *start, void *end) * additionally longer than the first replacement alternative. */ #define OLDINSTR_2(oldinstr, num1, num2) \ + "# ALT: oldinstr2\n" \ "661:\n\t" oldinstr "\n662:\n" \ + "# ALT: padding2\n" \ ".skip -((" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")) > 0) * " \ "(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \ alt_end_marker ":\n" @@ -129,8 +130,9 @@ static inline int alternatives_text_reserved(void *start, void *end) " .byte " alt_rlen(num) "\n" /* replacement len */ \ " .byte " alt_pad_len "\n" /* pad len */ -#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \ - b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t" +#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \ + "# ALT: replacement " #num "\n" \ + b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n" /* alternative assembly primitive: */ #define ALTERNATIVE(oldinstr, newinstr, feature) \