Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5920313iob; Tue, 10 May 2022 06:45:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn8/PEGDJph6azYa7E7hJ1bYUmBVdEoULYv5e/fPBYjmf80xTzphcZBlkSlTbX52yjEvhv X-Received: by 2002:a05:6402:22ef:b0:428:1037:b0d5 with SMTP id dn15-20020a05640222ef00b004281037b0d5mr23085616edb.60.1652190327898; Tue, 10 May 2022 06:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652190327; cv=none; d=google.com; s=arc-20160816; b=iKJLqKbCnozy7uUzMoh8pw+vREUfGN1ZdrbEwryitp5bw90g8HA57w09Ejpb+8+/VL eF4GfnZlzQBMK8B+j8HH036q7kVtZm1Ji/0xFgQy2f3HfoAnK8EK6wLmsDdAIibSrhm3 pxTjk9KCJSgf+w3UHQEnrBKgQOkGjSFaIGwyhV0HVmh7yBvMyzO9kXxNSf1FG3CROg93 H4M3bf4A7kl0K7dR+B1mblfk1OUHH/g0uE49/fX3nrsYx9azaizZgibBuIrLcE7irctC snKQAdR+2tN/NaE8RzpM4nEf+XOmt/r+CIQ1S/AiAiyjNdcPjzSKXdr4EgmFeFivw5Sk CJJw== 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=ZSfFmrkwvSS3eqPLQm0swvWT7J06O/4HwkliRm/F5SM=; b=q6fQ9aarb3heKTYjfBYknPHo0EQSrL/STi0REAFcScQXDUw42plSBNAvrXH6NCdrUS OGQifS72ikEOzSpuoMdc4ugsYd4B5JFebw/vPMblZXhlvE33yHwN+anDLmjnu8sZR626 i3lb7qcP7vXvofbZrp6LulshvBfknMbi8bY3t2LajsT0PQ0hFvNyxEIqrlLKBKhkaBeW e1dZqXsSb3Xoi1wEAAIEJcLJkvSyGTK0QRp4aToIrPWi+e1WARaVAPqoOtzsjAcZAEQ9 Iac+SEYTLWOTFh0t4nhd81UK+w14LpVIcSIAF0V/LMkHNqJcRMJSA0UFqZTjxOMMdaXB vlFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OEiCbePt; dkim=neutral (no key) header.i=@linutronix.de; 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 d22-20020a1709061f5600b006dfb5687a24si16872888ejk.499.2022.05.10.06.45.03; Tue, 10 May 2022 06:45:27 -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=OEiCbePt; dkim=neutral (no key) header.i=@linutronix.de; 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 S241107AbiEJLlw (ORCPT + 99 others); Tue, 10 May 2022 07:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241097AbiEJLlu (ORCPT ); Tue, 10 May 2022 07:41:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42F81E02A1; Tue, 10 May 2022 04:37:53 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652182672; 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=ZSfFmrkwvSS3eqPLQm0swvWT7J06O/4HwkliRm/F5SM=; b=OEiCbePtGN9R41EOW696ItL6C4v7YwKobu5uOVsB+L+o+iwswSqbzIdwvnOziDbZ/VvoZU dOyb+BpTrmbpa+nlf0l1p/98oqfVvrbO3G/ssGco8YHzPLy7B/m6yG2xzm0mRVZmE2kvP6 QrZ2A52cNzvhHgwKZbTkVNmLd+t1Zm49zIzaMGYqztZKGIINFKV0q0rk7oB7k683RF+EGU W/kkIrC5nysY83FAUW84NjiJH5hHfFJmEAsMrC/zzG94wkuarbvtg6t1iW+wvre9xztaoZ rndYiVERG2rjQrRQnY7Ip35MrVVS6xwC+gYN6tmICzc2qH7cJ0BHwFs4LYrI7Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652182672; 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=ZSfFmrkwvSS3eqPLQm0swvWT7J06O/4HwkliRm/F5SM=; b=NScDfioIUhsbAhEVbrY6xPt32+yRjKpYvluxU1W6Kd7vfWHLaAGWWlIY/pD9y/R6fNiPcp etPv5GBX4lUEqlBw== To: Thomas Pfaff Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Subject: Re: [PATCH v3] irq/core: synchronize irq_thread startup In-Reply-To: <87pmklpqod.ffs@tglx> References: <552fe7b4-9224-b183-bb87-a8f36d335690@pcs.com> <87mtg0m2jb.ffs@tglx> <87pmklpqod.ffs@tglx> Date: Tue, 10 May 2022 13:37:51 +0200 Message-ID: <87mtfppqi8.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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Tue, May 10 2022 at 13:34, Thomas Gleixner wrote: > On Tue, May 10 2022 at 10:43, Thomas Pfaff wrote: >> It can be done only before the interrupt thread is stopped, and free_irq() >> itself is already taking care about synchronizing, no matter if its done by >> __synchronize_hardirq() or by synchronize_irq(), like it was before commit >> 519cc8652b3a. > > No, it does not really take care about it. It can return with > irq_desc::threads_active > 0 due to the interrupt thread being stopped > before reaching the thread function. Think about shared interrupts. Duh. Hit send too fast. It does matter whether the synchronization is done via __synchronize_hardirq() or via synchronize_irq(). The latter ensured that the thread reached the thread function and handled the pending wakeup _before_ kthread_stop() become true. So the fix is required to undo the damage created by 519cc8652b3a. The synchronize_irq() after free_irq() is a completely different problem. Thanks, tglx