Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15988092rwd; Mon, 26 Jun 2023 04:21:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64sp6IDRYQ77lv5UhctJbeejcRDqyH0c/n8RoBKFfPP3VL4Ij2GRR3+3fQu53bPu4ojZ8y X-Received: by 2002:a05:6358:7057:b0:132:f2dc:e961 with SMTP id 23-20020a056358705700b00132f2dce961mr2836938rwp.10.1687778514710; Mon, 26 Jun 2023 04:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778514; cv=none; d=google.com; s=arc-20160816; b=LI+rwvMYp0yfp4CKdb/brRS7TSBjKxKEMWxBoSrp0mnKbPcaD8t2RDNLGHSnzbQ+KE V4hqOeQiIyY4FfWXegoNg47ocL3Z1Duw6dqQZ2xsQuXMe0BT29raq0XNDIM7M/wkW5xL cndwvhUcPQBvOyjiZkh0OFlOiKEsWlWYMnC7VtbZigM3mLoqvaBV1fu6TXQzK8KHx5E6 IIRchz7ky5JaTqZ8Pdc4ZCtM8mv5NYF8N388zsl327IXt2K/+jF29CrANHU62X93T+n+ t9Nokj77Ca/eWbKjxHyNxd1JTF5VBqhN9uNT/QCdagNJ5CU2npS9OvsxcPlDmbd0pbt/ hrdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=64w+dGHQUBJ1et8ewFD3jyGlCvkt75SmNrls/ZHllrY=; fh=5FHHPoJNgBMOED62Fi/DP/wnMuVrMi60Jzr2OkEZ+vI=; b=WFjtx+ZlHgepxJqK8BQso0b9mTUK1it7N8kbaEv6wIEG75w6mMNtF5L1DbNOyqSANw GYRSC0TmyGgD2+IzfDdbxn27OuUAOmJBd0ktKE07dc6ev/l4D6y+gZZtahXMLcmlRrrE RWCGAmimjdD8FzEBKgz+WaYRvdczcXdNqW9RvimDE3hQuQYCFJvFcJm6BslTRTiqY31P TqSLoHPTkelYco2Nu4SjY7gBZ40HUuYCfR+Ztb5Nv8ZsklyNU0RPEt/mMeyEdye/EhFJ 222SLandQ+C8n9IHCZoDjkS4LHngI+5wkqYM0RZPsdGbgqjnoXLYBmuVeY+gf+q3k4WM SClQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y28-20020a634b1c000000b00553ebb05d25si4749243pga.80.2023.06.26.04.21.42; Mon, 26 Jun 2023 04:21:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjFZLCk (ORCPT + 99 others); Mon, 26 Jun 2023 07:02:40 -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 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_SOFTFAIL,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 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