Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp936272rdb; Wed, 6 Dec 2023 04:28:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKpbt9O56hsf/2tNWPeFCS+U1gpAJX7vDod57nOhNRqi0sk4wbIg3gdRPUDtflwUj71tYV X-Received: by 2002:a05:6a20:26a8:b0:18b:8dfa:8895 with SMTP id h40-20020a056a2026a800b0018b8dfa8895mr634141pze.17.1701865685417; Wed, 06 Dec 2023 04:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701865685; cv=none; d=google.com; s=arc-20160816; b=vTF8kpVuZjJAiMFjHXb4+wcBxTSiVN/gsMrF3VrB3GuJFrUD69faH1DvBeLmp+3b+9 ltlhaf8F/kc8tkEQcoLZBQvLAWIIaLK0UMF77KjPYLTqFrLfuQIqtiA/mXuNOuKe0Ma/ fQcbZk+Utp9i0pwkyLfK+RjUKHInYtwqRGPDXwHDw9gd+n2Gz/gUQDCrCZRKhbT5KvhR 2uWzv3BQ3A+L8XKTakpqTsgyNE4rlJwMzYWeDGrinQqZxCR4hTffmMmqDxyAavrS1Kxk SZL7JyJXoLy6Nudcikxk96kvZo8tD0PxEL86XTESfMRVDp3U2bAtlNbdlrZl3Alexnvx kTOQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JqE/lbK52yoQJl2BwduPSUmQfAB2BZNYvts/rEx6/5U=; fh=jX1qbLUXk6dsQfAgc+LITnO7uh59GtuevbonoKXTF9Y=; b=wAEJiTlY2Kfc9NRsOqyV3ydKJgPpG1nKYCAfU8BTb2BiLSUq9S4WVKbuYty1DqUax7 YbgikhXrMSpMBRgL0qwRwYDOccPDDzeL8z7VFml8WNQRox1WVA71ARUGjhz2p0lq5fvn JY5eI48podrUk1+BZnhINfUTphzMqJaJw8H4DsQZ2UXHFNXwABMrIxh+sNj06Bpdm/FR RkYpgF+OQRB4kEuZW4OURmdvYg/TgmUeLW2SIepxzevGzqFDDo0B96msVxVqKxUMkkuE K1guc1wuhVWLW2CMKFeHPd9PnePdEX3GxCjU542h0Z7qZ7AzmD1fWpz2KFHr0BEN03MV fk6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OdeFo0ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id c17-20020a634e11000000b005c5ff4342e7si11702224pgb.866.2023.12.06.04.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 04:28:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OdeFo0ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 9969C809AFB1; Wed, 6 Dec 2023 04:28:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378056AbjLFM1r (ORCPT + 99 others); Wed, 6 Dec 2023 07:27:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377925AbjLFM1q (ORCPT ); Wed, 6 Dec 2023 07:27:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD02F112 for ; Wed, 6 Dec 2023 04:27:52 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F61C433C7; Wed, 6 Dec 2023 12:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701865672; bh=dlj/YCXcrqa1hzDWlixfpmkm6MqvVIgbXbMVeW4nZlc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OdeFo0jiIjPqrDwRBwUjKRUeRAWf4059fHqTteSj0VHDrhWaMF+HEv2ZEZXedaDgD cfBHYtyFxqH+JV5AqFf3PFYnIKwQyoMzTeMiltUvDH1l0gc/qxW1GK7pIXTfA0T3El mGm2yANxGVzo6lPm0xnEorK/v8O5vDSn1LEbPeo6cpvQPXu2c4+U1a1P2kR9gSI7aP WjdU8Z01ATLX+YfrqDuGqGiA3gCBLuKP/VezSEx399xilXDYKDIofqpyY3w3mbk3mx cDTMB+pPNwGNwwomuaU2RETacF60AKssiVMh8BlQg5d/UF6h+gm2Ddam3/tXBs+euj /3e7uFW/S993w== Date: Wed, 6 Dec 2023 13:27:38 +0100 From: Andi Shyti To: Jensen Huang Cc: Heiko Stuebner , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: rk3x: fix potential spinlock recursion on poll Message-ID: <20231206122738.cnnjxszz4g6zak3w@zenone.zhora.eu> References: <20231206090641.18849-1-jensenhuang@friendlyarm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231206090641.18849-1-jensenhuang@friendlyarm.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 04:28:02 -0800 (PST) Hi Jensen, On Wed, Dec 06, 2023 at 05:06:40PM +0800, Jensen Huang wrote: > Possible deadlock scenario (on reboot): > rk3x_i2c_xfer_common(polling) > -> rk3x_i2c_wait_xfer_poll() > -> rk3x_i2c_irq(0, i2c); > --> spin_lock(&i2c->lock); > ... > > -> rk3x_i2c_irq(0, i2c); > --> spin_lock(&i2c->lock); (deadlock here) > > Store the IRQ number and disable/enable it around the polling transfer. > This patch has been tested on NanoPC-T4. > > Signed-off-by: Jensen Huang Looks good, Reviewed-by: Andi Shyti Thanks, Andi