From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 629FFEB64DC for ; Mon, 26 Jun 2023 11:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjFZLCl (ORCPT ); Mon, 26 Jun 2023 07:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbjFZLC1 (ORCPT ); Mon, 26 Jun 2023 07:02:27 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E96E2723; Mon, 26 Jun 2023 04:02:01 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="447624778" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="447624778" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 04:01:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="786114085" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="786114085" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004.fm.intel.com with ESMTP; 26 Jun 2023 04:01:49 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qDjye-006juo-0N; Mon, 26 Jun 2023 14:01:48 +0300 Date: Mon, 26 Jun 2023 14:01:47 +0300 From: "andy@kernel.org" To: YE Chengfeng Cc: Linus Walleij , Bartosz Golaszewski , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/2] gpiolib: cdev: Fix &lr->wait.lock deadlock issue Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 26, 2023 at 10:39:56AM +0000, YE Chengfeng wrote: > linereq_put_event is called from both interrupt context (e.g., > edge_irq_thread) and process context (process_hw_ts_thread). > Therefore, interrupt should be disabled before acquiring lock > &lr->wait.lock inside linereq_put_event to avoid deadlock when > the lock is held in process context and edge_irq_thread comes. > > Similarly, linereq_read_unlocked running in process context > also acquies the same lock. It also need to disable interrupt > otherwise deadlock could happen if the irq edge_irq_thread > comes to execution while the lock is held. > > Fix the two potential deadlock issues by spin_lock_bh() and > spin_lock_irq() separately. Side note: You have two patches in something that seems to be the series, but lacks the references in email headers. Whenever you send a series, do not forget to add --thread to `git send-email`. -- With Best Regards, Andy Shevchenko