Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5871886iob; Tue, 10 May 2022 05:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcKJvfUxHkAdw+XfVxwic/ZnjTq4nsK1Of0MqQojL5qsxP0eGIcUMYcke+olON55BlURfj X-Received: by 2002:a17:90b:4c8a:b0:1dc:6ff1:e2e1 with SMTP id my10-20020a17090b4c8a00b001dc6ff1e2e1mr22825659pjb.217.1652186877994; Tue, 10 May 2022 05:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652186877; cv=none; d=google.com; s=arc-20160816; b=Y2jYCrcByGz6l/dd9NYOty3pKY6fFMK3mJrzRzrWLE7xzGlmQn90A0D2SmuT7YfhWt 4/YdU3Q78n2JypKwwfDfpgwMTL1HQWhhgf47tbC5Fe7gK8d8kbwM6CRo4wTfGuF84XEL yGvu++dzV6AlXopX6nGFqt0zv9WOI6Za4I1R2ObWQZkwTt/IFauvrmze03ymJGqLVMdr 2b+FFarTKc2x5LKpiAtdY+ljcHU33UFHTc17IVgKM9yNxHkhFzEb7rSNtw7yDOBIZSWY mZ0kCZGJLABk/8dCqZSc3sBHSe9Lja2FxTDAB/YyQYHpDv1wBI8OB2BmWvftD1g41Bom g02A== 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=TC9/XshEOTpfSw/rNl+3rL4L7Eu/YKJZMaJhwEGZCIA=; b=qf/5FYs/GPjX5j0OixPEWJuya5qGgWo0E8vn0frw7rn7jhCLAW+fHrXqdx24eS2Dty +FTzQlvekKLX0w6gIHoM3jqEu5YtZKx+L/9PKdr953LZFX1PCox+7DbDpHpnIxV4tXzq KMcP2PORJYmRJ+RWNWs3FHJvKp1JyCXa7JsEoQU447CK30wgDeNWv2ZoQ536mpK1qGDd UzfL7Jo6GTxvy+t3x3bav/PPv/ryQ5N1XR2jJg/9x5WtH7UjNMgUHxEuvJ3etiy8XsXC WAxV1hmUBqc/LzXFBxZhTUqiXgK83dRWc0jppmrCYORVSKcJtKRM0lk1VsFPa/Y4lKt9 Y2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1+BO+CV9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 b67-20020a633446000000b003c14ba0c566si18818219pga.820.2022.05.10.05.47.42; Tue, 10 May 2022 05:47:57 -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=1+BO+CV9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S241085AbiEJLiT (ORCPT + 99 others); Tue, 10 May 2022 07:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241114AbiEJLiM (ORCPT ); Tue, 10 May 2022 07:38:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6291B53B7F; Tue, 10 May 2022 04:34:13 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652182450; 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=TC9/XshEOTpfSw/rNl+3rL4L7Eu/YKJZMaJhwEGZCIA=; b=1+BO+CV9mIpecQFKN1qq1b9aXH6xkTIXtonVxkct4HUBfahFp3qBTY6X98jyErGhSTb8zb Je8ggl97zDtnWszjuoiXIYpP02pk+YHGp+3l6oLrnmaHZy7w8rcSNuMAXeR4GroeczwH68 EaNXCbsSNn9+S3n3liSnQmjIxtURB5owKn8NbWjgSq2OW7fhPTs/NK1oxSIKG27GahOF8p M1CKhTqokNsZVUtWvHHJRdFGiEoPt3erKAxHd5CtUUeBL6nJYv/jMRTkMLsroxV7Pk3ACl SS6ONEDp8qhnOSkcfNc8JmJxQ9u8FanjLdOReOPwYScmr99yc/PHzLJgSf6rrQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652182450; 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=TC9/XshEOTpfSw/rNl+3rL4L7Eu/YKJZMaJhwEGZCIA=; b=W9IZ6qpE6cR23ovgS7fHMwaerLRRSw7mVixYuAX4ZIFZkA6BEDJh2wsLmCsWK9LjXpNLzn gyIxUsR9FKM6InDQ== 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: References: <552fe7b4-9224-b183-bb87-a8f36d335690@pcs.com> <87mtg0m2jb.ffs@tglx> Date: Tue, 10 May 2022 13:34:10 +0200 Message-ID: <87pmklpqod.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 10:43, Thomas Pfaff wrote: > On Mon, 2 May 2022, Thomas Gleixner wrote: >> On Mon, May 02 2022 at 13:28, Thomas Pfaff wrote: >> This comment made me look deeper because I expected that free_irq() >> would hang. >> >> But free_irq() stopped issuing synchronize_irq() with commit >> 519cc8652b3a ("genirq: Synchronize only with single thread on >> free_irq()"). And that turns out to be the root cause of the problem. >> I should have caught that back then, but in hindsight .... >> > > Sorry for coming back to this again late, but this makes me believe that > the real problem for the freeze in setserial is that uart_port_shutdown() > is calling synchronize_irq() after free_irq(), which is illegal in my > opinion. Well, I'd say pointless. But it's not the real problem, it's the messenger which unearthed the underlying issue. Even if you remove that call, the underlying problem persists because the interrupt descriptor is in inconsistent state. > 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. > If it is called after free_irq(), the context is already lost. That's correct. > I am not sure about all the other drivers, but at least serial_core should > be fixed if you agree. Yes, that call is pointless. Thanks, tglx