Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3090540ybd; Fri, 28 Jun 2019 02:41:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsXqEORWlkJrCF1a2J1rm/qylau5JbXF2670pZDvbVSoWXAB+gIrTsrVFexxO8nm28aIHV X-Received: by 2002:a17:902:a516:: with SMTP id s22mr10190851plq.178.1561714894419; Fri, 28 Jun 2019 02:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561714894; cv=none; d=google.com; s=arc-20160816; b=YE2KmXyvQ1NTS2f/7bDb1KjkHS0Pp9DwBTr/l93XqU1dPRK3GnxC+TyZH2GkSyahaJ wrzlImyuwJRwrpNY7O7/x9aaYdc5o5PGFOF2ZThYhxTY0y85v6czK2u4cNeMGI2NViXO 7mYYwU+XK1jaG3UsEy/H7mcv9t1P6pdO90Cty8rbjGBnoMRJusyjvCB1CCrlcNfptzz3 K5lfwHplFzdDnD4YAP8cuMl3LGB16xkWl3A7VG76eSRAqqCZOLdtVSBq/YADOXQmxO7l JbCGYcdcry881fkJ/xEOrVzAB5/bG6vn8+pn5d8YtiQNxSnzQdpOXkCc8Q3+O0+jn9X4 wjBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=LLAqR4MX9+lYg/xKEihGsrIAbtHe1VGchR74kvgwVyo=; b=NS4ap8GJLsTJwqVydnaqX3FEA5rwk9TZKyHxMiP01HTtdU+iC2s4x4akzkTEB3STmz X1vEYmRzWAIUiKdlvZTzrQjzlj/DeIT146wcnTBVSo1veU9Ls1LNZIEm9XHGN7WLjfWH Hbm7JdxrtkX21F2BVPcdh96xT5ssfdzNCKomnjIEe4XLtQw+jeIe4vP+ToGvugoJNhAn NjgvnGT4nU1WErxGiTUo/ty2hUzCFXlUFKLKllKSPGy3gxONXGe2LeVkA7Ch4r8U60D6 L+ts7eY2MqLw5DyhljMUKkzQOhloH0xEuPudwkcvN3ijvF3YxkXyTaibR7ChT2yFZPJU 4bRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si1650713plb.302.2019.06.28.02.41.18; Fri, 28 Jun 2019 02:41:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfF1JlI (ORCPT + 99 others); Fri, 28 Jun 2019 05:41:08 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:34792 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbfF1JlH (ORCPT ); Fri, 28 Jun 2019 05:41:07 -0400 Received: from p5b06daab.dip0.t-ipconnect.de ([91.6.218.171] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hgnNN-0008IE-FH; Fri, 28 Jun 2019 11:41:01 +0200 Date: Fri, 28 Jun 2019 11:41:00 +0200 (CEST) From: Thomas Gleixner To: Marc Zyngier cc: LKML , x86@kernel.org, Robert Hodaszi , Vadim Pasternak , Ido Schimmel , Greg Kroah-Hartman , linux-serial@vger.kernel.org Subject: Re: [patch 2/5] genirq: Add optional hardware synchronization for shutdown In-Reply-To: Message-ID: References: <20190625111353.863718167@linutronix.de> <20190625112405.666964552@linutronix.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Marc, On Fri, 28 Jun 2019, Marc Zyngier wrote: > On 25/06/2019 12:13, Thomas Gleixner wrote: > > > > int (*irq_set_affinity)(struct irq_data *data, const struct cpumask *dest, bool force); > > int (*irq_retrigger)(struct irq_data *data); > > + int (*irq_inflight)(struct irq_data *data); > > I wonder how different this irq_inflight() is from the irq_get_irqchip_state() > that can already report a number of states from the HW. > > It is also unclear to me how "in flight" maps to the internal state of > the interrupt controller: Is it pending? Acked? If the interrupt has been > masked already, pending should be harmless (the interrupt won't fire anymore). > But seeing it in the acked would probably mean that it is on its way to being > handled, with a potential splat. in flight means that the interrupt chip (in the offending case the IO-APIC) has that interrupt raised internally _AND_ already propagated to the destination CPU (in this case the local APIC of the destination). The CPU has accepted the interrupt and now the chip is in a state where it waits for it to be acknowledged. If we proceed in that state then the destination CPU will eventually handle it _after_ all the resources are freed. But that means that the in flight/wait for acknowledge state becomes stale because the handling CPU does not find the connection to that chip anymore. > > + /* > > + * If requested and supported, check at the chip whether it > > + * is in flight at the hardware level: > > + */ > > + if (!inprogress && sync_chip && chip && chip->irq_inflight) > > + inprogress = chip->irq_inflight(irqd); > > To expand on what I was trying to exptree above, I wonder if that would > be similar to in effect to: > > if (!inprogress && sync_chip && chip && chip->irq_get_irqchip_state) > chip->irq_get_irqchip_state(irqd, IRQCHIP_STATE_ACTIVE, &inprogress); Ah, indeed that could be mapped to it. I'm happy to get rid of the extra callback. Now the question is whether this would would give an headache for any of the chips which already implement that callback and whether it needs to become conditional on the trigger type at the core level. For the IO-APIC this state is only defined for level type which makes sense as edge is fire and forget. Thanks, tglx