Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp59637pxb; Mon, 25 Apr 2022 05:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoHu2wVAyD9YW+snBNJC+0Nxm55+cq33dl7R7zJpC25xG8mX2piG8NGs32h8hN/sc460J0 X-Received: by 2002:a05:6402:288a:b0:425:c5b2:59d9 with SMTP id eg10-20020a056402288a00b00425c5b259d9mr14235076edb.412.1650891038898; Mon, 25 Apr 2022 05:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650891038; cv=none; d=google.com; s=arc-20160816; b=aJ5+Pog6RAA8B8sSMqegtShJv9/3FD2gIATGmEYPvKGwnqgr2JbsjtT+g8e9UVG6IA eTaHkxuCwYCBevMpMZeeViEj+oXpg3Ha0n11V7/gKggaZn55iiz1KbUdtWCWA4s82Mfi KdVsr683uJCU2zeiaev8eQWaQrwgo3MtGX+Rjd38mnZMrUCiJsKn4Rzvt9gLsBXjsU1t 2rOqfqWJMpnfmeMmRSjISX8uCT8aL9NYWmlks3Qi0Y1xmqGMPYg75RaO6RTcddTm8A5B o40SR0YB4OWg+rES8vXj4kvGb/3h67Yzqf2MPwHB5Q/Yl3GIlT3dbjeHSek6s7QQGFo5 Jnew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=myLhVjaqlxKQe4Fqq9j8cfDa5Oxkv3dnWKQC9Jk/N+c=; b=tfLri9KZdcQI8nDttEfvEFApPd2S1hyuAd5mTJp5/n6Hu6JopqCqMIsX9KCw2L3tQ/ wLMo51n0NjycKPJmICb9cTGQvPKr7o/q1lIdXGrfjfcMIKjf8sodYeK4+R6GzRQ0TuuS tJGmVPnQ1+fL9Ctu3+fDttSvVZ5eruuhd3nm+TLTId5fWHR6UzUR3/SO223pC326VMP+ HPqouhIf4cJVKzhZETqTwdJHewq7tuOhES0+9eycTD37EV4Are+ooIt9lJTASb6finn9 ox7dTVH9RVg336VPBchLJjL6CV2V9Xvt/Vk2g29AZwAdApFEvglgmTYJaC009OWI0GqQ tO+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZTbQ+0NZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="nh/H9H3x"; 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=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a056402330700b00425f0136002si1209329eda.309.2022.04.25.05.50.12; Mon, 25 Apr 2022 05:50:38 -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=@linutronix.de header.s=2020 header.b=ZTbQ+0NZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="nh/H9H3x"; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236113AbiDYJq0 (ORCPT + 99 others); Mon, 25 Apr 2022 05:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbiDYJqM (ORCPT ); Mon, 25 Apr 2022 05:46:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36983152C for ; Mon, 25 Apr 2022 02:43:05 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1650879784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=myLhVjaqlxKQe4Fqq9j8cfDa5Oxkv3dnWKQC9Jk/N+c=; b=ZTbQ+0NZQud0+yRQ1kS+uSL0eNT9sV2h6iiivxtFbRir1OBpV1GKinn48AMUvB8t2HKu3V vKTd82NuzgBaYEHKdMyRoU1CwqBtTsgcEMECEJdgthE3yBJzMkw3636Dw0O8XFzg+1xD7+ KkhIu3Vt4pu6Z7OmB7s6tuX3FwhD5NYYN+GTZ++C13ViM+0smTT0lRkir/KSWYwvVfftDE R+cHAs7pNnv71GCWf3mdn9dkNpCbXPkjJhObJvMKVdK2VllhDQAesaxIlzagfOm+wHxIUf F12MWeHyYMF2O0ExvzCohLyVkhgy0SSC4Tf6wR2xW0PElIAnDOG1Lb87Hew7wg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1650879784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=myLhVjaqlxKQe4Fqq9j8cfDa5Oxkv3dnWKQC9Jk/N+c=; b=nh/H9H3x+gKOFrRA/rHvqXSR3iXnujeD0+m/9rPrIMi/qkEwgOuBMOG8cBr6TYlmDleXPy 6fgkY7AC5QGmdfDg== To: Pingfan Liu Cc: linux-kernel@vger.kernel.org, Valentin Schneider , Peter Zijlstra , Frederic Weisbecker , Baokun Li , Mark Rutland , Steven Price , "Jason A. Donenfeld" , Yuan ZhaoXiong , YueHaibing , Randy Dunlap Subject: Re: [PATCH 7/9] irq: remove needless lock in takedown_cpu() In-Reply-To: References: <20220420140521.45361-1-kernelfans@gmail.com> <20220420140521.45361-8-kernelfans@gmail.com> <87y1zys9f7.ffs@tglx> Date: Mon, 25 Apr 2022 11:43:03 +0200 Message-ID: <87czh533dk.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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, Apr 25 2022 at 10:57, Pingfan Liu wrote: > On Thu, Apr 21, 2022 at 06:11:56PM +0200, Thomas Gleixner wrote: >> > - irq_lock_sparse(); >> >> Not everything is about RCU here. You really need to look at all moving >> parts: >> >> irq_migrate_all_off_this_cpu() relies on the allocated_irqs bitmap and >> the sparse tree to be in consistent state, which is only guaranteed when >> the sparse lock is held. >> > > For the irq which transfer from active to inactive(disappearing) after > fetching, desc->lock can serve the sync purpose. In this case, > irq_lock_sparse() is not needed. For a emergeing irq, I am not sure > about it. No, it's required for the free case. The alloc case is uninteresting. Care to look into the code? irq_free_descs() lock(sparse); free_descs(); bitmap_clear(allocated_irqs, from, cnt); unlock_sparse); As free_descs() sets the sparse tree entry to NULL, up to the point where bitmap_clear() finishes the state is inconsistent. Now look at irq_migrate_all_off_this_cpu() and figure out what happens when stop_machine() hits into the inconsistent state. This can be fixed, but not by making mysterious claims about RCU and desc->lock. Thanks, tglx