Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp961761rdh; Fri, 24 Nov 2023 02:04:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGw/Dxf2Z0yObgKhWj0TUb1JCNyLcjfnnZIcuXfGlgDyaoMUz0cLEShWOeYxJpnfyG9BEFG X-Received: by 2002:a05:6a20:4413:b0:187:ef24:358 with SMTP id ce19-20020a056a20441300b00187ef240358mr2920139pzb.60.1700820257879; Fri, 24 Nov 2023 02:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700820257; cv=none; d=google.com; s=arc-20160816; b=qu9p3Pq9y7SPgbv8dhXFRjq0GUm/+Lh39MVqes8DOgs9kJEcRo5nHfa2PNwM4hXe6l L6QX41szOirjNkfUQjMp9DGs7M4UWM3d0ZZDborUABaByeGs18ZS+2yovK49XqSbhLC4 PSSfIaDCVghjcruG41JWBkWzsPkC80FIUS/tvhLkdiogt3k33+o+XvUoJCGyWePXMHFZ 07Tvwa3Xc+70xRhHLIQJcBSf23oxXYzlx/cAatyLBGKCc2B34JKHTuLLwi2flxrT1yec cevdhbNmeiWv0Z4IC4T78iurFdFOOwHov6f7e7Wr8vpqE9ArmdC1JDAwf7B4t7r+zVPW h7nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6Xf4CE5gF21m+zbg9hmtshd+pXmOn/MCqe6yqdMUFaU=; fh=3/5z00DksLVABfPDw/iCZrt2KrXhhhnPMbR0aYyKDSs=; b=mkXLuhF0xQ37u9yx+aJYlokx2BMuAu/NjTOPPm98e5UT/KFvch4AmKfHWpgyKSosL3 hN5f7kV8vD6PnIESmyAeaW99rY4z2qjt7xWmaKPFWE8a9x2uwMHvb5Ag5tV1T0L5JZGN PdD7OhD+mVrypJWwocnQWqq3pz2wpE44eaaExatrtPGsSBgLCUvaVKpadCwBWZyndQXE 0HY6+gJ8MR0AzpiCLLB3VvrHOsIxjbBHszCdqNOYbtKufovNhXlzAjTdEmDZsau+qvOQ mdLJDh0lvm90S8gbFnXCL8LZwW16DcVE41k0BBw7QOxjTJe2BREwEDs6CkGJjgdfB5tp SvJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="fW/cmt1T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fr18-20020a17090ae2d200b0028558ef0c2dsi3853765pjb.33.2023.11.24.02.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 02:04:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="fW/cmt1T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 707D380309E7; Fri, 24 Nov 2023 02:04:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345407AbjKXKEG (ORCPT + 99 others); Fri, 24 Nov 2023 05:04:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345264AbjKXKEE (ORCPT ); Fri, 24 Nov 2023 05:04:04 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8082E91 for ; Fri, 24 Nov 2023 02:04:11 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48068C433C8; Fri, 24 Nov 2023 10:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700820251; bh=odyegxK7uxxBKnGsjhd8OdJQcNHKmuTu63nAYxY3t2E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fW/cmt1TnBYSriyoDoMYuXJEjNH09il9ygKQUnnl5ODH1Wr4IfG4Y93l6CbHMIkvU WdRO66wZVI6cOKxPozmzXAtliC+A0SXhgb3rANXFTcpI8DECN74dAXajeWG/4bgXVc hru+IlPXZuZ7As/Yj8pyZCrhdTzKJ9RnHGTzZoZke5XVwMKib7d/xeqhAKRqgrT7U5 r07Hlt5ewNzEZTaxBK/Kqi+BRziZUliGYLT/327vvKele7g2dQpAif2AbkiQg5cQ+9 ffFrzzCmaOUX3wv6lFkFY9+9myZABvN3CxMgW2FTRNEJVgUyifLQObqRDR0enfupJr D5aRl8/ymt0oA== Date: Fri, 24 Nov 2023 15:34:03 +0530 From: Manivannan Sadhasivam To: Qiang Yu Cc: quic_jhugo@quicinc.com, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, quic_mrana@quicinc.com Subject: Re: [PATCH v4 2/4] bus: mhi: host: Drop chan lock before queuing buffers Message-ID: <20231124100403.GA4536@thinkpad> References: <1699939661-7385-1-git-send-email-quic_qianyu@quicinc.com> <1699939661-7385-3-git-send-email-quic_qianyu@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1699939661-7385-3-git-send-email-quic_qianyu@quicinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 24 Nov 2023 02:04:16 -0800 (PST) On Tue, Nov 14, 2023 at 01:27:39PM +0800, Qiang Yu wrote: > Ensure read and write locks for the channel are not taken in succession by > dropping the read lock from parse_xfer_event() such that a callback given > to client can potentially queue buffers and acquire the write lock in that > process. Any queueing of buffers should be done without channel read lock > acquired as it can result in multiple locks and a soft lockup. > Is this patch trying to fix an existing issue in client drivers or a potential issue in the future drivers? Even if you take care of disabled channels, "mhi_event->lock" acquired during mhi_mark_stale_events() can cause deadlock, since event lock is already held by mhi_ev_task(). I'd prefer not to open the window unless this patch is fixing a real issue. - Mani > Signed-off-by: Qiang Yu > --- > drivers/bus/mhi/host/main.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c > index 6c6d253..c4215b0 100644 > --- a/drivers/bus/mhi/host/main.c > +++ b/drivers/bus/mhi/host/main.c > @@ -642,6 +642,8 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, > mhi_del_ring_element(mhi_cntrl, tre_ring); > local_rp = tre_ring->rp; > > + read_unlock_bh(&mhi_chan->lock); > + > /* notify client */ > mhi_chan->xfer_cb(mhi_chan->mhi_dev, &result); > > @@ -667,6 +669,8 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, > kfree(buf_info->cb_buf); > } > } > + > + read_lock_bh(&mhi_chan->lock); > } > break; > } /* CC_EOT */ > -- > 2.7.4 > > -- மணிவண்ணன் சதாசிவம்