All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Thomas Leonard <talex5@gmail.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com,
	Dave.Scott@eu.citrix.com, anil@recoil.org
Subject: Re: [PATCH ARM v3 7/7] mini-os: initial ARM support
Date: Wed, 11 Jun 2014 21:24:53 +0200	[thread overview]
Message-ID: <20140611192453.GM6816@type.mobile.lan> (raw)
In-Reply-To: <1402482618-15269-8-git-send-email-talex5@gmail.com>

Hello,

I don't know the arm hardware very much, so I can't really review the
arm-specific things, there a just a few things which catched my eyes:

Thomas Leonard, le Wed 11 Jun 2014 11:30:18 +0100, a écrit :
> +#define LOCK_PREFIX ""
> +#define LOCK ""

You don't need to define them, they were meant for x86 code.

> +#define ADDR (*(volatile long *) addr)

You aren't using it, no need to define it either.

> +static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
> +{
> +    //TODO
> +    unsigned volatile long y, tmp = 0;
> +    switch(size){
> +    case 1:
> +#if CPU_EXCLUSIVE_LDST
> +        __asm__ __volatile__("1:ldrexb %0, [%1]\n"
> +            "strexb %3, %2, [%1]\n"
> +            "cmp %3, #1\n"
> +            "beq 1b\n\n"
> +            "dmb\n":"=&r"(y):"r"(ptr), "r"(x), "r"(tmp):"memory");
> +#else
> +        y = (*(char *)ptr) & 0x000000ff;
> +        *((char *)ptr) = (char)x;

The second version is very fragile :) I'd rather put a strong #warning
here, to make sure nobody ever uses that code for anything close to
production level.


> +static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
> +{
> +    //TODO
> +    unsigned long *tmp = (unsigned long *)addr;
> +
> +    int x = tmp[nr >> 5] & (1 << (nr & 0x1f));
> +    tmp[nr >> 5] &= ~(1 << (nr & 0x1f));
> +    return x;
> +}

And this must be atomic, so an atomic version is really needed.

I guess we could perhaps revert to gcc instrinsics by default to save
porting work here.


> +static inline unsigned long __synch_cmpxchg(volatile void *ptr,
> +        unsigned long old,
> +        unsigned long new, int size)
> +{
> +    //TODO:
> +    //BUG();
> +    return 0;
> +}
> +
> +static __inline__ void synch_set_bit(int nr, volatile void * addr)
> +{
> +    //TODO:
> +    set_bit(nr, addr);
> +}

Same story for these


Apart from these, the integration into the existing mini-os looks nice.

Samuel

  reply	other threads:[~2014-06-11 20:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 10:30 [PATCH ARM v3 0/7] mini-os: initial ARM support Thomas Leonard
2014-06-11 10:30 ` [PATCH ARM v3 1/7] mini-os: build fixes Thomas Leonard
2014-06-11 19:02   ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 2/7] mini-os: fixed shutdown thread Thomas Leonard
2014-06-12  9:52   ` Ian Campbell
2014-06-12  9:54     ` Samuel Thibault
2014-06-16 12:48       ` Thomas Leonard
2014-06-16 12:55         ` Ian Campbell
2014-06-11 10:30 ` [PATCH ARM v3 3/7] mini-os: tidied up code Thomas Leonard
2014-06-11 10:30 ` [PATCH ARM v3 4/7] mini-os: moved events code under arch Thomas Leonard
2014-06-11 19:04   ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 5/7] mini-os: switched initial C entry point to arch_init Thomas Leonard
2014-06-11 19:09   ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 6/7] mini-os: don't include queue.h if there's no libc Thomas Leonard
2014-06-11 19:10   ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 7/7] mini-os: initial ARM support Thomas Leonard
2014-06-11 19:24   ` Samuel Thibault [this message]
2014-06-12  7:41     ` Ian Campbell
2014-06-12  7:44       ` Samuel Thibault
2014-06-12  7:53         ` Ian Campbell
2014-06-17 13:47     ` Thomas Leonard
2014-06-17 22:53       ` Samuel Thibault
2014-06-18  7:55         ` Thomas Leonard
2014-06-18  8:21           ` Samuel Thibault
2014-06-12 10:31 ` [PATCH ARM v3 0/7] " Ian Campbell

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=20140611192453.GM6816@type.mobile.lan \
    --to=samuel.thibault@ens-lyon.org \
    --cc=Dave.Scott@eu.citrix.com \
    --cc=anil@recoil.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=talex5@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.