All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Peter Lieven <pl@kamp.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] Regression: block: Add .bdrv_co_pwrite_zeroes()
Date: Tue, 5 Jul 2016 08:59:01 -0600	[thread overview]
Message-ID: <577BCB35.6060103@redhat.com> (raw)
In-Reply-To: <3221d3d3-37ee-9752-396e-379792445ee0@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]

On 07/05/2016 07:37 AM, Paolo Bonzini wrote:
> 
> 
> On 05/07/2016 03:53, Eric Blake wrote:
>>>> I think we cannot assert that that these alignments are a power of 2.
>> Perhaps that means we should just fix our code to round things down to
>> the nearest power of 2 (8MB) for the opt_transfer_len and
>> opt_discard_alignment values.  Can you post a stack-trace of the actual
>> assertion you are hitting?
> 
> It doesn't work for opt_discard_alignment.  Neither 8MB nor 16MB is
> aligned to 15MB for example.

The largest power-of-2 alignment that will align with every 15M page is
1M.  Is there a measurable performance difference between doing lots of
1M accesses (14 out of 15 are unaligned, but none of them cross page
boundaries), vs. doing 8M accesses (14 out of 15 are unaligned, and 7
out of 15 cross page boundaries, but there are fewer accesses overall)?

The optimal alignments are advisory - they should be a hint that says
that accesses smaller than the alignment may require RMW and are
therefore slower.  I agree that at a certain point, we will definitely
see slowdowns (if we do all 64k accesses, we could probably notice it),
but I'm having a hard time seeing how hardware that advertises a
non-power-of-2 can behave less efficiently for 1M than it would for 8M,
particularly if the smallest addressable block size is indeed smaller
than 1M on that device.

And yes, we could probably switch to (potentially slower) / % * instead
of bit operations in block/io.c to accommodate a non-power-of-2 optimal
size, but it would require a careful audit to make sure we don't have
even more bit-wise operations lurking that were assuming a power of 2.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2016-07-05 14:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 13:49 [Qemu-devel] Regression: block: Add .bdrv_co_pwrite_zeroes() Peter Lieven
2016-07-05  1:53 ` Eric Blake
2016-07-05  7:30   ` Peter Lieven
2016-07-05 13:03     ` Eric Blake
2016-07-05 13:39       ` Paolo Bonzini
2016-07-05 13:37   ` Paolo Bonzini
2016-07-05 13:40     ` Peter Lieven
2016-07-05 14:59     ` Eric Blake [this message]
2016-07-05 15:09       ` Paolo Bonzini
2016-07-15 10:09         ` Peter Lieven
2016-07-15 15:40           ` Eric Blake
2016-07-18  7:06             ` Peter Lieven
2016-07-20 23:35 ` Eric Blake
2016-07-21  7:01   ` Peter Lieven
2016-07-21  9:10     ` Paolo Bonzini
2016-07-21  9:08   ` Paolo Bonzini
2016-07-21 15:12     ` Eric Blake
2016-07-21 13:38   ` wangweiwei
2016-07-21 13:45     ` wangweiwei

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=577BCB35.6060103@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --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 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.