From patchwork Fri Jun 9 09:45:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 105525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp849223vqr; Fri, 9 Jun 2023 03:37:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ562oBOnRFQtCzW++aksO3vl2HD4bZZX2L73FiKwOW8ntecI4g41DyRXIbhYV0LT5hzIkIV X-Received: by 2002:a05:6a00:150d:b0:658:26a8:9d9e with SMTP id q13-20020a056a00150d00b0065826a89d9emr1061124pfu.29.1686307028063; Fri, 09 Jun 2023 03:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686307028; cv=none; d=google.com; s=arc-20160816; b=w1OpgxVNauclkWJfl5kFjTUCnAo3g5sO5mqFRER64OuPpKwaXQDCC1KqDBHWD+Uznk vcJO8+xjRRuvnJ0e9hyUvvB1yDk1umsh6BaZ5YqmPjRgBxeC5eFQVYsrypUkh49jH2zG I6VRnCjd2XUDTyR6yyOUaInpbAD9N9ifBnIS8ZuY87clPoXTPdGUhp1PuWPBrVwmHUqt qsDu1dXsoubIU1Djy69DRQzu0f+YSODUrVNRZWppEC1Fci/DvJUyJdxyHBRZ3fQUAVBg L5t/yj9b2cp0QrxKzEDdlldBXe96F+NN4ry67dyGnRddEk8QttEbpZi7cwB/sR8uzLQG PaWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lqe8eLHR23umrKPNtnDPgUkdk3HL1OVKdbOpqIANkrY=; b=RB9twoHZbiVKQuwwCAimJzEHwu5M5wG3g9Uq1RFNb+HVd1fT/RgKx7Vq8ou/A8VBy1 SntreYqjd7o6PguDK266RiVbFBXOK3QNarfXPkj1MhT6tsaKqRrqmJqLlODjogGa00g+ xXsCJoXE5Su2NC+lstzy1TJ6uzbnS5kaBIO1y5HIsV9/Q5QfuxJymeeNjWVmDBS7vtxB Zm0waJEkcg+/HYLjbhm6nouRJPFH3y3JeRvgQ28uQSXwZzbEBMNKp1Qd/XxhOOxtEzIs iYaLlv5YNL2rzK81Ut+g6WbBCEpoJyxgEiQZMltdQjjNb9de6Ut/MvxNV6DUhtbCV2e9 AScw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d192-20020a6336c9000000b00534784002afsi2362217pga.807.2023.06.09.03.36.53; Fri, 09 Jun 2023 03:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241593AbjFIJz6 (ORCPT + 99 others); Fri, 9 Jun 2023 05:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241571AbjFIJzL (ORCPT ); Fri, 9 Jun 2023 05:55:11 -0400 Received: from out0-209.mail.aliyun.com (out0-209.mail.aliyun.com [140.205.0.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2AF97EC5 for ; Fri, 9 Jun 2023 02:46:47 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047198;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---.TPYicTQ_1686303990; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.TPYicTQ_1686303990) by smtp.aliyun-inc.com; Fri, 09 Jun 2023 17:46:31 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Lai Jiangshan" , "Hou Wenlong" , "Nadav Amit" , "Juergen Gross" , "Ajay Kaher" , "Alexey Makhalov" , "VMware PV-Drivers Reviewers" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , Subject: [PATCH 2/2] x86/paravirt: Make the struct paravirt_patch_site packed Date: Fri, 09 Jun 2023 17:45:32 +0800 Message-Id: <6dcb20159ded36586c5f7f2ae159e4e030256627.1686301237.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <9e6053107fbaabc0d33e5d2865c5af2c67ec9925.1686301237.git.houwenlong.hwl@antgroup.com> References: <9e6053107fbaabc0d33e5d2865c5af2c67ec9925.1686301237.git.houwenlong.hwl@antgroup.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768221078413979001?= X-GMAIL-MSGID: =?utf-8?q?1768221078413979001?= Similar to struct alt_instr, make the struct paravirt_patch_site packed and get rid of all the .align directives. This could save 2 bytes for one entry on X86_64. Suggested-by: Nadav Amit Signed-off-by: Hou Wenlong Reviewed-by: Juergen Gross --- arch/x86/include/asm/paravirt.h | 2 -- arch/x86/include/asm/paravirt_types.h | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 2350ceb43db0..3e5ccacb3893 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -747,11 +747,9 @@ extern void default_banner(void); ops; \ 772:; \ .pushsection .parainstructions,"a"; \ - .align 4; \ .long 771b-.; \ .byte ptype; \ .byte 772b-771b; \ - .align 4; \ .popsection diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 982a234f5a06..da0547bcd068 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -8,7 +8,7 @@ struct paravirt_patch_site { s32 instr_offset; /* original instructions */ u8 type; /* type of this instruction */ u8 len; /* length of original instruction */ -}; +} __packed; /* Lazy mode for batching updates / context switch */ enum paravirt_lazy_mode { @@ -270,11 +270,9 @@ extern struct paravirt_patch_template pv_ops; #define _paravirt_alt(insn_string, type) \ "771:\n\t" insn_string "\n" "772:\n" \ ".pushsection .parainstructions,\"a\"\n" \ - " .align 4\n" \ " .long 771b-.\n" \ " .byte " type "\n" \ " .byte 772b-771b\n" \ - " .align 4\n" \ ".popsection\n" /* Generate patchable code, with the default asm parameters. */