Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp24270rdb; Fri, 15 Dec 2023 21:19:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwFD8oVZwUWvPZSSbv0MnIj+N6ByOg80632RRwvuR1hWN9n8n5W/Lix3vB2cAllGs8K4FS X-Received: by 2002:a05:6358:99a0:b0:16b:fe18:27fc with SMTP id j32-20020a05635899a000b0016bfe1827fcmr14642343rwb.31.1702703978994; Fri, 15 Dec 2023 21:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702703978; cv=none; d=google.com; s=arc-20160816; b=etO21JK/fsDBSQ9vcaqcLxd9+h8tclTGCJDP+ZRecPjIUgw/gArkHkS6iuyTR4nfze CNBX8OwpaVzX/axP2Uj20AV4zPdp33PbTG79t4CKmssPnxcr3QCKCNUrj1T6SljWHz7W OJOwF6PE+WdwUfvCzA8UdUqkZkrRAzcFRm71aPNcy0IVtdiDqyWrqX/Js4OGEjPsExqK Jeuh/Ko6lyNrYhx5xFFQnq4cu5U0564MLsDVuSB4lXDQJPjdCssXPTiDPimUM65b5ws4 t7/70NsrNcGom+l8k6ZzmqAT8irIJGIA6U5eK+ruqdSm15cCsMlyYArmsC6EH9K35Wb8 8P2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T64USa8iqZ5Qo8wUIut4lD8MpIKYAsroVH8inFlmPjo=; fh=3/5z00DksLVABfPDw/iCZrt2KrXhhhnPMbR0aYyKDSs=; b=g5sbstlbY5e61hr+5oAcZuQXITZuI7lKo9/HI9F4UaleE+gRuX6qXxMsA44oNQctNC 75VocdnwhyM5lHE3KZh97dTJrwHJawHru74anc5tBQPJxgXffCuRhCvZ4hSiRp4mim3O 942ufkEtvdS30oe9DRl29dp8ZDay03oF2LCMh2FaaU2viI8n8drxTV1GRQYWtMcEbHQn eu7iH3V1BIYpRCR6+R1SFo3NpruYNGe99eZeyaEpIGMN4TtgHGdjfMwTQZUGxsKzu0TI RhVCyCl2O09ghh3KvGyjl8SCF1VZA7lzJ8ZeXbjqNK4uYhDjikUntv6JST/H6DB6aLBt NbJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D8Rwtikr; spf=pass (google.com: domain of linux-kernel+bounces-2088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d4-20020a170902b70400b001bb9375b349si14100395pls.536.2023.12.15.21.19.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 21:19:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D8Rwtikr; spf=pass (google.com: domain of linux-kernel+bounces-2088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D7105B2408F for ; Sat, 16 Dec 2023 05:19:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65E8D11726; Sat, 16 Dec 2023 05:19:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D8Rwtikr" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E9C910A2B; Sat, 16 Dec 2023 05:19:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85618C433C8; Sat, 16 Dec 2023 05:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702703961; bh=geWMBLcp6sf1ms/3Xd1oNOeH2gSFO3bsbIdjbrF8pBU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D8RwtikrCgR7IeIf7effE0TXN2gDjVDQjkMDLuYViPS7qJV/Q5yClH/ecL+nhocjc dH7gc6QhfrFKI7Auns+lzUfAQm8tqkWphKmEsXaIfpGP/8WxZiIJLdVgSa3LDz+jLY l9lUGVTUyVUj7UJhnYJrDeIxRQjZgl7DDuIEWApuLzN8/6xzwKunEKlj6xxiKGVD29 oKDguXIFl9sPRsWLUK1XNgsfcd+mMl8CGUMcji03D8Cn1jqolY4eNNyaL/XHQBNwzb AGMeNDg1RSJSOB3HeBlAJuHLgglU/W9W4xhiD97bqdK3StzdbMNBPppOu39ez7Ors6 ILzEUHamsW2JA== Date: Sat, 16 Dec 2023 10:49:08 +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 v5 2/2] bus: mhi: host: Drop chan lock before queuing buffers Message-ID: <20231216051908.GB3405@thinkpad> References: <1702276972-41296-1-git-send-email-quic_qianyu@quicinc.com> <1702276972-41296-3-git-send-email-quic_qianyu@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1702276972-41296-3-git-send-email-quic_qianyu@quicinc.com> On Mon, Dec 11, 2023 at 02:42:52PM +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. > Cc: # 5.7 Fixes: 1d3173a3bae7 ("bus: mhi: core: Add support for processing events from client device") > Signed-off-by: Qiang Yu Reviewed-by: Manivannan Sadhasivam - Mani > --- > 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 32021fe..25f98d6 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 > > -- மணிவண்ணன் சதாசிவம்