From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98514C77B7A for ; Tue, 6 Jun 2023 11:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232476AbjFFLgA (ORCPT ); Tue, 6 Jun 2023 07:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236530AbjFFLfw (ORCPT ); Tue, 6 Jun 2023 07:35:52 -0400 Received: from out0-200.mail.aliyun.com (out0-200.mail.aliyun.com [140.205.0.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C7010D3 for ; Tue, 6 Jun 2023 04:35:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047192;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---.TMrLcZL_1686051336; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.TMrLcZL_1686051336) by smtp.aliyun-inc.com; Tue, 06 Jun 2023 19:35:37 +0800 Date: Tue, 06 Jun 2023 19:35:36 +0800 From: "Hou Wenlong" To: Nadav Amit Cc: "Juergen Gross" , "kernel list" , "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "srivatsa@csail.mit.edu" , "Alexey Makhalov" , "Pv-drivers" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , "X86 ML" , "H. Peter Anvin" , "Peter Zijlstra" , "Song Liu" , "Arnd Bergmann" , "virtualization@lists.linux-foundation.org" Subject: Re: [PATCH RFC 13/43] x86/paravirt: Use relative reference for original instruction Message-ID: <20230606113536.GA106605@k08j02272.eu95sqa> References: <44e2fb4d-151c-dba9-9cb8-0d99c3668a6f@suse.com> <4D9D12CE-87A7-485F-B8F6-A9F77156C372@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D9D12CE-87A7-485F-B8F6-A9F77156C372@vmware.com> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 05, 2023 at 02:40:54PM +0800, Nadav Amit wrote: > > > > On Jun 1, 2023, at 2:29 AM, Juergen Gross wrote: > > > > On 28.04.23 11:50, Hou Wenlong wrote: > >> Similar to the alternative patching, use relative reference for original > >> instruction rather than absolute one, which saves 8 bytes for one entry > >> on x86_64. And it could generate R_X86_64_PC32 relocation instead of > >> R_X86_64_64 relocation, which also reduces relocation metadata on > >> relocatable builds. And the alignment could be hard coded to be 4 now. > >> Signed-off-by: Hou Wenlong > >> Cc: Thomas Garnier > >> Cc: Lai Jiangshan > >> Cc: Kees Cook > > > > Reviewed-by: Juergen Gross > > > > I think this patch should be taken even without the series. > > It looks good to me, I am just not sure what the alignment is needed > at all. > > Why not to make the struct __packed (like struct alt_instr) and get rid > of all the .align directives? Am I missing something? Yes, making the struct __packed can save more space. If I understand correctly, it could be done even without this patch but it may lead to misaligned memory access. However, it seems to not matter as I didn't find any related log for packing struct alt_instr. I can do such things if needed. Thanks.