Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Alex Xu via Virtualization
On Sat, 30 Jul 2016 18:09:22 -0400 Theodore Ts'o wrote as excerpted: > On Fri, Jul 29, 2016 at 01:31:14PM -0400, Alex Xu wrote: > > When qemu is started with -object rng-random,filename=/dev/urandom, > > and immediately (i.e. with no initrd and as the first thing in > > init): > >

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Theodore Ts'o
On Fri, Jul 29, 2016 at 01:31:14PM -0400, Alex Xu wrote: > > My understanding was that all three methods of obtaining entropy from > userspace all receive data from the CSPRNG in the kernel, and that the > only difference is that /dev/random and getrandom may block depending > on the kernel's

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Alex Xu via Virtualization
On Fri, 29 Jul 2016 19:03:51 +0200 Stephan Mueller wrote as excerpted: > Am Freitag, 29. Juli 2016, 10:14:07 CEST schrieb Alex Xu: > > I don't follow. Assuming you are correct and this is the issue, then > > reading 128 bits (16 bytes) from /dev/random should "exhaust the > >

Re: [virtio-dev] Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-30 Thread Dave Hansen
On 07/28/2016 02:51 PM, Michael S. Tsirkin wrote: >> > If 1MB is too big, how about 512K, or 256K? 32K seems too small. >> > > It's only small because it makes you rescan the free list. > So maybe you should do something else. > I looked at it a bit. Instead of scanning the free list, how about

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Stephan Mueller
Am Freitag, 29. Juli 2016, 10:14:07 CEST schrieb Alex Xu: Hi Alex, > On Fri, 29 Jul 2016 15:12:30 +0200 > > Stephan Mueller wrote as excerpted: > > Am Freitag, 29. Juli 2016, 09:03:45 CEST schrieb Alex Xu: > > > In my opinion, assuming I am not doing something terribly

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Nikos Mavrogiannopoulos
On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller wrote: > And finally, you have a coding error that is very very common but fatal when > reading from /dev/random: you do not account for short reads which implies > that your loop continues even in the case of short reads. > >

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Alex Xu via Virtualization
On Fri, 29 Jul 2016 12:24:27 +0200 Nikos Mavrogiannopoulos wrote: > On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller > wrote: > > And finally, you have a coding error that is very very common but > > fatal when reading from /dev/random: you do not account

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Alex Xu via Virtualization
On Fri, 29 Jul 2016 15:12:30 +0200 Stephan Mueller wrote as excerpted: > Am Freitag, 29. Juli 2016, 09:03:45 CEST schrieb Alex Xu: > > In my opinion, assuming I am not doing something terribly wrong, > > this constitutes a bug in the kernel's handling of getrandom calls > >

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Stephan Mueller
Am Freitag, 29. Juli 2016, 09:03:45 CEST schrieb Alex Xu: Hi Alex, > On Fri, 29 Jul 2016 12:24:27 +0200 > > Nikos Mavrogiannopoulos wrote: > > On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller > > > > wrote: > > > And finally, you have a coding error that

Re: getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Stephan Mueller
Am Donnerstag, 28. Juli 2016, 18:07:32 CEST schrieb Alex Xu: Hi Alex, > Linux 4.6, also tried 4.7, qemu 2.6, using this C program: I am not sure what problem you are referring to, but that is an expected behavior. You get partial reads when reading from /dev/random with a minimum of 64 bits.

getrandom waits for a long time when /dev/random is insufficiently read from

2016-07-30 Thread Alex Xu via Virtualization
Linux 4.6, also tried 4.7, qemu 2.6, using this C program: #include #include #include #include int main(int argc, char *argv[]) { char buf[16]; int fd; if (argc != 2) return 1; for (int i = 0; i < atoi(argv[1]); i++) { sleep(1); if ((fd =

Re: [PATCH v2 repost 3/7] mm: add a function to get the max pfn

