Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp237049imm; Tue, 17 Jul 2018 17:59:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeL52p+SMh0jzM6vmxbgin1PyLlLfG9BDlMpcBDqRx2Vov3K9GKSJ6EYV4/R4DTm91b7wNx X-Received: by 2002:a63:4002:: with SMTP id n2-v6mr3544301pga.285.1531875583445; Tue, 17 Jul 2018 17:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531875583; cv=none; d=google.com; s=arc-20160816; b=oRENqBiYZrUz3rmiBYd7/zWs5xmdx1suq1eyP4e+DfPXgaBvR4QlS69bj46h9t181X pANE72/F8F7b9wdcp4OBXlnKWySowOI3TChpnlhKWx3BJZTHrm5ARAIJ/laMAoWWecSu 9hvFeM3r0eagdK1597GVu9VCjU+1PHg664yQQacVzKma1wMGVpnFqLSgvH8CkId4FTBJ +115Evli52JWJzNUu1MADbJwdftPIao4lo8ETMY8T70PazHdGCRgu50utBhL1gaaXGuU T5zRP1W/Y0L41qZoUtwEq+fhWUmoEe/nVsANhYTHGl4b+kO8fKWGmmX7d5fMdGty70iu qIZg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=WoY/zLjScJhHctCcf2n0vdSmJNYhItdqnDj54h+3Kr4=; b=THEuyFs+CbLxkKRzeP+xOAG7CxqLTz+0OMAPL5iqcaAWhOdUHA+H+DQt8Vx0phbSIW 4QtGekjUMGittxKG0CJiEviGT9fRUYmk28ifcykBRRMa8wpEK6EB0MUl10pmL8SiuLTx FvOv7hQvl/9QFoXL3NXYYXhMu5HcrBqeg7fi7+XWILjAll3lENQ31RhUVGWQFpi1zepJ lbtDSgsZHJ4KaVsrQT4Kp41Mt3vTT3/W1cmDH6XWYUKDo1MdTU3drOKjSHoYTCci26UQ FpWDVWSSGffJAQORiDKLYS9bOfwAgBVyUWgsl2q7VRBQ73yqIbkz901Ydh9bEgJmeg/z xCzA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si2061246pln.349.2018.07.17.17.59.27; Tue, 17 Jul 2018 17:59:43 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731485AbeGRBeH (ORCPT + 99 others); Tue, 17 Jul 2018 21:34:07 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9638 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730614AbeGRBeG (ORCPT ); Tue, 17 Jul 2018 21:34:06 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E19E7B43B4F99; Wed, 18 Jul 2018 08:58:39 +0800 (CST) Received: from [127.0.0.1] (10.177.16.168) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.382.0; Wed, 18 Jul 2018 08:58:39 +0800 Subject: Re: [V9fs-developer] [PATCH v2] net/9p: Fix a deadlock case in the virtio transport To: Dominique Martinet References: <5B4DCD0A.8040600@huawei.com> <20180717114215.GA14414@nautica> <5B4DE09F.5000800@huawei.com> <20180717130720.GA23759@nautica> CC: Andrew Morton , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Linux Kernel Mailing List , From: jiangyiwen Message-ID: <5B4E90BE.5030307@huawei.com> Date: Wed, 18 Jul 2018 08:58:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20180717130720.GA23759@nautica> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.16.168] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/7/17 21:07, Dominique Martinet wrote: > jiangyiwen wrote on Tue, Jul 17, 2018: >> On 2018/7/17 19:42, Dominique Martinet wrote: >>> >>>> Subject: net/9p: Fix a deadlock case in the virtio transport >>> >>> I hadn't noticed in the v1, but how is that a deadlock fix? >>> The previous code doesn't look like it deadlocks to me, the commit >>> message is more correct. >>> >> >> If cpu is running in the irq context for a long time, >> NMI watchdog will detect the hard lockup in the cpu, >> and then it will cause kernel panic. So I use this >> subject to underline the scenario. > > That's still not a deadlock - fix lockup would be more appropriate? > > Okay. >>> Do we have a guarantee that req_done is only called if there is at least >>> one buf to read? >>> For example, that there isn't two threads queueing the same callback but >>> the first one reads everything and the second has nothing to read? >>> >>> If virtblk_done takes care of setting up a "req_done" bool to only >>> notify waiters if something has been done I'd rather have a reason to do >>> differently, even if you can argue that nothing bad will happen in case >>> of a gratuitous wake_up >>> >> >> Sorry, I don't fully understand what your mean. >> I think even if the ring buffer don't have the data, wakeup operation >> will not cause any other problem, and the loss of performance can be >> ignored. > > I just mean "others do check, why not us?". It's almost free to check if > we had something to read, but if there are many pending read/writes > waiting for a buffer they will all wake up and spin uselessly. > > I've checked other callers of virtqueue_get_buf() and out of 9 that loop > around in a callback then wake another thread up, 6 do check before > waking up, two check that something happened just to print a debug > statement if not (virtio_test and virtgpu) and one doesn't check > (virtio_input); so I guess we wouldn't be the first ones, just not > following the trend. > > But yes, nothing bad will happen, so let's agree to disagree and I'll > defer to others opinion on this > > > Thanks, > Thanks for your reply, you're right, other callers also check whether Virtio ring has data then do wakeup operation, we also should follow the trend. Okay, I will resend the patch later. Thanks, Yiwen.