Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp643216imm; Tue, 15 May 2018 07:06:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtn9K97MttMdSROd+DgkNIvHAJxWJBZhxpgNhyjMxm1GXEgdXfSq3nMKfDyzP0PbtxAbDh X-Received: by 2002:a62:ba09:: with SMTP id k9-v6mr15254527pff.245.1526393196215; Tue, 15 May 2018 07:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526393196; cv=none; d=google.com; s=arc-20160816; b=hdNHptMBBrxPSA9Pch5MrauRXc4OBPtLHKaMksjEWFba6unza67k2bV4Fthv4R9K8D FfoW2FgSgJY1aPG0TJksz+zWtOZKxBuCEmBeXtIDK9o9c04/FPNypuilkf7roYLaDIMg rkJjD43IksDzUYj1E8sEFPx0ZFlgpaij095BEhTHvvBVaAML+xYCkFmAmrDqyXJjLKQJ +bYXH2jTOWiMxJae7gkv7wRyDjDVRfuFrrHYhFV1KG4Yb4g+Y5J5txeysInLxL+CUOsF 7Zzj7Lyyp2/MI7J6bMKWejjGDTjhQ6qydo/FE1ANv3ntM7QT1ARx0Ri6/jn7wWZZoZrM /l5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:organization :user-agent:references:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=ekUgPoa+REPqFheZeXZxeHz8o94taRzx/aRt5JJ4xIE=; b=Q6PV3xxr6E7Ulm6++FjWsvPvP9BC6L+/8bkLmVrFh4G2dX4f8uwsbidpqm0Zut4K31 krl2QPsmI3qYtU+161VgLJGnKOw09aoPPacS0VRcYKgUm5ynv0iq6CgrxNE3RC2YDgMH zkbR63rUQeGaMjUdLn2PrIGCElwRixzZomvnMaUcCXqsTyndkm59pSDWDXG6gB/IVhfe kBYf/6q/xQmyGNKfOhrICZtIMlWGqbXpW3LYKLizdJiGwmXicQs0QqTHflApurxQNuGv 232GwEgv9YcRJNoRZwJkIGsV5U0iHiGEkwEAPqhw0brY6lckysDTDGQnsZswOOZms4U8 Uhfw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6-v6si114419pfm.183.2018.05.15.07.06.08; Tue, 15 May 2018 07:06:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753768AbeEONuj (ORCPT + 99 others); Tue, 15 May 2018 09:50:39 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40746 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752662AbeEONui (ORCPT ); Tue, 15 May 2018 09:50:38 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4FDlnMw001126 for ; Tue, 15 May 2018 09:50:37 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hyy6fw45y-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 May 2018 09:50:22 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 May 2018 14:49:45 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 15 May 2018 14:49:42 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4FDnf2K7405890; Tue, 15 May 2018 13:49:41 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74A945203F; Tue, 15 May 2018 13:39:51 +0100 (BST) Received: from dyn-9-152-212-155.boeblingen.de.ibm.com (unknown [9.152.212.155]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 1E8A25204C; Tue, 15 May 2018 13:39:51 +0100 (BST) Date: Tue, 15 May 2018 15:49:40 +0200 (CEST) From: Sebastian Ott X-X-Sender: sebott@schleppi To: Bart Van Assche cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Tejun Heo , Jianchao Wang , Ming Lei , Sagi Grimberg , Israel Rukshin , Max Gurtovoy Subject: Re: [PATCH v9 2/2] blk-mq: Rework blk-mq timeout handling again In-Reply-To: <20180514184634.2160-3-bart.vanassche@wdc.com> References: <20180514184634.2160-1-bart.vanassche@wdc.com> <20180514184634.2160-3-bart.vanassche@wdc.com> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) Organization: =?ISO-8859-15?Q?=22IBM_Deutschland_Research_&_Development_GmbH?= =?ISO-8859-15?Q?_=2F_Vorsitzende_des_Aufsichtsrats=3A_Martina?= =?ISO-8859-15?Q?_Koederitz_Gesch=E4ftsf=FChrung=3A_Dirk_Wittkopp?= =?ISO-8859-15?Q?_Sitz_der_Gesellschaft=3A_B=F6blingen_=2F_Reg?= =?ISO-8859-15?Q?istergericht=3A_Amtsgericht_Stuttgart=2C_HRB_2432?= =?ISO-8859-15?Q?94=22?= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-TM-AS-GCONF: 00 x-cbid: 18051513-0040-0000-0000-00000459A7CA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051513-0041-0000-0000-000020FDD18C Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-15_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805150140 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 May 2018, Bart Van Assche wrote: > Recently the blk-mq timeout handling code was reworked. See also Tejun > Heo, "[PATCHSET v4] blk-mq: reimplement timeout handling", 08 Jan 2018 > (https://www.mail-archive.com/linux-block@vger.kernel.org/msg16985.html). > This patch reworks the blk-mq timeout handling code again. The timeout > handling code is simplified by introducing a state machine per request. > This change avoids that the blk-mq timeout handling code ignores > completions that occur after blk_mq_check_expired() has been called and > before blk_mq_rq_timed_out() has reset rq->aborted_gstate. If a block > driver timeout handler always returns BLK_EH_RESET_TIMER then the result > will be that the request never terminates. > > Fix this race as follows: > - Replace the __deadline member of struct request by a new member > called das that contains the generation number, state and deadline. > Only 32 bits are used for the deadline field such that all three > fields occupy only 64 bits. This change reduces the maximum supported > request timeout value from (2**63/HZ) to (2**31/HZ). > - Remove all request member variables that became superfluous due to > this change: gstate, gstate_seq and aborted_gstate_sync. > - Remove the request state information that became superfluous due to > this patch, namely RQF_MQ_TIMEOUT_EXPIRED. > - Remove the code that became superfluous due to this change, namely > the RCU lock and unlock statements in blk_mq_complete_request() and > also the synchronize_rcu() call in the timeout handler. > > Notes: > - A spinlock is used to protect atomic changes of rq->das on those > architectures that do not provide a cmpxchg64() implementation. > - Atomic instructions are only used to update the request state if > a concurrent request state change could be in progress. > - blk_add_timer() has been split into two functions - one for the > legacy block layer and one for blk-mq. > I tested your patch on top of block/for-next (with forced timeouts) - works as expected. The lockdep warnings with regard to gstate_seq are gone (surprise with gstate_seq gone) - thanks for that! Regards, Sebastian