xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/2] x86/smp: Misc cleanup
Date: Fri, 18 Aug 2017 11:27:27 +0100	[thread overview]
Message-ID: <1503052047-14722-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1503052047-14722-1-git-send-email-andrew.cooper3@citrix.com>

 * Delete trailing whitespace
 * Switch to using mfn_t for mfn_to_page()/page_to_mfn()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/smpboot.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8d91f6c..4d45f42 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -4,17 +4,17 @@
  * This inherits a great deal from Linux's SMP boot code:
  *  (c) 1995 Alan Cox, Building #3 <alan@redhat.com>
  *  (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
@@ -46,6 +46,12 @@
 #include <mach_wakecpu.h>
 #include <smpboot_hooks.h>
 
+/* Override macros from asm/mm.h to make them work with mfn_t */
+#undef mfn_to_page
+#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn))
+#undef page_to_mfn
+#define page_to_mfn(pg) _mfn(__page_to_mfn(pg))
+
 #define setup_trampoline()    (bootsym_phys(trampoline_realmode_entry))
 
 unsigned long __read_mostly trampoline_phys;
@@ -307,14 +313,14 @@ void start_secondary(void *unused)
      * Just as during early bootstrap, it is convenient here to disable
      * spinlock checking while we have IRQs disabled. This allows us to
      * acquire IRQ-unsafe locks when it would otherwise be disallowed.
-     * 
+     *
      * It is safe because the race we are usually trying to avoid involves
      * a group of CPUs rendezvousing in an IPI handler, where one cannot
      * join because it is spinning with IRQs disabled waiting to acquire a
      * lock held by another in the rendezvous group (the lock must be an
      * IRQ-unsafe lock since the CPU took the IPI after acquiring it, and
      * hence had IRQs enabled). This is a deadlock scenario.
-     * 
+     *
      * However, no CPU can be involved in rendezvous until it is online,
      * hence no such group can be waiting for this CPU until it is
      * visible in cpu_online_map. Hence such a deadlock is not possible.
@@ -423,8 +429,8 @@ static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
     else if ( tboot_in_measured_env() )
     {
         /*
-         * With tboot AP is actually spinning in a mini-guest before 
-         * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit, 
+         * With tboot AP is actually spinning in a mini-guest before
+         * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit,
          * update VMCS to tracking SIPIs and VMResume.
          *
          * While AP is in root mode handling the INIT the CPU will drop
@@ -596,7 +602,7 @@ unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn)
     BUILD_BUG_ON(STUBS_PER_PAGE & (STUBS_PER_PAGE - 1));
 
     if ( *mfn )
-        pg = mfn_to_page(*mfn);
+        pg = mfn_to_page(_mfn(*mfn));
     else
     {
         nodeid_t node = cpu_to_node(cpu);
@@ -610,7 +616,7 @@ unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn)
     }
 
     stub_va = XEN_VIRT_END - (cpu + 1) * PAGE_SIZE;
-    if ( map_pages_to_xen(stub_va, page_to_mfn(pg), 1,
+    if ( map_pages_to_xen(stub_va, mfn_x(page_to_mfn(pg)), 1,
                           PAGE_HYPERVISOR_RX | MAP_SMALL_PAGES) )
     {
         if ( !*mfn )
@@ -618,7 +624,7 @@ unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn)
         stub_va = 0;
     }
     else if ( !*mfn )
-        *mfn = page_to_mfn(pg);
+        *mfn = mfn_x(page_to_mfn(pg));
 
     return stub_va;
 }
@@ -652,8 +658,8 @@ static void cpu_smpboot_free(unsigned int cpu)
 
     if ( per_cpu(stubs.addr, cpu) )
     {
-        unsigned long mfn = per_cpu(stubs.mfn, cpu);
-        unsigned char *stub_page = map_domain_page(_mfn(mfn));
+        mfn_t mfn = _mfn(per_cpu(stubs.mfn, cpu));
+        unsigned char *stub_page = map_domain_page(mfn);
         unsigned int i;
 
         memset(stub_page + STUB_BUF_CPU_OFFS(cpu), 0xcc, STUB_BUF_SIZE);
@@ -871,7 +877,7 @@ remove_siblinginfo(int cpu)
         if ( cpumask_weight(per_cpu(cpu_sibling_mask, cpu)) == 1 )
             cpu_data[sibling].booted_cores--;
     }
-   
+
     for_each_cpu(sibling, per_cpu(cpu_sibling_mask, cpu))
         cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, sibling));
     cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-08-18 10:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 10:27 [PATCH 1/2] x86/mm: Override mfn_to_page() and page_to_mfn() to use mfn_t Andrew Cooper
2017-08-18 10:27 ` Andrew Cooper [this message]
2017-08-18 11:52   ` [PATCH 2/2] x86/smp: Misc cleanup Wei Liu
2017-08-18 12:17   ` Jan Beulich
2017-08-18 11:51 ` [PATCH 1/2] x86/mm: Override mfn_to_page() and page_to_mfn() to use mfn_t Wei Liu
2017-08-18 12:16 ` Jan Beulich
2017-08-18 12:17   ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503052047-14722-2-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).