Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp24903rdb; Fri, 15 Dec 2023 21:21:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuxiFQ1lzmCDHEGETXGuD0t7vhmauBSuN/tVmGfrTEds9Z2OL4EIRPXK2zALYKvfSzxg+c X-Received: by 2002:a05:6830:438b:b0:6da:3070:194b with SMTP id s11-20020a056830438b00b006da3070194bmr8384445otv.65.1702704114037; Fri, 15 Dec 2023 21:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702704114; cv=none; d=google.com; s=arc-20160816; b=F20eM2twutQh4PWNn3r1D6H7Je7ArAcdBsQTnjK+BdZCHFOdBbTjejI6ULzfUfadfI 7dA5YfjI4jsozvwcw/JLNNwQUhJ8zC5KbIDfQzWT0fF9yzODABE/xp9KctYnmCjAV06C t1BAP1qwwmCc1IBZRcuMqjoO7PobIKPvqaAuG1uCOaL4WfwKc504Zjk6HUHb/o2motKN n/drnF3ZfO9S6ANrY/WC+fcAMO/1XJyxvPdZv8zazOSXcPqaXy2UtizRznvoM/6sUE6P yaxsBoTDd3zDyVUFfOrOtuVFra19vYytzmCwlBraxgZ4mwWQR5YrbPWGvrLCb0MlE7jM zIdQ== 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=JaQDdENWE4u9Gu2wgPxj8WtXafFPk9S8XTQcVIhdgyU=; fh=3/5z00DksLVABfPDw/iCZrt2KrXhhhnPMbR0aYyKDSs=; b=PpXXA9PfwAnlovBN2Oq5/yIzuq4hUxdHNfavQNruLi54vYxJfEMIHpxueK0Pr/zxgV aun/fF+Q5vH+0u/ANI/DqLEQmZw69Bz5qQXJWv9TdnTfqg+WfuHywwbLdcyTl46nOy51 2DZ+QWM25p0gDmxt8Ga2vxtXD0fMqJntK1AqKtVs9gAE5BB0CsoNqnpmQqwDNV0ujLSK cusVVGNWjO2OGiwg/IhREdXLBt+Q3KZt8zVTWZhqQWXIc+D8L5KhbpAycnlcgl26CnFt 2ExvAv+skwIijoFG0popZTDv13OHPP39QFaCOeBJpk5KIFc+T2AdiQN0baeat7I+ipBQ uf5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=of3V1Q8I; spf=pass (google.com: domain of linux-kernel+bounces-2090-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l190-20020a6388c7000000b005cd7e03a78asi470913pgd.764.2023.12.15.21.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 21:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2090-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=of3V1Q8I; spf=pass (google.com: domain of linux-kernel+bounces-2090-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2090-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id ABE4C285D93 for ; Sat, 16 Dec 2023 05:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 550C811CB1; Sat, 16 Dec 2023 05:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="of3V1Q8I" 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 80F011119B; Sat, 16 Dec 2023 05:21:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E5F8C433C7; Sat, 16 Dec 2023 05:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702704105; bh=3eaa/Z7yDUXKlQqwD+4l93z2758pfkfkFBK1mutDW8U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=of3V1Q8Ieqf/wmPZydE4Ev1mmMm+yb1yeoOt4xDu4H9NExwvYjJ5qW2ZSKZlQDbY4 sGMP9CgOAffy+NmeQDJbzj27bMcAeyXl1JiH/MoRm0ASEw2i0OXcXCKfqQUbB7BYnt 41dXYD6Wb/WtL2KzWf9WZb1umHJZnCz+d3y/yST8GlZQiAwMSfSx/2p3rmVpvnlnRl VzbD+PFhGENXHgNP+r5SPEKbx66285mGLR44OMglNzvR45GYyENUZb64WZTHHFCirB O6U1VppT2IRoLVMl/lyftqEHiUlAA625jzmX4oeoicQKqC5CDQiM08eom5sImlJCFU eHaq5eIZDFD8g== Date: Sat, 16 Dec 2023 10:51:32 +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 0/2] bus: mhi: host: Add lock to avoid race when ringing channel DB Message-ID: <20231216052132.GC3405@thinkpad> References: <1702276972-41296-1-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-1-git-send-email-quic_qianyu@quicinc.com> On Mon, Dec 11, 2023 at 02:42:50PM +0800, Qiang Yu wrote: > > 1. We need a write lock in mhi_gen_tre otherwise there is race of the WP > used for ringing channel DB between mhi_queue and M0 transition. > 2. We can not invoke local_bh_enable() when irqs are disabled, so move > read_lock_irqsave() under the mhi_gen_tre() since we add write_lock_bh() in > mhi_gen_tre(). > 3. Unlock xfer_cb to prevent potential lockup > Applied to mhi-next! - Mani > v1 -> v2: > Added write_unlock_bh(&mhi_chan->lock) in mhi_gen_tre() before return > because of error process. > > v2 -> v3: > 1. split protecting WP and unlocking xfer_cb into two patches > 2. Add a new patch to stop processing buffer and eventof a disabled or > stopped channel. > > v3 -> v4: > 1. Modify commit message > 2. Add unlock operation before return error > > v4 -> v5: > 1. Squash "protecting WP" and "Take irqsave lock" into one patch > 2. Drop patch 3/4 of patch v4 > > Bhaumik Bhatt (1): > bus: mhi: host: Add spinlock to protect WP access when queueing TREs > > Qiang Yu (1): > bus: mhi: host: Drop chan lock before queuing buffers > > drivers/bus/mhi/host/main.c | 26 +++++++++++++++++--------- > 1 file changed, 17 insertions(+), 9 deletions(-) > > -- > 2.7.4 > > -- மணிவண்ணன் சதாசிவம்