From: Arnd Bergmann <arnd@arndb.de>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: xen-devel@lists.xensource.com,
Ian Campbell <Ian.Campbell@citrix.com>,
Julien Grall <julien.grall@linaro.org>,
"xen.org" <ian.jackson@eu.citrix.com>,
Andre Przywara <andre.przywara@calxeda.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Olof Johansson <olof@lixom.net>,
linux-arm-kernel@lists.infradead.org
Subject: Re: Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: Re: [Xen-devel] [xen-unstable test] 21486: tolerable FAIL - PUSHED))
Date: Wed, 13 Nov 2013 20:42:32 +0100 [thread overview]
Message-ID: <201311132042.32725.arnd@arndb.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1311131417030.4714@kaball.uk.xensource.com>
On Wednesday 13 November 2013, Stefano Stabellini wrote:
>
> -#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr), \
> +#ifdef CONFIG_GENERIC_ATOMIC64
> +/* if CONFIG_GENERIC_ATOMIC64 is defined we cannot use the generic
> + * atomic64_xchg function because it is implemented using spin locks.
> + * Here we need proper atomic instructions to read and write memory
> + * shared with the hypervisor.
> + */
> +static inline u64 xen_atomic64_xchg(atomic64_t *ptr, u64 new)
> +{
> + u64 result;
> + unsigned long tmp;
> +
> + smp_mb();
> +
> + __asm__ __volatile__("@ xen_atomic64_xchg\n"
> +"1: ldrexd %0, %H0, [%3]\n"
> +" strexd %1, %4, %H4, [%3]\n"
> +" teq %1, #0\n"
> +" bne 1b"
> + : "=&r" (result), "=&r" (tmp), "+Qo" (ptr->counter)
> + : "r" (&ptr->counter), "r" (new)
> + : "cc");
> +
> + smp_mb();
> +
> + return result;
> +}
> +#else
> +#define xen_atomic64_xchg atomic64_xchg
> +#endif
I would prefer not duplicating this code. Maybe we can instead change
the ARM code to always provide this function under the name of
armv7_atomic64_xchg() and conditionally defining atomic64_xchg
to use it. Let's see if Russell has an opinion on this, or perhaps
a better solution.
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index 62ccf54..d668c3c 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -33,6 +33,14 @@
>
> #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
>
> +/* This is required because cmpxchg only support 32-bits operands on
> + * ARMv6, so if CONFIG_CPU_V6 is defined the cmpxchg implemention will
> + * be limited to 32-bits operands.
> + * However we know for sure that if Linux is running on Xen, the
> + * platform is >= ARMv7, so here we can safely undef CONFIG_CPU_V6.
> + */
> +#undef CONFIG_CPU_V6
> +
> #include <linux/module.h>
> #include <linux/sched.h>
> #include <linux/mm.h>
>
Same here: I'd prefer making this more explicit by changing the cmpxchg
implementation: we could split out the 16-bit cmpxchg case into a separate
function with "armv7" in the name and only call that from the main
cmpxchg() implementations when building an armv7-only kernel, but still
let you call it from Xen code that is known to run only on armv7.
Arnd
next prev parent reply other threads:[~2013-11-13 19:42 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 6:52 [xen-unstable test] 21486: tolerable FAIL - PUSHED xen.org
2013-11-06 9:52 ` Xen osstest on Calxeda midway progress (Was: Re: [xen-unstable test] 21486: tolerable FAIL - PUSHED) Ian Campbell
2013-11-06 11:14 ` Stefano Stabellini
2013-11-06 11:19 ` Ian Campbell
2013-11-06 19:40 ` Stefano Stabellini
2013-11-06 19:57 ` Andre Przywara
2013-11-07 11:14 ` Ian Campbell
2013-11-11 18:42 ` Stefano Stabellini
2013-11-12 9:53 ` Ian Campbell
2013-11-12 12:25 ` Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: Re: [Xen-devel] [xen-unstable test] 21486: tolerable FAIL - PUSHED)) Stefano Stabellini
2013-11-12 13:20 ` Russell King - ARM Linux
2013-11-12 14:38 ` Ian Campbell
2013-11-12 14:44 ` Russell King - ARM Linux
2013-11-12 14:52 ` Ian Campbell
2013-11-12 15:24 ` Michal Simek
2013-11-12 15:39 ` Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: " Russell King - ARM Linux
2013-11-12 15:40 ` Michal Simek
2013-11-12 13:37 ` Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: Re: [Xen-devel] " Arnd Bergmann
2013-11-12 14:35 ` Julien Grall
2013-11-12 14:40 ` Ian Campbell
2013-11-12 18:39 ` Arnd Bergmann
2013-11-12 18:47 ` Stefano Stabellini
2013-11-12 20:08 ` Arnd Bergmann
2013-11-13 10:50 ` Ian Campbell
2013-11-13 17:33 ` Stefano Stabellini
2013-11-13 19:42 ` Arnd Bergmann [this message]
2013-11-14 15:24 ` Stefano Stabellini
2013-11-12 14:41 ` Russell King - ARM Linux
2013-11-12 14:52 ` [Xen-devel] Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: " Julien Grall
2013-11-12 14:57 ` Ian Campbell
2013-11-12 15:24 ` Julien Grall
2013-11-12 15:32 ` Ian Campbell
2013-11-13 12:57 ` Julien Grall
2013-11-12 15:00 ` Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: Re: [Xen-devel] " Stefano Stabellini
2013-11-12 15:16 ` Russell King - ARM Linux
2013-11-12 13:58 ` Xen osstest on Calxeda midway progress (Was: Re: [xen-unstable test] 21486: tolerable FAIL - PUSHED) Julien Grall
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=201311132042.32725.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=Ian.Campbell@citrix.com \
--cc=andre.przywara@calxeda.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=olof@lixom.net \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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).