2016-07-30 Thread Dave Hansen
On 07/27/2016 03:08 PM, Michael S. Tsirkin wrote: >> > +unsigned long get_max_pfn(void) >> > +{ >> > + return max_pfn; >> > +} >> > +EXPORT_SYMBOL(get_max_pfn); >> > + > > This needs a coment that this can change at any time. > So it's only good as a hint e.g. for sizing data structures. Or, if

Re: ext4 error when testing virtio-scsi & vhost-scsi

2016-07-30 Thread Zhangfei Gao
Hi, Jan On Wed, Jul 27, 2016 at 11:56 PM, Jan Kara wrote: > Hi! > > On Wed 27-07-16 15:58:55, Zhangfei Gao wrote: >> Hi, Michael >> >> I have met ext4 error when using vhost_scsi on arm64 platform, and >> suspect it is vhost_scsi issue. >> >> Ext4 error when testing virtio_scsi &

Re: [PATCH v2 repost 6/7] mm: add the related functions to get free page info

2016-07-30 Thread Dave Hansen
On 07/27/2016 03:05 PM, Michael S. Tsirkin wrote: > On Wed, Jul 27, 2016 at 09:40:56AM -0700, Dave Hansen wrote: >> On 07/26/2016 06:23 PM, Liang Li wrote: >>> + for_each_migratetype_order(order, t) { >>> + list_for_each(curr, >free_area[order].free_list[t]) { >>> +

Re: [PATCH v2 repost 6/7] mm: add the related functions to get free page info

2016-07-30 Thread Dave Hansen
On 07/26/2016 06:23 PM, Liang Li wrote: > + for_each_migratetype_order(order, t) { > + list_for_each(curr, >free_area[order].free_list[t]) { > + pfn = page_to_pfn(list_entry(curr, struct page, lru)); > + if (pfn >= start_pfn && pfn <=

Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-30 Thread Dave Hansen
On 07/26/2016 06:23 PM, Liang Li wrote: > + vb->pfn_limit = VIRTIO_BALLOON_PFNS_LIMIT; > + vb->pfn_limit = min(vb->pfn_limit, get_max_pfn()); > + vb->bmap_len = ALIGN(vb->pfn_limit, BITS_PER_LONG) / > + BITS_PER_BYTE + 2 * sizeof(unsigned long); > + hdr_len =

Re: ext4 error when testing virtio-scsi & vhost-scsi

2016-07-30 Thread Zhangfei Gao
Hi, Michael I have met ext4 error when using vhost_scsi on arm64 platform, and suspect it is vhost_scsi issue. Ext4 error when testing virtio_scsi & vhost_scsi No issue: 1. virtio_scsi, ext4 2. vhost_scsi & virtio_scsi, ext2 3. Instead of vhost, also tried loopback and no problem. Using

Re: ext4 error when testing virtio-scsi & vhost-scsi

2016-07-30 Thread Jan Kara
Hi! On Wed 27-07-16 15:58:55, Zhangfei Gao wrote: > Hi, Michael > > I have met ext4 error when using vhost_scsi on arm64 platform, and > suspect it is vhost_scsi issue. > > Ext4 error when testing virtio_scsi & vhost_scsi > > > No issue: > 1. virtio_scsi, ext4 > 2. vhost_scsi & virtio_scsi,

Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device

2016-07-30 Thread Namhyung Kim
On Thu, Jul 28, 2016 at 02:22:39PM +0100, Daniel P. Berrange wrote: > On Thu, Jul 28, 2016 at 12:08:30AM +0900, Namhyung Kim wrote: > > Add virtio pstore device to allow kernel log files saved on the host. > > It will save the log files on the directory given by pstore device > > option. > > > >

Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device

2016-07-30 Thread Namhyung Kim
Hello, On Thu, Jul 28, 2016 at 02:08:41PM +0100, Daniel P. Berrange wrote: > On Thu, Jul 28, 2016 at 01:56:07PM +0100, Stefan Hajnoczi wrote: > > On Thu, Jul 28, 2016 at 02:39:53PM +0900, Namhyung Kim wrote: > > > On Thu, Jul 28, 2016 at 03:02:54AM +0300, Michael S. Tsirkin wrote: > > > > On Thu,