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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFB0AC433E1 for ; Fri, 24 Jul 2020 06:18:29 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DCE420714 for ; Fri, 24 Jul 2020 06:18:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DCE420714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BCfCQ6Nw7zDsLx for ; Fri, 24 Jul 2020 16:18:26 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=atrajeev@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BCf9X44pSzDrqc for ; Fri, 24 Jul 2020 16:16:46 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06O63REN056865; Fri, 24 Jul 2020 02:16:37 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32facequ3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 02:16:37 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06O63lKS058736; Fri, 24 Jul 2020 02:16:36 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 32facequ2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 02:16:36 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06O6EIAc002103; Fri, 24 Jul 2020 06:16:34 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma05fra.de.ibm.com with ESMTP id 32brq83tw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jul 2020 06:16:34 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06O6GWI528114984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jul 2020 06:16:32 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA4BDA405B; Fri, 24 Jul 2020 06:16:31 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4831FA4064; Fri, 24 Jul 2020 06:16:29 +0000 (GMT) Received: from [9.85.89.111] (unknown [9.85.89.111]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 24 Jul 2020 06:16:29 +0000 (GMT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state From: Athira Rajeev In-Reply-To: <1884dcea-9ecd-a1f3-21bb-213c655e2480@ozlabs.ru> Date: Fri, 24 Jul 2020 11:46:26 +0530 Content-Transfer-Encoding: quoted-printable Message-Id: <6BAF6D26-A316-4F0A-AF10-5E43B2C09B90@linux.vnet.ibm.com> References: <20200723105615.1268126-1-npiggin@gmail.com> <20200723114010.GO5523@worktop.programming.kicks-ass.net> <1595506730.3mvrxktem5.astroid@bobo.none> <1884dcea-9ecd-a1f3-21bb-213c655e2480@ozlabs.ru> To: Alexey Kardashevskiy X-Mailer: Apple Mail (2.3608.80.23.2.2) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-24_01:2020-07-24, 2020-07-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007240044 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Nicholas Piggin , Ingo Molnar , Will Deacon Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" > On 24-Jul-2020, at 9:46 AM, Alexey Kardashevskiy = wrote: >=20 >=20 >=20 > On 23/07/2020 23:11, Nicholas Piggin wrote: >> Excerpts from Peter Zijlstra's message of July 23, 2020 9:40 pm: >>> On Thu, Jul 23, 2020 at 08:56:14PM +1000, Nicholas Piggin wrote: >>>=20 >>>> diff --git a/arch/powerpc/include/asm/hw_irq.h = b/arch/powerpc/include/asm/hw_irq.h >>>> index 3a0db7b0b46e..35060be09073 100644 >>>> --- a/arch/powerpc/include/asm/hw_irq.h >>>> +++ b/arch/powerpc/include/asm/hw_irq.h >>>> @@ -200,17 +200,14 @@ static inline bool arch_irqs_disabled(void) >>>> #define powerpc_local_irq_pmu_save(flags) \ >>>> do { \ >>>> raw_local_irq_pmu_save(flags); \ >>>> - trace_hardirqs_off(); \ >>>> + if (!raw_irqs_disabled_flags(flags)) \ >>>> + trace_hardirqs_off(); \ >>>> } while(0) >>>> #define powerpc_local_irq_pmu_restore(flags) = \ >>>> do { \ >>>> - if (raw_irqs_disabled_flags(flags)) { \ >>>> - raw_local_irq_pmu_restore(flags); \ >>>> - trace_hardirqs_off(); \ >>>> - } else { \ >>>> + if (!raw_irqs_disabled_flags(flags)) \ >>>> trace_hardirqs_on(); \ >>>> - raw_local_irq_pmu_restore(flags); \ >>>> - } \ >>>> + raw_local_irq_pmu_restore(flags); \ >>>> } while(0) >>>=20 >>> You shouldn't be calling lockdep from NMI context! >>=20 >> After this patch it doesn't. >>=20 >> trace_hardirqs_on/off implementation appears to expect to be called = in NMI=20 >> context though, for some reason. >>=20 >>> That is, I recently >>> added suport for that on x86: >>>=20 >>> https://lkml.kernel.org/r/20200623083721.155449112@infradead.org >>> https://lkml.kernel.org/r/20200623083721.216740948@infradead.org >>>=20 >>> But you need to be very careful on how you order things, as you can = see >>> the above relies on preempt_count() already having been incremented = with >>> NMI_MASK. >>=20 >> Hmm. My patch seems simpler. >=20 > And your patches fix my error while Peter's do not: >=20 >=20 > IRQs not enabled as expected > WARNING: CPU: 0 PID: 1377 at /home/aik/p/kernel/kernel/softirq.c:169 > __local_bh_enable_ip+0x118/0x190 Hi Nicholas, Alexey I was able to reproduce the warning which Alexey reported using = perf_fuzzer test suite.=20 With the patch provided by Nick, I don=E2=80=99t see the issue anymore. = This patch fixes the warnings I got with perf fuzzer run. Thanks Nick for the fix.=20 Tested-by: Athira Rajeev >=20 >=20 >>=20 >> I don't know this stuff very well, I don't really understand what = your patch=20 >> enables for x86 but at least it shouldn't be incompatible with this = one=20 >> AFAIKS. >>=20 >> Thanks, >> Nick >>=20 >=20 > --=20 > Alexey