Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753607AbbGJIIQ (ORCPT ); Fri, 10 Jul 2015 04:08:16 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:37953 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577AbbGJIIH (ORCPT ); Fri, 10 Jul 2015 04:08:07 -0400 MIME-Version: 1.0 In-Reply-To: <20150709213747.GC18734@mtj.duckdns.org> References: <1435847397-724-1-git-send-email-akinobu.mita@gmail.com> <1435847397-724-6-git-send-email-akinobu.mita@gmail.com> <20150709145510.6b8e21a2@tom-T450> <20150709213747.GC18734@mtj.duckdns.org> Date: Fri, 10 Jul 2015 16:08:07 +0800 Message-ID: Subject: Re: [PATCH v2 5/6] blk-mq: fix freeze queue race From: Ming Lei To: Tejun Heo Cc: Akinobu Mita , Linux Kernel Mailing List , Jens Axboe Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1063 Lines: 27 On Fri, Jul 10, 2015 at 5:37 AM, Tejun Heo wrote: > On Thu, Jul 09, 2015 at 02:55:10PM +0800, Ming Lei wrote: >> This patch looks fine since at least changing DEAD state of percpu ref >> state should have been synchronized by caller. >> >> Also looks __percpu_ref_switch_to_percpu() need to check if the refcount >> becomes dead after current switching, and seems something like following >> is needed: > > Hmmm... but the caller is responsible for synchronization for these > operations. If the state changes while waiting, it indicates a > synchronization bug and testing it one more time is kinda weird. What > if it changes right after that test? OK. Also looks it is helpful to detect the bug early by adding WARN_ON(ref->percpu_count_ptr & __PERCPU_REF_DEAD) after wait_event(). -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/