Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4958779imu; Tue, 15 Jan 2019 08:47:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN7E5FNn6z6RaBi14DyoM1D3NAnNrYMQHEQxbyBsZv17/735E0kWB21QzudNBw3T4H4OIfKZ X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr5116042plp.34.1547570859946; Tue, 15 Jan 2019 08:47:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547570859; cv=none; d=google.com; s=arc-20160816; b=N+wIT8mXcXioS7/wICnwMEg6f1JCyy2jHf+xznpmL22F1I8VjbYyXrVk7XXERwH1rk voxyFl4N3Y428Rpfee1OwIUS4++5i2XPNINmBf53ucmxgbCzyZF+yYgACxISV8J+ecXJ Oal31r2aM644QcbClOvj6ITF7JBGbQyOdsV4OxcvbNGgwOa5CTicfpX8HDK/YJDV69i2 R2VrzJ72Cfm2gAGUzZIcKj7JmwfMdYindAcXIxucDjh0DlLV4yTNwrycp035paDaWe/Z Dmn5KHe4reAyqAwwarRdqxSVXNB5133DUjgkMVqXK6pU982WTjySdXHlVQMy9BxBpavx XB0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=LG3UConaG8rmg0zpVgD0kcNFbV+N2P8pS/S1+y4+ivg=; b=cSc4amT312jkT0gIHX5n9/PTvRnWaj9uEpcZPFw92LJypMVdPjWWyYyADP8p+XrcB9 enp0jEjWAAdFHWWXRi8SpaSUZ5kjtk5MkVrfuMkI353YXZyUBF4Bc9m3G30TNidBupGV UCXrNL7sv9OjYUF9qiDRHdNbnen3nLPJnsoWC+cjUe1ZLGD5F2k1ksWPLUPi0xSf7MFu df7b9ZGt3VJ4s1vwzgvgUNWahBchhiRAPzNsDzhomeAle+q0ykE/J3vb3VTl2DxoX7Ir 1Fe64/zMg33k+Vhfnw2rOZGowTcrZFZffYUB2YOrlyfu/DGHOXVr/631pnXpEeHbQS4Q c4mg== 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 c191si3858403pfg.72.2019.01.15.08.47.24; Tue, 15 Jan 2019 08:47:39 -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 S1731286AbfAOPzb (ORCPT + 99 others); Tue, 15 Jan 2019 10:55:31 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:42973 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729472AbfAOPza (ORCPT ); Tue, 15 Jan 2019 10:55:30 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gjR3c-0006US-VN; Tue, 15 Jan 2019 16:55:17 +0100 Date: Tue, 15 Jan 2019 16:55:16 +0100 (CET) From: Thomas Gleixner To: Cao jin cc: Ingo Molnar , bp@alien8.de, "H. Peter Anvin" , kirill.shutemov@linux.intel.com, LKML Subject: Re: question about head_64.S In-Reply-To: <6aebbf86-2ba1-c517-dc47-054279daec49@cn.fujitsu.com> Message-ID: References: <6aebbf86-2ba1-c517-dc47-054279daec49@cn.fujitsu.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Jan 2019, Cao jin wrote: > Hi, > I have been digging into this file for a while, and I still have 2 > questions unclear, hope to get your help. > > 1. > At the entry of startup_64, we set all the data segment registers to 0, > according to commit 08da5a2ca("x86_64: Early segment setup for VT"), it > is said to accelerate the decompression under VT. I don't know Intel VT, > but I did test under physical machine and virtual machine(with KVM, and > intel VT enabled in BIOS) with following patch: > > diff --git a/arch/x86/boot/compressed/head_64.S > b/arch/x86/boot/compressed/head_64.S > index 58f6a467f1fa..595f3c300173 100644 > --- a/arch/x86/boot/compressed/head_64.S > +++ b/arch/x86/boot/compressed/head_64.S > @@ -260,12 +260,12 @@ ENTRY(startup_64) > */ > > /* Setup data segments. */ > - xorl %eax, %eax > - movl %eax, %ds > - movl %eax, %es > - movl %eax, %ss > - movl %eax, %fs > - movl %eax, %gs > +// xorl %eax, %eax > +// movl %eax, %ds > +// movl %eax, %es > +// movl %eax, %ss > +// movl %eax, %fs > +// movl %eax, %gs > > I don't see any obvious booting time difference, is there anything I missed? > Also, I don't find explicit document saying we should zero these > registers under VT. The decompressor is position independent code, so all segments have to be set to 0. The patch you mentioned was just adding fs/gs to the list of segments which are cleared and the commit message is not very clear. Though if you dig further down then you find the original version of that patch: commit ffb6017563aa("[PATCH] x86-64: x86_64 - Fix FS/GS registers for VT execution") That one has a proper explantaion. Thanks, tglx