Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2019841pxb; Thu, 11 Feb 2021 02:04:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhXSC0yCDAqK6VC65rfuB9xop5YXVhdksPnvFhxtFl3/if2pUQXoY9QnkdRkbl9ilRB/vZ X-Received: by 2002:a17:907:98f3:: with SMTP id ke19mr7654142ejc.290.1613037889677; Thu, 11 Feb 2021 02:04:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613037889; cv=none; d=google.com; s=arc-20160816; b=n2eIvGjoGkKS6iPxm4GemmAYO3ev9XLqA/wBeUm9KlP1eLzI5TnTWshSn+JB73QG+7 gntg4vFvb91GzgCZ96jJvSVfeSKZzVkLt0v/02X8p7jc7DLa/BBOmRQaTrfPgjaWSSsX SDybY9URovvPf9mPBsLjxcL6yQHlc9AuFffxccAIkprS2hz/SJrge7S3akyrSNUpb1f/ KHH90YI4s9xfshccns3fW3Qmib5JoO+xV0voJfik8zNlaaqOu4cAI2uOe/CylNPUsG6J Om5GQ/Dj1wo1oBBEXpx7xcwYHcwbTz0be6zy1+PtNJ4/3pXQH201s4Nufrsm3Ewfd9j6 40eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=p8yLOwNK06k61JVsuPj/t4DRkDw7VF6DC3KbEb5PjTQ=; b=JRv5obDcRVqNyo8JzxATYtVPp9voa6KtnQ3G7IuwCgAaa9h4wBI6RIOJnzABLSv9jn CV3QKdaknJqCj+YeF7GN+HrEhjXKNO+apyj4Al7KOfJ/Ewbb3xL7vKSTWBsBc5kUR53o p0rCLDi2Sswv6pcGu2I2+XPQI6xQ41e0K2KBofMk0HyeuhLIchRGCZeG6lN7pGonqKCn nIr1c07arsZBw4S8urAVn90fe/+YU+60CjDeekmRs2UpQjflj3A2G7I2EuV21DlPKJ44 3qm9QrIWuFNWTcFo2FP5bBFxar1avYWyBts4JBmcwfHNyXnnei7Y3f6fCvS0xvlB5ZxZ N4tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fi8jMmmX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si3205335ede.302.2021.02.11.02.04.24; Thu, 11 Feb 2021 02:04:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fi8jMmmX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229901AbhBKKDf (ORCPT + 99 others); Thu, 11 Feb 2021 05:03:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhBKJ7i (ORCPT ); Thu, 11 Feb 2021 04:59:38 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD016C06178B; Thu, 11 Feb 2021 01:58:57 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id e9so3054159plh.3; Thu, 11 Feb 2021 01:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p8yLOwNK06k61JVsuPj/t4DRkDw7VF6DC3KbEb5PjTQ=; b=Fi8jMmmXt16oxPYsGiHBscD2cBUO84ThSxG1Cxn9+lH4Xh6hWhuGgwmU+FRS8DfQvB Ok3wKu9nHdl6QKXkKk3q+npUPmqpDTFUeGjUJT4HqBDHRVPh6i7dRNEWy2QDOkvjQi0H /Eovxn7ZbMJzkQjuHoNGstiABQkF65p9CRRTj5GVWKPDF+1k4eCazd66hqOZFX7Iwosw oPZ3VJG8RVS5YHqOokaOinMk1JqYx87vtqrWy+PVBGm/+q2RsPixbRKwZ1lRQ+TGZqRA OA0HuZZWgIZclz0xEi4v9ksC/40ipOQ3andDmrOYnoJQLxFwZx5pb5h6d8GZWUCQIrY2 l8dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p8yLOwNK06k61JVsuPj/t4DRkDw7VF6DC3KbEb5PjTQ=; b=uFezRO1iaZSsC91vZm8SFbgnKcKyUNHBRGKcJs/InpA6JLREC5uwleJsH4vWsAUMTd +4pNARlNXO/8ysUZJc1qwO5XQ5WD/XH49PBGEDe1x0vyIntPl72656M3c6azqfOtORYT yhedljQrz4l1xsAmzaiB9/VCYXNM0pOqS2l9cCpuII7gvlY9eNmOfEd2gJHq4npQyiKB oAs1EzQ517M+vyohB+fXs6WOWBOe4mKyVCcIkaq2TJeI08cpaUXvmLpegHSlvGMMMCfl jZScvJVpPA6sSxzToSA0nWxQlEoO8LD5je/FF2lYTyfjOD0PmgvjmOWBFdgwkJn9DZKJ lz1w== X-Gm-Message-State: AOAM533Gn7YPbHVat1x5R/kwKCtW5eKxpEo8r1bkhGZG0TKYj0rLZs42 mVZs1pR1BM8OZu/h5embD7kSAZJInPokMotkYJ4oXRGdWCl6cA== X-Received: by 2002:a17:902:be14:b029:e1:bec9:f4a7 with SMTP id r20-20020a170902be14b02900e1bec9f4a7mr7221275pls.21.1613037536770; Thu, 11 Feb 2021 01:58:56 -0800 (PST) MIME-Version: 1.0 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> <7d9c4fa854924bfc890e98da2d88ea36@hisilicon.com> In-Reply-To: <7d9c4fa854924bfc890e98da2d88ea36@hisilicon.com> From: Andy Shevchenko Date: Thu, 11 Feb 2021 11:58:40 +0200 Message-ID: Subject: Re: [Linuxarm] Re: [PATCH for next v1 0/2] gpio: few clean up patches to replace spin_lock_irqsave with spin_lock 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" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 10:42 PM Song Bao Hua (Barry Song) wrote: > > -----Original Message----- > > From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com] > > Sent: Thursday, February 11, 2021 3:57 AM > > 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. Yes, my main concern that the commit message style as "I feel it's wrong" is inappropriate to this kind of patch. The one you pointed out above is better, you may give it even more thrust by explaining why it was in the first place and what happened between the driver gained this type of spinlock and your patch. -- With Best Regards, Andy Shevchenko