All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: amit.shah@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: Re: [Qemu-devel] [PATCH] virtio-rng: correct the default limit rate
Date: Tue, 26 Nov 2013 14:58:26 +0100	[thread overview]
Message-ID: <5294A902.5060000@redhat.com> (raw)
In-Reply-To: <1385473433-15844-1-git-send-email-akong@redhat.com>

Il 26/11/2013 14:43, Amos Kong ha scritto:
> /* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s.  If
>  * you have an entropy source capable of generating more entropy than this
>  * and you can pass it through via virtio-rng, then hats off to you.  Until
>  * then, this is unlimited for all practical purposes.
>  */
> 
> But the current rate is (INT64_MAX) bytes per (1 << 16) ms, it's 128,000 TB/s

You are changing:

* max-bytes from 2^63 to 2^47

* period from 65536 to 60000

For a user, changing only period would have no effect, the limit rate
would remain effectively infinite.  Changing max-bytes would give a 7%
higher rate after your patch.

Not a big deal, and max-bytes is easier to explain after your patch
(bytes/minute) than before (bytes/65536ms).

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

> * change the default period to 60,000 ms --> 1 mins
> * change the default max-bytes to 2^47 bytes --> INT64_MAX >> 16
> 
>  INT64_MAX  =  0x 8000 0000 0000 0000 - 1 = 2 ^ 63 - 1
>  INT64_MAX >> 16 =  0x 8000 0000 0000 - 1 = 2 ^ 47
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  include/hw/virtio/virtio-rng.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h
> index debaa15..d64e804 100644
> --- a/include/hw/virtio/virtio-rng.h
> +++ b/include/hw/virtio/virtio-rng.h
> @@ -53,7 +53,7 @@ typedef struct VirtIORNG {
>  */
>  #define DEFINE_VIRTIO_RNG_PROPERTIES(_state, _conf_field)                    \
>          DEFINE_PROP_UINT64("max-bytes", _state, _conf_field.max_bytes,       \
> -                           INT64_MAX),                                       \
> -        DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 1 << 16)
> +                           INT64_MAX >> 16),                                 \
> +        DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 60000)

  reply	other threads:[~2013-11-26 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 13:43 [Qemu-devel] [PATCH] virtio-rng: correct the default limit rate Amos Kong
2013-11-26 13:58 ` Paolo Bonzini [this message]
2013-11-26 14:23   ` Amos Kong
2013-11-26 14:32   ` Eric Blake
2013-11-26 14:44     ` Paolo Bonzini
2013-11-26 15:23     ` Amos Kong
2013-11-26 15:32       ` 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=5294A902.5060000@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=akong@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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.