xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Daniel de Graaf <dgdegra@tycho.nsa.gov>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 4/4] drop __get_cpu_var() and __get_cpu_ptr()
Date: Mon, 17 Jun 2019 16:27:02 +0100	[thread overview]
Message-ID: <688a3c9e-6ee2-fb39-c4bf-bc39b41e18f8@arm.com> (raw)
In-Reply-To: <5D03BF8E020000780023861C@prv1-mh.provo.novell.com>

Hi Jan,

On 14/06/2019 16:38, Jan Beulich wrote:
> this_cpu{,_ptr}() are shorter, and have previously been marked as
> preferred in Xen anyway.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <julien.grall@arm.com>

> 
> --- a/xen/common/rcupdate.c
> +++ b/xen/common/rcupdate.c
> @@ -225,7 +225,7 @@ void call_rcu(struct rcu_head *head,
>       head->func = func;
>       head->next = NULL;
>       local_irq_save(flags);
> -    rdp = &__get_cpu_var(rcu_data);
> +    rdp = &this_cpu(rcu_data);
>       *rdp->nxttail = head;
>       rdp->nxttail = &head->next;
>       if (unlikely(++rdp->qlen > qhimark)) {
> @@ -409,7 +409,7 @@ static void __rcu_process_callbacks(stru
>   
>   static void rcu_process_callbacks(void)
>   {
> -    __rcu_process_callbacks(&rcu_ctrlblk, &__get_cpu_var(rcu_data));
> +    __rcu_process_callbacks(&rcu_ctrlblk, &this_cpu(rcu_data));
>   }
>   
>   static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp)
> --- a/xen/include/asm-arm/percpu.h
> +++ b/xen/include/asm-arm/percpu.h
> @@ -17,12 +17,12 @@ void percpu_init_areas(void);
>   
>   #define per_cpu(var, cpu)  \
>       (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
> -#define __get_cpu_var(var) \
> +#define this_cpu(var) \
>       (*RELOC_HIDE(&per_cpu__##var, READ_SYSREG(TPIDR_EL2)))
>   
>   #define per_cpu_ptr(var, cpu)  \
>       (*RELOC_HIDE(var, __per_cpu_offset[cpu]))
> -#define __get_cpu_ptr(var) \
> +#define this_cpu_ptr(var) \
>       (*RELOC_HIDE(var, READ_SYSREG(TPIDR_EL2)))
>   
>   #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
> --- a/xen/include/asm-x86/percpu.h
> +++ b/xen/include/asm-x86/percpu.h
> @@ -15,12 +15,12 @@ void percpu_init_areas(void);
>   /* var is in discarded region: offset to particular copy we want */
>   #define per_cpu(var, cpu)  \
>       (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
> -#define __get_cpu_var(var) \
> +#define this_cpu(var) \
>       (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
>   
>   #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
>   
> -#define __get_cpu_ptr(var) \
> +#define this_cpu_ptr(var) \
>       (*RELOC_HIDE(var, get_cpu_info()->per_cpu_offset))
>   
>   #define per_cpu_ptr(var, cpu)  \
> --- a/xen/include/xen/percpu.h
> +++ b/xen/include/xen/percpu.h
> @@ -13,11 +13,6 @@
>   #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
>   	__DEFINE_PER_CPU(type, _##name, .read_mostly)
>   
> -/* Preferred on Xen. Also see arch-defined per_cpu(). */
> -#define this_cpu(var)    __get_cpu_var(var)
> -
> -#define this_cpu_ptr(ptr)    __get_cpu_ptr(ptr)
> -
>   #define get_per_cpu_var(var)  (per_cpu__##var)
>   
>   /* Linux compatibility. */
> --- a/xen/xsm/flask/avc.c
> +++ b/xen/xsm/flask/avc.c
> @@ -57,9 +57,9 @@ const struct selinux_class_perm selinux_
>   #define AVC_CACHE_RECLAIM        16
>   
>   #ifdef CONFIG_XSM_FLASK_AVC_STATS
> -#define avc_cache_stats_incr(field)                 \
> -do {                                \
> -    __get_cpu_var(avc_cache_stats).field++;        \
> +#define avc_cache_stats_incr(field)    \
> +do {                                   \
> +    this_cpu(avc_cache_stats).field++; \
>   } while (0)
>   #else
>   #define avc_cache_stats_incr(field)    do {} while (0)
> 
> 
> 
> 

-- 
Julien Grall

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

  reply	other threads:[~2019-06-17 15:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14 15:33 [Xen-devel] [PATCH 0/4] x86 MCE adjustments for AMD / general per-CPU accessor cleanup Jan Beulich
2019-06-14 15:35 ` [Xen-devel] [PATCH 1/4] x86/mcheck: allow varying bank counts per CPU Jan Beulich
2019-06-21 17:45   ` Andrew Cooper
2019-06-14 15:37 ` [Xen-devel] [PATCH 2/4] x86/mcheck: replace remaining uses of __get_cpu_var() Jan Beulich
2019-06-21 17:46   ` Andrew Cooper
2019-06-14 15:37 ` [Xen-devel] [PATCH 3/4] x86: " Jan Beulich
2019-06-21 17:47   ` Andrew Cooper
2019-06-14 15:38 ` [Xen-devel] [PATCH 4/4] drop __get_cpu_var() and __get_cpu_ptr() Jan Beulich
2019-06-17 15:27   ` Julien Grall [this message]
2019-06-18 18:00   ` Daniel De Graaf
2019-06-21 17:49   ` 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=688a3c9e-6ee2-fb39-c4bf-bc39b41e18f8@arm.com \
    --to=julien.grall@arm.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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).