Re: [PATCHSET percpu/for-4.4] percpu_ref: make mode switching operations synchronize themselves
On Tue, Sep 29, 2015 at 05:47:15PM -0400, Tejun Heo wrote: > Hello, > > Mostly for historical reasons, percpu_ref atomic/percpu mode switching > operations require the users to synchronize different operations > although there are valid usage scenarios where different types of > operations racing against each other makes sense. This unusual > requirement led to a subtle race condition in blk-mq which was spotted > by Akinobu Mita[1]. > > Akinobu proposed a blk-mq specific fix where it adds an enclosing > mutex around the percpu_ref operations; however, this is a percpu_ref > deficiency and fixing it at the source is the better long term > approach. Unfortunately, this ended up being a somewhat invasive set > of changes and the right thing to do likely is applying Akinobu's fix > for 4.3 / -stable, applying this patchset for 4.4 window and reverting > Akinobu's patch after the 4.4 merge window. > > Akinobu, can you please verify that this patchset makes the race > condition go away? Okay, this patchset got forgotten while waiting response from Akinobu. I'm applying the patchset to percpu/for-4.9 as the changes are general improvements to percpu_refcnt. Thanks. -- tejun
Re: [PATCHSET percpu/for-4.4] percpu_ref: make mode switching operations synchronize themselves
On Tue, Sep 29, 2015 at 05:47:15PM -0400, Tejun Heo wrote: > Hello, > > Mostly for historical reasons, percpu_ref atomic/percpu mode switching > operations require the users to synchronize different operations > although there are valid usage scenarios where different types of > operations racing against each other makes sense. This unusual > requirement led to a subtle race condition in blk-mq which was spotted > by Akinobu Mita[1]. > > Akinobu proposed a blk-mq specific fix where it adds an enclosing > mutex around the percpu_ref operations; however, this is a percpu_ref > deficiency and fixing it at the source is the better long term > approach. Unfortunately, this ended up being a somewhat invasive set > of changes and the right thing to do likely is applying Akinobu's fix > for 4.3 / -stable, applying this patchset for 4.4 window and reverting > Akinobu's patch after the 4.4 merge window. > > Akinobu, can you please verify that this patchset makes the race > condition go away? Okay, this patchset got forgotten while waiting response from Akinobu. I'm applying the patchset to percpu/for-4.9 as the changes are general improvements to percpu_refcnt. Thanks. -- tejun
[PATCHSET percpu/for-4.4] percpu_ref: make mode switching operations synchronize themselves
Hello, Mostly for historical reasons, percpu_ref atomic/percpu mode switching operations require the users to synchronize different operations although there are valid usage scenarios where different types of operations racing against each other makes sense. This unusual requirement led to a subtle race condition in blk-mq which was spotted by Akinobu Mita[1]. Akinobu proposed a blk-mq specific fix where it adds an enclosing mutex around the percpu_ref operations; however, this is a percpu_ref deficiency and fixing it at the source is the better long term approach. Unfortunately, this ended up being a somewhat invasive set of changes and the right thing to do likely is applying Akinobu's fix for 4.3 / -stable, applying this patchset for 4.4 window and reverting Akinobu's patch after the 4.4 merge window. Akinobu, can you please verify that this patchset makes the race condition go away? This patchset contains the following five patches. 0001-percpu_ref-remove-unnecessary-RCU-grace-period-for-s.patch 0002-percpu_ref-reorganize-__percpu_ref_switch_to_atomic-.patch 0003-percpu_ref-unify-staggered-atomic-switching-wait-beh.patch 0004-percpu_ref-restructure-operation-mode-switching.patch 0005-percpu_ref-allow-operation-mode-switching-operations.patch 0001-0004 are prep patches. 0001 and 0003 involve minor behavior changes which shouldn't affect users. 0005 implements interal synchronization among percpu mode switching operations. diffstat follows. Thanks. lib/percpu-refcount.c | 166 +++--- 1 file changed, 92 insertions(+), 74 deletions(-) [1] http://lkml.kernel.org/g/1443287365-4244-7-git-send-email-akinobu.m...@gmail.com -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHSET percpu/for-4.4] percpu_ref: make mode switching operations synchronize themselves
Hello, Mostly for historical reasons, percpu_ref atomic/percpu mode switching operations require the users to synchronize different operations although there are valid usage scenarios where different types of operations racing against each other makes sense. This unusual requirement led to a subtle race condition in blk-mq which was spotted by Akinobu Mita[1]. Akinobu proposed a blk-mq specific fix where it adds an enclosing mutex around the percpu_ref operations; however, this is a percpu_ref deficiency and fixing it at the source is the better long term approach. Unfortunately, this ended up being a somewhat invasive set of changes and the right thing to do likely is applying Akinobu's fix for 4.3 / -stable, applying this patchset for 4.4 window and reverting Akinobu's patch after the 4.4 merge window. Akinobu, can you please verify that this patchset makes the race condition go away? This patchset contains the following five patches. 0001-percpu_ref-remove-unnecessary-RCU-grace-period-for-s.patch 0002-percpu_ref-reorganize-__percpu_ref_switch_to_atomic-.patch 0003-percpu_ref-unify-staggered-atomic-switching-wait-beh.patch 0004-percpu_ref-restructure-operation-mode-switching.patch 0005-percpu_ref-allow-operation-mode-switching-operations.patch 0001-0004 are prep patches. 0001 and 0003 involve minor behavior changes which shouldn't affect users. 0005 implements interal synchronization among percpu mode switching operations. diffstat follows. Thanks. lib/percpu-refcount.c | 166 +++--- 1 file changed, 92 insertions(+), 74 deletions(-) [1] http://lkml.kernel.org/g/1443287365-4244-7-git-send-email-akinobu.m...@gmail.com -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/