Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6988296rwd; Tue, 6 Jun 2023 05:05:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5DiHmxZ6j+k7ktyJKmfQsdrPF52AQRc7+/51vb+FU3O+m22XM4DGH9vZPXu8xZN/llfhcg X-Received: by 2002:a05:6214:5186:b0:626:29d4:9a26 with SMTP id kl6-20020a056214518600b0062629d49a26mr1809668qvb.37.1686053103373; Tue, 06 Jun 2023 05:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686053103; cv=none; d=google.com; s=arc-20160816; b=yVuU7fj7csXXZddv4sZZJ3/068qWO7olpeFp3PPa9xbu9UOQ1mn5lQe3o3fSxHOE9A XFeK3/gvRUyDb006tT1Lf54EEWDOfAhi9FKg8mPXbdHMqcFTVV5i0Lxy3gawmV9382dv fZZnfxaDJ7iyQHEgv3UqYiIxq8Kv+lZnrM6AYPBdAZQpaU4M1Ry7IzcGLza8YMkLG/Gy JlNj6sQ80MNqZtTwmrm773YLvhBkdjyWza+InhSsy0i9DRzpwCTLuCoqRxqYtzDAGiG6 kYBnJxejYBfzTRjRniLEoYBhW5Yck9fAesuUJXTG2S2qmdxVMtxeTVcb/fWtMI+z3Tzd bbuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tEBls2OSEJIobtcDvYYs9iwRT6k9Jkt0k18OxzE6f7w=; b=MwyGosZRhfRUhE5EtC40G8GfagOdRKvPGrxEV06evrhzjiwZw4Nm0ORfCNHw4cTBdY m2z3Z+OBPHoQehEIdjq6fzjiYn63GL6VDangEcCyRikn0gLJNPkbKMbhhhl7ddtorAP7 6zBa6foy5Z+3vYLXlXsHQRnHlhOt2DxXQXsG8aT1TmRE+qFBQ8BSIdbcsul+/II9Z0xe UsfU/CWDcG73OwumzANtiUELPQRHs9thV3UvbV0uyFTB8wOwo/1ysROV3EWw8hTfh8fe Wzdld4KeHrwFkpjvylOQG+c4pe4vVtYKhkpFs4lb51VNe2qEXU0ld5St7JEIt+nofolh BqFA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020ac85bd5000000b003e4e39b3567si5927225qtb.593.2023.06.06.05.04.47; Tue, 06 Jun 2023 05:05:03 -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 S236640AbjFFLf7 (ORCPT + 99 others); Tue, 6 Jun 2023 07:35:59 -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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 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.