From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752654AbdLKJ2D (ORCPT ); Mon, 11 Dec 2017 04:28:03 -0500 Received: from merlin.infradead.org ([205.233.59.134]:44984 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752570AbdLKJ2C (ORCPT ); Mon, 11 Dec 2017 04:28:02 -0500 Date: Mon, 11 Dec 2017 10:27:55 +0100 From: Peter Zijlstra To: Tejun Heo Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, oleg@redhat.com, kernel-team@fb.com, osandov@fb.com Subject: Re: [PATCHSET] blk-mq: reimplement timeout handling Message-ID: <20171211092755.uptoa23wlukuryie@hirez.programming.kicks-ass.net> References: <20171209192525.982030-1-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171209192525.982030-1-tj@kernel.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 09, 2017 at 11:25:19AM -0800, Tejun Heo wrote: > Currently, blk-mq timeout path synchronizes against the usual > issue/completion path using a complex scheme involving atomic > bitflags, REQ_ATOM_*, memory barriers and subtle memory coherence > rules. Unfortunatley, it contains quite a few holes. > > It's pretty easy to make blk_mq_check_expired() terminate a later > instance of a request. If we induce 5 sec delay before > time_after_eq() test in blk_mq_check_expired(), shorten the timeout to > 2s, and issue back-to-back large IOs, blk-mq starts timing out > requests spuriously pretty quickly. Nothing actually timed out. It > just made the call on a recycle instance of a request and then > terminated a later instance long after the original instance finished. > The scenario isn't theoretical either. > > This patchset replaces the broken synchronization mechanism with a RCU > and generation number based one. Please read the patch description of > the second path for more details. > > Oleg, Peter, I'd really appreciate if you guys can go over the > reported breakages and the new implementation. Great, yes that code seemed very suspicious when I looked at it; thanks for making it go away. I'll try and find a spot to stare at the patches.