From nobody Thu Mar 28 17:29:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1562860286; cv=none; d=zoho.com; s=zohoarc; b=E7qrcVNAknavT+75YL6s8F8dcMGvBYkHYfuAEsHvFNtJnSm3090ngAWWMDDXDiPYTGvcx2pcm0UynvmuOtSE6E1JCCOaYdCMx8cOS/0PyL6991/nxfi5NWBUIK5imG8fAktrFggPhKB3ZxH+8JyEVMO3a8iwFITHa/JOKNIrgOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562860286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=FDgVIN9VcCuEsL5nsIyDQm7TfUbQ23q/kV588rNdHT8=; b=SPLvBcC8u/ln/smyape5wADFfyRCwQyRQDwxHGEMFhFTJAcGrc6FPOygxCZmHL03o67d5C8W3TjK5zEckJmWPnt69+IN/HGcJCPBlRGJ0eDF8gUA6+XpSRhLZalf0XePaTHOXjvtdU19JG55UeSoaQ1Du5C9TAkUwn/XNk+i/DI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1562860286292639.8763654158957; Thu, 11 Jul 2019 08:51:26 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hlbKU-0003t7-Mz; Thu, 11 Jul 2019 15:49:54 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hlbKT-0003t2-My for xen-devel@lists.xenproject.org; Thu, 11 Jul 2019 15:49:53 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 849d4b12-a3f3-11e9-8980-bc764e045a96; Thu, 11 Jul 2019 15:49:51 +0000 (UTC) X-Inumbo-ID: 849d4b12-a3f3-11e9-8980-bc764e045a96 Authentication-Results: esa3.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 (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 ~all" Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: qRofl1I6Qr4oNNray+oNlL0zs7TGMWkcug7SQqsqG192mBS6UsNNIOHt2JoyHT5NE8yGtzub3X pYT+6xzMT4wwaX1Ah9pheVvrs8rCv7vXo7L2yvb9F5ufZuqWKdVRbop8ULdMNkZ+2ADJ8rUH6W 7U/rVV840AS9pD/D7ffcqNTgGQKbppyiXyBt14/lEDWcdbhviehw9dVMe8ObY7nkBP0SPE5q2n 02ZvTrYIyurAztvqwbkxR9kedohzFSy2eTmyRt3CmwTrPkIa2TanGDqAj8ytb6Sxise7+iAxY1 F8g= X-SBRS: 2.7 X-MesageID: 2866608 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,479,1557201600"; d="scan'208";a="2866608" From: Andrew Cooper To: Xen-devel Date: Thu, 11 Jul 2019 16:49:45 +0100 Message-ID: <20190711154945.7322-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/smpboot: Remove redundant order calculations 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=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The GDT and IDT allocations are all order 0, and not going to change. Use an explicit 0, instead of calling get_order_from_pages(). This allows for the removal of the 'order' local parameter in both cpu_smpboot_{alloc,free}(). While making this adjustment, rearrange cpu_smpboot_free() to fold the two "if ( remove )" clauses. There is no explicit requirements for the order of free()s. No practical change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/smpboot.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 004285d14c..65e9ceeece 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -902,7 +902,7 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) */ static void cpu_smpboot_free(unsigned int cpu, bool remove) { - unsigned int order, socket =3D cpu_to_socket(cpu); + unsigned int socket =3D cpu_to_socket(cpu); struct cpuinfo_x86 *c =3D cpu_data; =20 if ( cpumask_empty(socket_cpumask[socket]) ) @@ -944,16 +944,12 @@ static void cpu_smpboot_free(unsigned int cpu, bool r= emove) free_domheap_page(mfn_to_page(mfn)); } =20 - order =3D get_order_from_pages(NR_RESERVED_GDT_PAGES); - if ( remove ) - FREE_XENHEAP_PAGES(per_cpu(gdt_table, cpu), order); - - free_xenheap_pages(per_cpu(compat_gdt_table, cpu), order); + FREE_XENHEAP_PAGE(per_cpu(compat_gdt_table, cpu)); =20 if ( remove ) { - order =3D get_order_from_bytes(IDT_ENTRIES * sizeof(idt_entry_t)); - FREE_XENHEAP_PAGES(idt_tables[cpu], order); + FREE_XENHEAP_PAGE(per_cpu(gdt_table, cpu)); + FREE_XENHEAP_PAGE(idt_tables[cpu]); =20 if ( stack_base[cpu] ) { @@ -965,7 +961,7 @@ static void cpu_smpboot_free(unsigned int cpu, bool rem= ove) =20 static int cpu_smpboot_alloc(unsigned int cpu) { - unsigned int i, order, memflags =3D 0; + unsigned int i, memflags =3D 0; nodeid_t node =3D cpu_to_node(cpu); seg_desc_t *gdt; unsigned long stub_page; @@ -980,8 +976,7 @@ static int cpu_smpboot_alloc(unsigned int cpu) goto out; memguard_guard_stack(stack_base[cpu]); =20 - order =3D get_order_from_pages(NR_RESERVED_GDT_PAGES); - gdt =3D per_cpu(gdt_table, cpu) ?: alloc_xenheap_pages(order, memflags= ); + gdt =3D per_cpu(gdt_table, cpu) ?: alloc_xenheap_pages(0, memflags); if ( gdt =3D=3D NULL ) goto out; per_cpu(gdt_table, cpu) =3D gdt; @@ -991,7 +986,7 @@ static int cpu_smpboot_alloc(unsigned int cpu) BUILD_BUG_ON(NR_CPUS > 0x10000); gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a =3D cpu; =20 - per_cpu(compat_gdt_table, cpu) =3D gdt =3D alloc_xenheap_pages(order, = memflags); + per_cpu(compat_gdt_table, cpu) =3D gdt =3D alloc_xenheap_pages(0, memf= lags); if ( gdt =3D=3D NULL ) goto out; per_cpu(compat_gdt_table_l1e, cpu) =3D @@ -999,9 +994,8 @@ static int cpu_smpboot_alloc(unsigned int cpu) memcpy(gdt, boot_cpu_compat_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SI= ZE); gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a =3D cpu; =20 - order =3D get_order_from_bytes(IDT_ENTRIES * sizeof(idt_entry_t)); if ( idt_tables[cpu] =3D=3D NULL ) - idt_tables[cpu] =3D alloc_xenheap_pages(order, memflags); + idt_tables[cpu] =3D alloc_xenheap_pages(0, memflags); if ( idt_tables[cpu] =3D=3D NULL ) goto out; memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t)); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel