Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1293347yba; Sun, 14 Apr 2019 06:11:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfU2OgmB4H6kypM4JvSblSkop6xtS3DT5crrZUAkA9+BKSPuY+sZ6zHdjbEYo2DZgQTNbt X-Received: by 2002:a62:474a:: with SMTP id u71mr69033198pfa.87.1555247478847; Sun, 14 Apr 2019 06:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555247478; cv=none; d=google.com; s=arc-20160816; b=Jbw0RC+XL5ny5V2qYZ5goTxKU1IAogZJH/V9CQzats2/bBrzTsHiFFB9TJHsslkL3+ tfoPQcxJS5GzJlNZPLkfj3G5i+Om3qa6FNTxO+nZjMGxJrdfvgf0mgu7AnA4dNapSMIR FaZEE+/fKTUQbXK/iputLCNjDc27uNPiD01DpCMDEjynr3BNKpYGA5xErz0beHz0wmSy F0i81UvXZoRkjmzZEtWyngqOx8sNwTPrGTliDk+qy6s3GvujgVXhgRrAbZcQcylEaAql GP1iMPhTei/q5Z3hPxIa7Gwo2xmsc9yYuHb1+4RUOxkodMvQeGSZxUJGy4oT9837MOp9 VJew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=s/vRKsZnbEF2PHEx3aLsv+Ea+RUVqcytRWZdLiC55kA=; b=qvOhZ6WClXbO5ap02DqLqu4WNnQ2ZQ5NIztDwn53PK5IMAAmq6SzyahwuCI6t0ia+F 7S1UYGNEvh2BjVs7Uf6Pm/QZZjzogvZFJSd7Oglf6U1vBy1B0nCYdMshMbpUJ9BmgqHN BmlDQkS+YELjvHm56CMM1r6LT08t+qSbmuUCGQv8q52/5V4eE8xonM+lVatfm2ayqFZ3 qTFL+2J1+wr/K8oDPerjAfLRzd0bxW64aZHOxcvWakdhoz6tQnhLgwblk/C7mrRSgqW2 mhMi/7xXULWpp6yQQOB+RZz8aj/9/2b6VGczHrRlttPhZSIqAImhQ3Ruxe2GSgsGZ8Ba M5nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=dBYe7cHq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si42440380pgb.322.2019.04.14.06.11.02; Sun, 14 Apr 2019 06:11:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=dBYe7cHq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbfDNNKU (ORCPT + 99 others); Sun, 14 Apr 2019 09:10:20 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43876 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbfDNNKU (ORCPT ); Sun, 14 Apr 2019 09:10:20 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3ED9XdH090767; Sun, 14 Apr 2019 13:10:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=s/vRKsZnbEF2PHEx3aLsv+Ea+RUVqcytRWZdLiC55kA=; b=dBYe7cHqwr3IWM3+VtfaNvutZSwwxKi5Nhgyv8xs0+AWJLdY6f4heSFeElyXS3bcaRE1 Uy0AOUDcmWq/HQ4y6LtlUzrHvEku42YDMGiYdiOIWAfcSwGQpYnbvhsq/pX5PTHf2tia cQGZAgOn5JhhzZ6yQZRtIZJkhBdPcEucYQ4G6uwG6vXjd0QlJh5T8Z33vde7bX/wgaUU 6MR6D4XkXJZbdz9UqJvv1qM2bKBlseUT2XpJ688avfzplhp7TNemtoDcWvp3YMKHG54E ToMfTRJBaxaS8z/Ejqln8oHVDyUhvWATtRkW1T1ClgGvzqkoVAfgHU8a2K2Bnz3weJTg LQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2ru59cu9jt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Apr 2019 13:10:08 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3EDA5Ri052252; Sun, 14 Apr 2019 13:10:08 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2rv2tts247-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Apr 2019 13:10:07 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3ED9twE021557; Sun, 14 Apr 2019 13:09:55 GMT Received: from [192.168.1.12] (/180.165.90.201) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 14 Apr 2019 13:09:55 +0000 Subject: Re: [RESEND PATCH] blk-mq: fix hang caused by freeze/unfreeze sequence To: Bart Van Assche , linux-block@vger.kernel.org Cc: shirley.ma@oracle.com, martin.petersen@oracle.com, Roman Pen , Akinobu Mita , Tejun Heo , Jens Axboe , Christoph Hellwig , linux-kernel@vger.kernel.org References: <20190409090828.16282-1-bob.liu@oracle.com> <0763cb5a-5598-69e3-e5ac-765989aab5b1@acm.org> From: Bob Liu Message-ID: <9ca4314d-fe45-9b24-8ba0-44d80f790502@oracle.com> Date: Sun, 14 Apr 2019 21:09:43 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <0763cb5a-5598-69e3-e5ac-765989aab5b1@acm.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9226 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904140098 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9226 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904140099 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/13/19 11:42 AM, Bart Van Assche wrote: > On 4/9/19 2:08 AM, Bob Liu wrote: >> void blk_freeze_queue_start(struct request_queue *q) >> { >> - int freeze_depth; >> - >> - freeze_depth = atomic_inc_return(&q->mq_freeze_depth); >> - if (freeze_depth == 1) { >> + mutex_lock(&q->mq_freeze_lock); >> + if (++q->mq_freeze_depth == 1) { >> percpu_ref_kill(&q->q_usage_counter); >> + mutex_unlock(&q->mq_freeze_lock); >> if (queue_is_mq(q)) >> blk_mq_run_hw_queues(q, false); >> + } else { >> + mutex_unlock(&q->mq_freeze_lock); >> } >> } > Have you considered to move the mutex_unlock() call to the end of the function > such that there is only one mutex_unlock() call instead of two? In case you> would be worried about holding the mutex around the code that runs the queue, > how about changing the blk_mq_run_hw_queues() call such that the queues are > run async? > Yes, but this bug is difficult to reproduce. I'd prefer keep the change minimum.