From patchwork Wed Jan 8 13:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11323707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACCDF930 for ; Wed, 8 Jan 2020 13:23:40 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8942B2067D for ; Wed, 8 Jan 2020 13:23:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="VIq/bkkq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8942B2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipBIN-0008VT-DW; Wed, 08 Jan 2020 13:22:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipBIM-0008VL-2E for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 13:22:46 +0000 X-Inumbo-ID: f4abd1c4-3219-11ea-b7f4-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f4abd1c4-3219-11ea-b7f4-12813bfff9fa; Wed, 08 Jan 2020 13:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578489766; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GWTtW/iClDApFXi8woALVRB6iPRyx6+Wv9Jkh+1vvNk=; b=VIq/bkkqs9egIgcVrYAVRN3GThiwLxnN7pf4wLekSXXoxcmc+BFLhOrW kUiPblEtdWQCkn7KGPubku2C96OqNHcx5uBfM+nrxhhqtmmD5Mi8XfQ9i S5wSz9TUqZLDM4ExzOJrItmD1HlqIH7zrN/vuwKP9foMpSrrmEBPJsv8Z I=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: HsNKVDwso4S4crO/12IiqoarTcb8SopdsbXAHVmQxfjSNdReOk6qx5nuKyahshuocDK/fmdvVH Qcug2d7/0EIVrOUUVyAYAHalyO7W9PjmgotFpRy2KUZFTiu76KEbY0t3Yzu+gbCI35clCEOUXx 5LTuzepj+adm2Qbf4jJK7bWbYXHflqq3J8osobGdVMs8eH6c9GvTzdolKbS2kTOL1drTqLTmNU uT7qxipnMskD5QhVCh8a6bYJFKSkDZPhWdlvERm4zi6n+DpGmZoq4uHVGiw20fzcJymDtvM2TE SH0= X-SBRS: 2.7 X-MesageID: 10638348 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,410,1571716800"; d="scan'208";a="10638348" From: Andrew Cooper To: Xen-devel Date: Wed, 8 Jan 2020 13:22:41 +0000 Message-ID: <20200108132241.8564-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/boot: Simplify BSS zeroing X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There is no need to load a non-flat %es to zero the BSS. Use sym_esi() instead, which is easier to follow, faster (avoids two segment loads) and doesn't require use of the stack. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné Looking through the code, almost everything that uses sym_fs() would be better using sym_esi(). It is unnecessary extra instruction stream bytes, and AGU hit for every memory operand. Most importantly however, the code is far more simple to reason about when it is consitent about being flat, rather than mixing and matching between flat and non-flat views of the same memory. --- xen/arch/x86/boot/head.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 82395e91dd..1b729c37f8 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -617,16 +617,12 @@ trampoline_setup: jnz 1f /* Initialize BSS (no nasty surprises!). */ - mov $sym_offs(__bss_start),%edi - mov $sym_offs(__bss_end),%ecx - push %fs - pop %es + lea sym_esi(__bss_start), %edi + lea sym_esi(__bss_end), %ecx sub %edi,%ecx xor %eax,%eax shr $2,%ecx rep stosl - push %ds - pop %es 1: /* Interrogate CPU extended features via CPUID. */