qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 7/7] iotests: new file to suppress Valgrind e


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v2 7/7] iotests: new file to suppress Valgrind errors
Date: Tue, 25 Jun 2019 10:13:31 +0200
User-agent: Mutt/1.11.3 (2019-02-01)

Am 24.06.2019 um 18:55 hat Andrey Shinkevich geschrieben:
> 
> 
> On 17/06/2019 14:45, Kevin Wolf wrote:
> > Am 11.06.2019 um 20:02 hat Andrey Shinkevich geschrieben:
> >> The Valgrind tool reports about an uninitialised memory usage when the
> >> initialization is actually not needed. For example, the buffer 'buf'
> >> instantiated on a stack of the function guess_disk_lchs().
> > 
> > I would be careful with calling initialisation "not needed". It means
> > that the test case may not behave entirely determinstic because the
> > uninitialised memory can vary between runs.\
> 
> I am going to amend the comment.
> 
> Andrey
> 
> > 
> > In this specific case, I assume that guess_disk_lchs() is called for a
> > null block node, for which .bdrv_co_preadv by default returns without
> > actually writing to the buffer. Instead of ignoring the valgrind error,
> > we could instead pass read-zeroes=on to the null block driver to make
> > the test deterministic.
> 
> The buffer that the Valgrind complains of is initialized by the 
> following function call blk_pread_unthrottled() that reads the first 
> BDRV_SECTOR_SIZE bytes form a disk "to guess the disk logical geometry". 
> The Valgrind does not recognize that way of initialization. I believe we 
> do not need to zero the buffer instantiated on the stack just to make 
> the Valgrind silent there.

My point is that blk_pread_unthrottled() with null-co/null-aio leaves
the buffer untouched if read-zeroes=off (which is the default). So yes,
valgrind is right, this memory is still uninitialised after
blk_pread_unthrottled().

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]