From patchwork Fri Apr 15 12:33:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 8850721 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96629C0553 for ; Fri, 15 Apr 2016 12:36:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80A60202EB for ; Fri, 15 Apr 2016 12:36:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1099202E9 for ; Fri, 15 Apr 2016 12:36:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ar2wd-00054I-Sa; Fri, 15 Apr 2016 12:33:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ar2wc-00053f-7f for xen-devel@lists.xenproject.org; Fri, 15 Apr 2016 12:33:54 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 97/F3-04050-1BFD0175; Fri, 15 Apr 2016 12:33:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXSO6nOVXfjfYF wg33TlCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owDhw+yFlwUrHi0/SBzA+MS3i5GLg4hgTYm iffPfjJDON8YJW7t3sQG4WxglFgz5yg7hDORUWL9rF1ADicHm4COxMUvD8FsEQEliXurJjOBF DELnGeSmNZ5mQUkISzgInF4x2Ewm0VAVeLRv/tgNq+Au8S+v9uYQWwJAUWJ7mcT2EBsTgEPid WdTUA1HEDb3CX+TRWBKDGUOP1wG+MERr4FjAyrGDWKU4vKUot0DQ31kooy0zNKchMzc3QNDYz 1clOLixPTU3MSk4r1kvNzNzECg4UBCHYwrv7tdIhRkoNJSZR37l6BcCG+pPyUyozE4oz4otKc 1OJDjDIcHEoSvAb3gHKCRanpqRVpmTnAsIVJS3DwKInwGoKkeYsLEnOLM9MhUqcYFaXEedlBE gIgiYzSPLg2WKxcYpSVEuZlBDpEiKcgtSg3swRV/hWjOAejkjCvOcgUnsy8Erjpr4AWMwEtLn vHC7K4JBEhJdXAKN19bOeJ5qU7J+/bULa5UcLAYJFgh/BqPpt5CVffX2mwjeH52+t1I+7rn7O qR18J37ow/5VW2/UXDdbXdIvm3L5eI/rw3re0BI6fW3h+Cj6OPsu7gc2z7bdYwG+FP5vOZnkv t7+/Q+6BYazk2/rPBmsOv9NaJtceXjLP6dZEv1yHiw5z5jX5iCmxFGckGmoxFxUnAgBV2nAYk AIAAA== X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1460723631!6448912!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34661 invoked from network); 15 Apr 2016 12:33:53 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-9.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Apr 2016 12:33:53 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3FCXkAG026634 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:46 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXjUe013965 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:45 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXgVZ018441; Fri, 15 Apr 2016 12:33:43 GMT Received: from olila.local.net-space.pl (/10.175.160.106) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 Apr 2016 05:33:42 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Fri, 15 Apr 2016 14:33:02 +0200 Message-Id: <1460723596-13261-3-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> References: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: jgross@suse.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v3 02/16] x86: zero BSS using stosl instead of stosb X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Speedup BSS initialization by using stosl instead of stosb. Some may argue that Intel Ivy Bridge and later provide ERMSB feature. This means that "rep stosb" gives better throughput than "rep stosl" on above mentioned CPUs. However, this feature is only available on newer Intel processors and e.g. AMD does not provide it at all. So, stosb will just give real benefits and even beat stosl only on limited number of machines. On the other hand stosl will speedup BSS initialization on all x86 platforms. Hence, use stosl instead of stosb. Additionally, align relevant comment to coding style. Suggested-by: Andrew Cooper Signed-off-by: Daniel Kiper Reviewed-by: Konrad Rzeszutek Wilk --- v3 - suggestions/fixes: - improve comments (suggested by Konrad Rzeszutek Wilk), - improve commit message (suggested by Jan Beulich). --- xen/arch/x86/boot/head.S | 5 +++-- xen/arch/x86/xen.lds.S | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index f3501fd..32a54a0 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -123,12 +123,13 @@ __start: call reloc mov %eax,sym_phys(multiboot_ptr) - /* Initialize BSS (no nasty surprises!) */ + /* Initialize BSS (no nasty surprises!). */ mov $sym_phys(__bss_start),%edi mov $sym_phys(__bss_end),%ecx sub %edi,%ecx + shr $2,%ecx xor %eax,%eax - rep stosb + rep stosl /* Interrogate CPU extended features via CPUID. */ mov $0x80000000,%eax diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 961f48f..6802da1 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -191,6 +191,8 @@ SECTIONS CONSTRUCTORS } :text + /* Align BSS to speedup its initialization. */ + . = ALIGN(4); .bss : { /* BSS */ . = ALIGN(STACK_SIZE); __bss_start = .; @@ -205,6 +207,7 @@ SECTIONS *(.bss.percpu.read_mostly) . = ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end = .; + . = ALIGN(4); __bss_end = .; } :text _end = . ;