Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp194660rwi; Sun, 9 Oct 2022 21:33:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eHf5v6d7w7BrUgbKoWL74S7Ge/ImsTvSBY375GPk6uLgglHf8Y4k3KusIopdOyyCk4J5Z X-Received: by 2002:a17:906:fd82:b0:770:7e61:3707 with SMTP id xa2-20020a170906fd8200b007707e613707mr12972852ejb.143.1665376438821; Sun, 09 Oct 2022 21:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665376438; cv=none; d=google.com; s=arc-20160816; b=kcKK0VwRlo7BiO9gB6RYXz/jk5WQr1jroJdajvcuNS3m4761+dG9Dgwh8DGDztvhMM V9CdH79RKBaT5PdOfP6Bqtmrln7hNGuKCYFlyha/JqRLZ8xhZtT4mWu8pfdP1GqukRZC 1ed06RjgNWE/86gSBDzQgr51oiPXn3Ee/UdwYApFjLpdG8xTlzrV8QlaJjJ0pd8tEmTa tpatZbG9X/0wmMGF3A8wwfiS6U/Q2OehKJZI+Eqsn/H1uw7Dib7OJiNZFHhFojLMfZbD T9f+lXFe7LvDgA6WfaaDy8OFglTzpovcU7CsUFzoXPrP1bjV2jvQ/vNrAmKKwsRL+NmE /ChQ== 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=vAH4rya06AUuc9cGIVqpG9iUHugeEm5tYJ/niYtbVRY=; b=Sl6rpUjMoBoxuWQafF2Q6awB1RQPsdlShYm7MhYYsiOucR8+E6q//A6t6bcYPjPFbo 4QqaOecr5MiV7+lW8+kvQRniE0vlSl3D1mP8G+I20aKn3ps0lXyy0tzM5DzFTGfltWDp Bdi7iyxHIHwAjcrIpc3P77d6kfbadaTdcu0IngBuvhDqJAA+bCyvL3pEWHd2w0c5KB27 yjYM3SGJp7ojIA/WmqntKMj7Y+W5A9uVvxcVGqSrVDz8sIIxQQMcXU7CbokmAvI7YedP B8FJNAun4vtW/9w4IrfTLl8WXSQNCffh1k/6t5tINf7e09CfaAnr+aCP8yqNQzZZegcW TJDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MLxVgjqo; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm27-20020a05640222db00b004593671898esi8723618edb.611.2022.10.09.21.33.33; Sun, 09 Oct 2022 21:33:58 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MLxVgjqo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbiJJEZe (ORCPT + 99 others); Mon, 10 Oct 2022 00:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiJJEZa (ORCPT ); Mon, 10 Oct 2022 00:25:30 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D9D42AEA; Sun, 9 Oct 2022 21:25:29 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id l4so9340110plb.8; Sun, 09 Oct 2022 21:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vAH4rya06AUuc9cGIVqpG9iUHugeEm5tYJ/niYtbVRY=; b=MLxVgjqoSNusMoE1FuWBp1q556Q//9g3yq35wJGCKcTbRZz58TywpUOayoe9r+tXBw 6h2JKPPCtaG41E6WtcFxo2hexOQFb3i/eS968uKnerE9TPzv1J6xW28Y93kuTCpIV3he nrTiA91WghpRf0uEuHTfpYggCKaaZh9iq0mHIqQu9S3xs8wRCA0mRVPiFPCcZzu3c2ug 9idRwLBqTgyNVhSh9lrTU5BuxcqVFJdYKE/PGpRorh0rgG457xKEDiPt121LjCcQ1lhw HO7ptOLO/EAQKfoH9Z8Mcl9k+522j0CFRDVsWPSMnPGA7UkRUnhZ4O9HDdzVxpu6/mEp JhcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vAH4rya06AUuc9cGIVqpG9iUHugeEm5tYJ/niYtbVRY=; b=6cz8ISoGtNiUz0okpsOtMtwpfjAiapEH0sIjH8sLdojEcANmOZnPrEAARAJ9cEkZVp eULaTvI64moYve1LR13Px/n0thxv47YLMpxU71JfYiplCW5p65hhmgxmrH/tumuZRqPq B7buLJDoUmpvWfKV21gbHIO/vl/7UknFFhi/vjeIvxU9ZiXy/GpKTy5R748MJenluB/m rtcCckfKhY4qVkBRIhmVZS5L33iGmEpG4cSii/tVaP3xaJnapO0wb3BfaG34DgVaeu3S 6+MxAPWuB+Sws0pmaxBxyVbqzipxel+tD79pRhlKCzfgCrsyjFaBvp65QmgFtHG5bA07 WbVw== X-Gm-Message-State: ACrzQf2Q3ATkZMzAxQgCWJ5sDqFc6ueyxF31iMaiTsNfDDdyRG9DlysZ ZtKHlWqoTjwG/95Klr/AFWI9t4eHPYvHiX/38+4= X-Received: by 2002:a17:90a:7305:b0:20a:6ffd:1f8e with SMTP id m5-20020a17090a730500b0020a6ffd1f8emr29173215pjk.69.1665375928676; Sun, 09 Oct 2022 21:25:28 -0700 (PDT) MIME-Version: 1.0 References: <20220927014823.11439-1-zhouzhouyi@gmail.com> In-Reply-To: From: Zhouyi Zhou Date: Mon, 10 Oct 2022 04:25:17 +0800 Message-ID: Subject: Re: [PATCH linux-next][RFC] powerpc: avoid lockdep when we are offline To: Nicholas Piggin Cc: mpe@ellerman.id.au, christophe.leroy@csgroup.eu, atrajeev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, lance@osuosl.org, paulmck@kernel.org, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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, Oct 10, 2022 at 11:49 AM Nicholas Piggin wrote: > > On Thu Sep 29, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > > On Wed, Sep 28, 2022 at 10:51 AM Nicholas Piggin wrote: > > > > > > On Wed Sep 28, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > > > > Thank Nick for reviewing my patch > > > > > > > > On Tue, Sep 27, 2022 at 12:25 PM Nicholas Piggin wrote: > > > > > > > > > > On Tue Sep 27, 2022 at 11:48 AM AEST, Zhouyi Zhou wrote: > > > > > > This is second version of my fix to PPC's "WARNING: suspicious RCU usage", > > > > > > I improved my fix under Paul E. McKenney's guidance: > > > > > > Link: https://lore.kernel.org/lkml/20220914021528.15946-1-zhouzhouyi@gmail.com/T/ > > > > > > > > > > > > During the cpu offlining, the sub functions of xive_teardown_cpu will > > > > > > call __lock_acquire when CONFIG_LOCKDEP=y. The latter function will > > > > > > travel RCU protected list, so "WARNING: suspicious RCU usage" will be > > > > > > triggered. > > > > > > > > > > > > Avoid lockdep when we are offline. > > > > > > > > > > I don't see how this is safe. If RCU is no longer watching the CPU then > > > > > the memory it is accessing here could be concurrently freed. I think the > > > > > warning is valid. > > > > Agree > > > > > > > > > > powerpc's problem is that cpuhp_report_idle_dead() is called before > > > > > arch_cpu_idle_dead(), so it must not rely on any RCU protection there. > > > > > I would say xive cleanup just needs to be done earlier. I wonder why it > > > > > is not done in __cpu_disable or thereabouts, that's where the interrupt > > > > > controller is supposed to be stopped. > > > > Yes, I learn flowing events sequence from kgdb debugging > > > > __cpu_disable -> pseries_cpu_disable -> set_cpu_online(cpu, false) = > > > > leads to => do_idle: if (cpu_is_offline(cpu) -> arch_cpu_idle_dead > > > > so xive cleanup should be done in pseries_cpu_disable. > > > > > > It's a good catch and a reasonable approach to the problem. > > Thank Nick for your encouragement ;-) > > > > > > > But as a beginner, I afraid that I am incompetent to do above > > > > sophisticated work without error although I am very like to, > > > > Could any expert do this for us? > > > > > > This will be difficult for anybody, it's tricky code. I'm not an > > > expert at it. > > > > > > It looks like the interrupt controller disable split has been there > > > since long before xive. I would try just move them together than see > > > if that works. > > Yes, I use "git blame" (I learned "git blame" from Paul E. McKenny ;-) > > ) to see the same. > > and anticipate your great works! > > I was thinking you could try it and see if it works and what you find. > If you are interested and have time to look into it? I am interested! and I have time ;-) Thank Nick for your trust in me! I am going to submit my babyish work in about a month (counting the rcutoture tests time), and thank you in advance for your patience. Cheers Zhouyi > > Thanks, > Nick