Message ID | 20170801114926.1171418-1-arnd@arndb.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Aug 01, 2017 at 01:48:48PM +0200, Arnd Bergmann wrote: > Removing the btt_rw_page/pmem_rw_page functions had a surprising > side-effect of introducing a false-positive warning in another > function, due to changed inlining decisions in gcc: > > In file included from drivers/nvdimm/pmem.c:36:0: > drivers/nvdimm/pmem.c: In function 'pmem_make_request': > drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] > drivers/nvdimm/pmem.c:174:16: note: 'start' was declared here > In file included from drivers/nvdimm/btt.c:27:0: > drivers/nvdimm/btt.c: In function 'btt_make_request': > drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] > drivers/nvdimm/btt.c:1202:16: note: 'start' was declared here > > The problem is that gcc fails to track the value of the 'do_acct' > variable here and has to read it back from stack, but it does > remember that 'start' may be uninitialized sometimes. > > This shuts up the warning by making nd_iostat_start() always > initialize the 'start' variable. In those cases that gcc successfully > tracks the state of the variable, this will have no effect. > > Fixes: 503a5e89b1de ("drivers/nvdimm/btt.c: remove btt_rw_page()") > Fixes: 58100d6e735e ("drivers/nvdimm/pmem.c: remove pmem_rw_page()") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> This change looks fine: Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> I believe the patches removing the btt_rw_page() and btt_rw_page() are on hold until I can get some performance numbers to justify them. Dan, do you want to take this as is, or do you want me to include it in my larger rw_page() series if/when that gets revived?
On Tue, Aug 1, 2017 at 11:00 AM, Ross Zwisler <ross.zwisler@linux.intel.com> wrote: > On Tue, Aug 01, 2017 at 01:48:48PM +0200, Arnd Bergmann wrote: >> Removing the btt_rw_page/pmem_rw_page functions had a surprising >> side-effect of introducing a false-positive warning in another >> function, due to changed inlining decisions in gcc: >> >> In file included from drivers/nvdimm/pmem.c:36:0: >> drivers/nvdimm/pmem.c: In function 'pmem_make_request': >> drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] >> drivers/nvdimm/pmem.c:174:16: note: 'start' was declared here >> In file included from drivers/nvdimm/btt.c:27:0: >> drivers/nvdimm/btt.c: In function 'btt_make_request': >> drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] >> drivers/nvdimm/btt.c:1202:16: note: 'start' was declared here >> >> The problem is that gcc fails to track the value of the 'do_acct' >> variable here and has to read it back from stack, but it does >> remember that 'start' may be uninitialized sometimes. >> >> This shuts up the warning by making nd_iostat_start() always >> initialize the 'start' variable. In those cases that gcc successfully >> tracks the state of the variable, this will have no effect. >> >> Fixes: 503a5e89b1de ("drivers/nvdimm/btt.c: remove btt_rw_page()") >> Fixes: 58100d6e735e ("drivers/nvdimm/pmem.c: remove pmem_rw_page()") >> Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > This change looks fine: > > Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > I believe the patches removing the btt_rw_page() and btt_rw_page() are on hold > until I can get some performance numbers to justify them. > > Dan, do you want to take this as is, or do you want me to include it in my > larger rw_page() series if/when that gets revived? I'd say include it with your set.
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index e1b5715bd91f..64f79a156456 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -392,8 +392,10 @@ static inline bool nd_iostat_start(struct bio *bio, unsigned long *start) { struct gendisk *disk = bio->bi_bdev->bd_disk; - if (!blk_queue_io_stat(disk->queue)) + if (!blk_queue_io_stat(disk->queue)) { + *start = 0; return false; + } *start = jiffies; generic_start_io_acct(bio_data_dir(bio),
Removing the btt_rw_page/pmem_rw_page functions had a surprising side-effect of introducing a false-positive warning in another function, due to changed inlining decisions in gcc: In file included from drivers/nvdimm/pmem.c:36:0: drivers/nvdimm/pmem.c: In function 'pmem_make_request': drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/nvdimm/pmem.c:174:16: note: 'start' was declared here In file included from drivers/nvdimm/btt.c:27:0: drivers/nvdimm/btt.c: In function 'btt_make_request': drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/nvdimm/btt.c:1202:16: note: 'start' was declared here The problem is that gcc fails to track the value of the 'do_acct' variable here and has to read it back from stack, but it does remember that 'start' may be uninitialized sometimes. This shuts up the warning by making nd_iostat_start() always initialize the 'start' variable. In those cases that gcc successfully tracks the state of the variable, this will have no effect. Fixes: 503a5e89b1de ("drivers/nvdimm/btt.c: remove btt_rw_page()") Fixes: 58100d6e735e ("drivers/nvdimm/pmem.c: remove pmem_rw_page()") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/nvdimm/nd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)