From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRNp7-00040b-Ha for qemu-devel@nongnu.org; Thu, 04 Feb 2016 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRNp4-0001r2-8d for qemu-devel@nongnu.org; Thu, 04 Feb 2016 12:36:05 -0500 Received: from mx4-phx2.redhat.com ([209.132.183.25]:46854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRNp4-0001qk-1m for qemu-devel@nongnu.org; Thu, 04 Feb 2016 12:36:02 -0500 Date: Thu, 4 Feb 2016 12:36:01 -0500 (EST) From: Ladi Prosek Message-ID: <370195749.32299292.1454607361313.JavaMail.zimbra@redhat.com> In-Reply-To: <2080961306.14671218.1454575993488.JavaMail.zimbra@redhat.com> References: <1453465198-11000-1-git-send-email-lprosek@redhat.com> <20160203123639.GA20527@grmbl.mre> <56B24A9C.9010104@redhat.com> <2080961306.14671218.1454575993488.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rng-random: implement request queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pankaj Gupta Cc: Amit Shah , Paolo Bonzini , qemu-devel@nongnu.org Hi Pankaj, ----- Original Message ----- > > Hi Ladi, > > I think this is fine if we have multiple requests from Guests and > depending on entropy pool available we can honour individual requests > and return with the entropy. > > Just one point I have is, Suppose we have multiple requests from Guests > and we are returning if request length < 0 for any request. There might > be pending requests which will get executed in next iteration?Can we honour > them in same iteration? > > static void entropy_available(void *opaque) > { > ... > ... > while (s->requests != NULL) { > ... > if (len < 0 && errno == EAGAIN) { > + return; > + } > ... All requests in the queue are waiting for data to be readable from the same fd. If the fd has no data (read fails with EAGAIN), there's no point in hammering on the fd in a loop. Returning seems to be the right thing to do. Please let me know if I misunderstood your comment. > Best regards, > Pankaj > > > > > > > > On 03/02/2016 13:36, Amit Shah wrote: > > > ... and this can lead to breaking migration (the queue of requests on > > > the host needs to be migrated, else the new host will have no idea of > > > the queue). > > > > It is already migrated as part of virtio_rng_save's call to virtio_save. > > On the loading side, virtio_rng_process condenses all requests into one > > and chr_read fills in as many virtqueue buffers as possible from the > > single request. > > > > Cancel_requests seems useless. > > > > Paolo > > > >