From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 5/5] x86/percpu: Misc cleanup
Date: Tue, 29 Aug 2017 12:19:16 +0100 [thread overview]
Message-ID: <1504005556-30394-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1504005556-30394-1-git-send-email-andrew.cooper3@citrix.com>
* Drop unnecessary brackets.
* Add spaces around binary operators.
* Insert appropriate blank lines.
* Insert a local variable block at the end.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
xen/arch/x86/percpu.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c
index 1d3bc2e..c9997b7 100644
--- a/xen/arch/x86/percpu.c
+++ b/xen/arch/x86/percpu.c
@@ -13,11 +13,12 @@ unsigned long __per_cpu_offset[NR_CPUS];
* context of PV guests.
*/
#define INVALID_PERCPU_AREA (0x8000000000000000L - (long)__per_cpu_start)
-#define PERCPU_ORDER (get_order_from_bytes(__per_cpu_data_end-__per_cpu_start))
+#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start)
void __init percpu_init_areas(void)
{
unsigned int cpu;
+
for ( cpu = 1; cpu < NR_CPUS; cpu++ )
__per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
}
@@ -25,12 +26,16 @@ void __init percpu_init_areas(void)
static int init_percpu_area(unsigned int cpu)
{
char *p;
+
if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
return -EBUSY;
+
if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
return -ENOMEM;
+
memset(p, 0, __per_cpu_data_end - __per_cpu_start);
__per_cpu_offset[cpu] = p - __per_cpu_start;
+
return 0;
}
@@ -45,6 +50,7 @@ static void _free_percpu_area(struct rcu_head *head)
struct free_info *info = container_of(head, struct free_info, rcu);
unsigned int cpu = info->cpu;
char *p = __per_cpu_start + __per_cpu_offset[cpu];
+
free_xenheap_pages(p, PERCPU_ORDER);
__per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
}
@@ -52,6 +58,7 @@ static void _free_percpu_area(struct rcu_head *head)
static void free_percpu_area(unsigned int cpu)
{
struct free_info *info = &per_cpu(free_info, cpu);
+
info->cpu = cpu;
call_rcu(&info->rcu, _free_percpu_area);
}
@@ -86,6 +93,16 @@ static struct notifier_block cpu_percpu_nfb = {
static int __init percpu_presmp_init(void)
{
register_cpu_notifier(&cpu_percpu_nfb);
+
return 0;
}
presmp_initcall(percpu_presmp_init);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-29 11:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 11:19 [PATCH 0/5] x86: Misc cleanup and improvements Andrew Cooper
2017-08-29 11:19 ` [PATCH 1/5] x86/pv: Switch {fill, zap}_ro_mpt() to using mfn_t Andrew Cooper
2017-08-29 11:52 ` Tim Deegan
2017-08-29 12:01 ` George Dunlap
2017-08-29 12:17 ` Wei Liu
2017-08-29 14:00 ` Jan Beulich
2017-08-29 11:19 ` [PATCH 2/5] x86/pv: map_ldt_shadow_page() cleanup Andrew Cooper
2017-08-29 12:35 ` Wei Liu
2017-08-29 14:14 ` Jan Beulich
2017-08-29 14:54 ` Andrew Cooper
2017-08-29 15:57 ` [PATCH v2 " Andrew Cooper
2017-08-30 8:21 ` Jan Beulich
2017-08-29 11:19 ` [PATCH 3/5] x86/pv: Consistently use typesafe helpers in all files Andrew Cooper
2017-08-29 13:39 ` Wei Liu
2017-08-29 14:19 ` Jan Beulich
2017-08-29 11:19 ` [PATCH 4/5] x86/pv: Simplify access to the LDT/GDT ptes Andrew Cooper
2017-08-29 13:43 ` Wei Liu
2017-08-29 14:23 ` Jan Beulich
2017-08-29 11:19 ` Andrew Cooper [this message]
2017-08-29 13:44 ` [PATCH 5/5] x86/percpu: Misc cleanup Wei Liu
2017-08-29 14:24 ` Jan Beulich
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=1504005556-30394-6-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.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).