[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 10/15] xen/arm64: port Linux's arm64 cmpxchg.h to Xen



Hi Ash,

On 11/11/2020 21:51, Ash Wilding wrote:
From: Ash Wilding <ash.j.wilding@xxxxxxxxx>

  - s/arch_xchg/xchg/

  - s/arch_cmpxchg/cmpxchg/

  - Replace calls to BUILD_BUG() with calls to __bad_cmpxchg() as we
    don't currently have a BUILD_BUG() macro in Xen and this will
    equivalently cause a link-time error.

How complex would it be to import BUILD_BUG() in Xen? Would the following work:

#define BUILD_BUG() BUILD_BUG_ON(1)


  - Replace calls to VM_BUG_ON() with BUG_ON() as we don't currently
    have a VM_BUG_ON() macro in Xen.

  - Pull in the timeout variants of cmpxchg from the original Xen
    arm64 cmpxchg.h as these are required for guest atomics and are
    not provided by Linux. Note these are always using LL/SC so we
    should ideally write LSE versions at some point.

The main advantage of LSE support in Xen is to drop the timeout helpers. I guess this would require a bit more thought to still allow inlining.

In any case, it may make sense to move them in a separate headers so you don't have to remove/add them. Anyway, I would be happy with the current approach as well.

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.