All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Joe Slater <joe.slater@windriver.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [PATCH 1/2] lockable: use QLNULL for a null lockable
Date: Thu, 4 Jun 2020 11:22:28 -0500	[thread overview]
Message-ID: <dba303d1-5e24-d9e6-7e61-dacbb486c7c0@redhat.com> (raw)
In-Reply-To: <20200603224903.26268-2-joe.slater@windriver.com>

On 6/3/20 5:49 PM, Joe Slater wrote:
> Allows us to build with -Og and optimizations that
> do not clean up dead-code.
> 
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> 
> to be squished
> 
> Signed-off-by: Joe Slater <joe.slater@windriver.com>

These last two lines can be elided (looks like a rebase mishap).

> ---
>   block/block-backend.c          | 4 ++--
>   block/block-copy.c             | 2 +-
>   block/mirror.c                 | 5 +++--
>   fsdev/qemu-fsdev-throttle.c    | 6 +++---
>   hw/9pfs/9p.c                   | 2 +-
>   include/qemu/lockable.h        | 3 +++
>   util/qemu-co-shared-resource.c | 2 +-
>   7 files changed, 14 insertions(+), 10 deletions(-)
> 

If you use scripts/git.orderfile, your diff would show with the .h 
changes first, which are arguably the meat of this patch.

> +++ b/block/mirror.c
> @@ -28,6 +28,7 @@
>   #define MAX_IO_BYTES (1 << 20) /* 1 Mb */
>   #define DEFAULT_MIRROR_BUF_SIZE (MAX_IN_FLIGHT * MAX_IO_BYTES)
>   
> +
>   /* The mirroring buffer is a list of granularity-sized chunks.
>    * Free chunks are organized in a list.
>    */

This hunk looks spurious.


> +++ b/include/qemu/lockable.h
> @@ -24,6 +24,9 @@ struct QemuLockable {
>       QemuLockUnlockFunc *unlock;
>   };
>   
> +#define QLNULL ((QemuLockable *)0)

Why not ((QemuLocakable *)NULL) ?
Why no comments why this type-safe NULL is useful?

> +
> +
>   /* This function gives an error if an invalid, non-NULL pointer type is passed
>    * to QEMU_MAKE_LOCKABLE.  For optimized builds, we can rely on dead-code elimination
>    * from the compiler, and give the errors already at link time.
> diff --git a/util/qemu-co-shared-resource.c b/util/qemu-co-shared-resource.c
> index 1c83cd9..7423ea4 100644
> --- a/util/qemu-co-shared-resource.c
> +++ b/util/qemu-co-shared-resource.c
> @@ -64,7 +64,7 @@ void coroutine_fn co_get_from_shres(SharedResource *s, uint64_t n)
>   {
>       assert(n <= s->total);
>       while (!co_try_get_from_shres(s, n)) {
> -        qemu_co_queue_wait(&s->queue, NULL);
> +        qemu_co_queue_wait(&s->queue, QLNULL);

It looks like your macro is added to give the compiler some type-safety, 
but it is not obvious how it matters from just the commit message, 
without also looking at patch 2/2.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-06-04 16:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 22:49 [PATCH 0/2] Use QLNULL for null lockable Joe Slater
2020-06-03 22:49 ` [PATCH 1/2] lockable: use QLNULL for a " Joe Slater
2020-06-04 16:22   ` Eric Blake [this message]
2020-06-03 22:49 ` [PATCH 2/2] lockable: do not rely on optimization for null lockables Joe Slater
2020-06-04 16:31   ` Eric Blake

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=dba303d1-5e24-d9e6-7e61-dacbb486c7c0@redhat.com \
    --to=eblake@redhat.com \
    --cc=joe.slater@windriver.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@nongnu.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.