qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Eric Blake <eblake@redhat.com>,
	keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com,
	pbonzini@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass alignment into dma-helpers
Date: Tue, 11 Oct 2016 11:47:48 -0400	[thread overview]
Message-ID: <3fa3f1f8-2b7e-8b1f-1272-ff3b3647e0d3@redhat.com> (raw)
In-Reply-To: <ab2a2471-d428-f82d-cd89-c6c5dcba44ed@ilande.co.uk>



On 10/10/2016 03:23 PM, Mark Cave-Ayland wrote:
> On 10/10/16 17:34, Eric Blake wrote:
>
>> On 10/09/2016 11:43 AM, Mark Cave-Ayland wrote:
>>> The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not
>>> necessarily the case for all platforms. Use this as the default alignment for
>>> all current callers.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> ---
>>
>>> @@ -160,8 +161,8 @@ static void dma_blk_cb(void *opaque, int ret)
>>>          return;
>>>      }
>>>
>>> -    if (dbs->iov.size & ~BDRV_SECTOR_MASK) {
>>> -        qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK);
>>> +    if (dbs->iov.size & (dbs->align - 1)) {
>>> +        qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & (dbs->align - 1));
>>
>> Would it be any smarter to use osdep.h's QEMU_IS_ALIGNED(dbs->iov.size,
>> dbs->align) and QEMU_ALIGN_DOWN(dbs->iov.size, dbs->align)?
>> Semantically it is the same, but the macros make it obvious what the
>> bit-twiddling is doing.
>>
>> Unless you think that needs a tweak,
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> I can't say I feel too strongly about it since there are plenty of other
> examples of this style in the codebase, so I'm happy to go with whatever
> John/Paolo are most happy with.
>
>
> ATB,
>
> Mark.
>

I can't pretend I am consistent, but when in doubt use the macro. Not 
worth a respin IMO, but I think this falls out of my jurisdiction :)

Acked-by: John Snow <jsnow@redhat.com>

  reply	other threads:[~2016-10-11 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-09 16:43 [Qemu-devel] [PATCH 0/2] dma-helpers: explicitly pass alignment into dma-helpers Mark Cave-Ayland
2016-10-09 16:43 ` [Qemu-devel] [PATCH 1/2] " Mark Cave-Ayland
2016-10-10 16:34   ` Eric Blake
2016-10-10 19:23     ` Mark Cave-Ayland
2016-10-11 15:47       ` John Snow [this message]
2016-10-12 10:22         ` Kevin Wolf
2016-10-12 16:04           ` John Snow
2016-10-09 16:43 ` [Qemu-devel] [PATCH 2/2] macio: switch over to new byte-aligned DMA helpers Mark Cave-Ayland
2016-10-10 16:50   ` Eric Blake
2016-10-11 16:58   ` John Snow

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=3fa3f1f8-2b7e-8b1f-1272-ff3b3647e0d3@redhat.com \
    --to=jsnow@redhat.com \
    --cc=eblake@redhat.com \
    --cc=keith.busch@intel.com \
    --cc=kwolf@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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 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).