Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1627043pxb; Wed, 10 Feb 2021 12:46:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSHp6NJGqfzOhXyG5wCIrC1Y6gdHOjdBrzaVzUc6cJG+MA34l0mLNWnfjBmtcu2NuZK9Hf X-Received: by 2002:a17:906:755:: with SMTP id z21mr4949413ejb.514.1612989980149; Wed, 10 Feb 2021 12:46:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612989980; cv=none; d=google.com; s=arc-20160816; b=z5/jfkZdU72zajQ/KrN9ICwHpthUVRXIJGND/20k08PUhLqDbEW0EFR2j4r5sRJxiF dy2mdXVfvOHW8mfnAqOtsfIx3fwFPoO/W14Pl39nT2CQxepaxEXRqg6dog2/pwuhsbR/ 8xgpLeniMEsw4G1x5PK+emWTV/tTNsdz9xzaYJaVfwI+npOFSaGtWKiQkVzfi+gxEk2/ MNE1FZ7K7gLMjtZgCmhmi7B6Omzcu2b+4rRwDJcqhS9Htn/AZmI6MD3wqCg+wkhW+eDK og+o1vBKb1mCitmTxcMrbQS33pExr9mMe07/o+gezg2lolTIlKdZyF37BYCAtf2vW1+y Df9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=XsNVCBW3vSGfcHcfRRgPG89fEDz1BvPfYPaG9U0LkKI=; b=qrAhsaUVnsEpySSANfKCS48G6Sjox+6LnVTCvywZsFsCGjAObczOHL8aoICiFyV2m2 0OPQX3ggqjhPKg5i33QiNPAp/TjPvZquEh7ynyicot1IhHePQQOwfEw4f84Vf3XhBQHU 8Ej3PNF24hKzmo+XpIacvBY0SYw5l4wCQb4Wx/2TeGLASJCFy8CPUZIxavVCIZWYjojl eFzzQ2anEsejkqBsGcCxD6FT4A9oFy1rtK2fkyDuezrai8WWJ6eaItIvB7YglfV18v96 qFCaVAa3waEuP7xIRiazJSmB7YGToh53BibX4CNWTHfXnAoLy5OTakf+41RMXWjZJxdf Vq+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si2036600ejy.305.2021.02.10.12.45.56; Wed, 10 Feb 2021 12:46:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233006AbhBJUnJ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 Feb 2021 15:43:09 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:4626 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231193AbhBJUnG (ORCPT ); Wed, 10 Feb 2021 15:43:06 -0500 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4DbWr0275VzY7F4; Thu, 11 Feb 2021 04:41:04 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 11 Feb 2021 04:42:20 +0800 Received: from dggemi761-chm.china.huawei.com (10.1.198.147) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Thu, 11 Feb 2021 04:42:20 +0800 Received: from dggemi761-chm.china.huawei.com ([10.9.49.202]) by dggemi761-chm.china.huawei.com ([10.9.49.202]) with mapi id 15.01.2106.006; Thu, 11 Feb 2021 04:42:20 +0800 From: "Song Bao Hua (Barry Song)" To: Andy Shevchenko CC: luojiaxing , Linus Walleij , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , "open list:GPIO SUBSYSTEM" , "Linux Kernel Mailing List" , "linuxarm@openeuler.org" Subject: RE: [Linuxarm] Re: [PATCH for next v1 0/2] gpio: few clean up patches to replace spin_lock_irqsave with spin_lock Thread-Topic: [Linuxarm] Re: [PATCH for next v1 0/2] gpio: few clean up patches to replace spin_lock_irqsave with spin_lock Thread-Index: AQHW/fpz5jJ2/H7qpkegS3EF2g2rTapNupMAgAFOFgCAAATsgIABLhiAgAB3XwCAAJQm4P//sJmAgADhgwA= Date: Wed, 10 Feb 2021 20:42:20 +0000 Message-ID: <7d9c4fa854924bfc890e98da2d88ea36@hisilicon.com> References: <1612774577-55943-1-git-send-email-luojiaxing@huawei.com> <2b8001bb-0bcd-3fea-e15c-2722e7243209@huawei.com> <1a5dfcf2-11a2-f549-782d-447d58e21305@huawei.com> <947bcef0d56a4d0c82729d6899394f4a@hisilicon.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.201.223] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com] > Sent: Thursday, February 11, 2021 3:57 AM > To: Song Bao Hua (Barry Song) > Cc: luojiaxing ; Linus Walleij > ; Grygorii Strashko ; > Santosh Shilimkar ; Kevin Hilman ; > open list:GPIO SUBSYSTEM ; Linux Kernel Mailing > List ; linuxarm@openeuler.org > Subject: Re: [Linuxarm] Re: [PATCH for next v1 0/2] gpio: few clean up patches > to replace spin_lock_irqsave with spin_lock > > On Wed, Feb 10, 2021 at 11:50:45AM +0000, Song Bao Hua (Barry Song) wrote: > > > -----Original Message----- > > > From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com] > > > Sent: Wednesday, February 10, 2021 11:51 PM > > > On Wed, Feb 10, 2021 at 5:43 AM luojiaxing wrote: > > > > On 2021/2/9 17:42, Andy Shevchenko wrote: > > ... > > > > > Between IRQ handler A and IRQ handle A, it's no need for a SLIS. > > > > > > Right, but it's not the case in the patches you provided. > > > > The code still holds spin_lock. So if two cpus call same IRQ handler, > > spin_lock makes them spin; and if interrupts are threaded, spin_lock > > makes two threads run the same handler one by one. > > If you run on an SMP system and it happens that spin_lock_irqsave() just > immediately after spin_unlock(), you will get into the troubles. Am I mistaken? Hi Andy, Thanks for your reply. But I don't agree spin_lock_irqsave() just immediately after spin_unlock() could a problem on SMP. When the 1st cpu releases spinlock by spin_unlock, it has completed its section of accessing the critical data, then 2nd cpu gets the spin_lock. These two CPUs won't have overlap on accessing the same data. > > I think this entire activity is a carefully crafted mine field for the future > syzcaller and fuzzers alike. I don't believe there are no side effects in a > long > term on all possible systems and configurations (including forced threaded IRQ > handlers). Also I don't understand why forced threaded IRQ could be a problem. Since IRQ has been a thread, this actually makes the situation much simpler than non-threaded IRQ. Since all threads including those IRQ threads want to hold spin_lock, they won't access the same critical data at the same time either. > > I would love to see a better explanation in the commit message of such patches > which makes it clear that there are *no* side effects. > People had the same questions before, But I guess the discussion in this commit has led to a better commit log: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4eb7d0cd59 > For time being, NAK to the all patches of this kind. Fair enough, if you expect better explanation, I agree the commit log is too short. > > -- > With Best Regards, > Andy Shevchenko > Thanks Barry