Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp644681pxt; Thu, 12 Aug 2021 06:38:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVwKpjuRncv6OJcCpIx3O1+x21KdazThNCdh3FbWXqDtbQWmxD4Js944H3G9sJAf31t3JU X-Received: by 2002:a7b:c5cd:: with SMTP id n13mr15595213wmk.69.1628775510291; Thu, 12 Aug 2021 06:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628775510; cv=none; d=google.com; s=arc-20160816; b=qPGBZd8Wjm1eFl79B9CArScfu+8k9w4gFlGe7bTO8wEnhUWK4vsHhhVrpkH9p2IHXe QpRzJa2oQdztWfo40zHIUkhoum1X+LovtihmJ6S+Kyz4MAOfSMj3q2n+LhDhPS6DOQDL DUhxqU5pETonTTLEaRFNr0vRYIM+DmxcFj6qKbeoZAdxNksKqn0r7cqmKkugpU6oXHV3 Qa4wJqfbWZAjm0xY3x8uMgP+d1Vktk5Ktb4dMEAax2ZWsx6wSe5I3tn2189Ey0MotB1I cDdZ+9/OsDge//CmUYYwO1MrBYoCpgvIT5sCAbIsP6RjMHo80J41vysHb+Jksrs6PUb2 4jQg== 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:from; bh=NP6cvlR+XXFM9XH09gRGdacfjL9GzN3rBnojoB4MTY0=; b=QTCAGIPEwmiiKodrNySTW1RE8CFy8pTjoPSZFyh3skLarWdjXRzyjtJftAlDtxFAzL BsRa/vqjE3TQL8RTHVVH59X5eu4KWn4Z35ZtcI54W2wWh7qy7Iu12A6GvYdw5HLS0FqH u5bRQF3FRlMvuMknkSwlQ5XxBtS4RhbXeO4XMJ7p/yi/vnEfU356/nijMcy8t6SfhlRL WMXUhWhT0G/r4HHIdY6xpmOcHrwxZJyYJfnvY1vC+UbQcPtiQFNRRkAitXnqrio7TLIK sJhQiACfaIA/0tFvwVLXjRMdudqynr6t/60AcFcAIzMm5X9BO0om9WyEStGxYj+mdAUJ NkaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si2483964ejk.222.2021.08.12.06.38.04; Thu, 12 Aug 2021 06:38:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236474AbhHLNgp (ORCPT + 99 others); Thu, 12 Aug 2021 09:36:45 -0400 Received: from foss.arm.com ([217.140.110.172]:43226 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232356AbhHLNgm (ORCPT ); Thu, 12 Aug 2021 09:36:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45EB51042; Thu, 12 Aug 2021 06:36:17 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CE103F70D; Thu, 12 Aug 2021 06:36:16 -0700 (PDT) From: Valentin Schneider To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Lorenzo Pieralisi , Vincenzo Frascino Subject: Re: [PATCH v3 02/13] genirq: Define ack_irq() and eoi_irq() helpers In-Reply-To: <87a6ln9k7i.wl-maz@kernel.org> References: <20210629125010.458872-1-valentin.schneider@arm.com> <20210629125010.458872-3-valentin.schneider@arm.com> <87a6ln9k7i.wl-maz@kernel.org> Date: Thu, 12 Aug 2021 14:36:11 +0100 Message-ID: <877dgq9450.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/08/21 08:49, Marc Zyngier wrote: > On Tue, 29 Jun 2021 13:49:59 +0100, > Valentin Schneider wrote: >> +void eoi_irq(struct irq_desc *desc) >> +{ >> + desc->irq_data.chip->irq_eoi(&desc->irq_data); >> + >> + if (desc->irq_data.chip->flags & IRQCHIP_AUTOMASKS_FLOW) >> + irq_state_clr_flow_masked(desc); > > I just realised that this has a good chance to result in a mess with > KVM, and specially the way we let the vGIC deactivate an interrupt > directly from the guest, without any SW intervention (the magic HW bit > in the LRs). > I didn't think to consider those. It can't ever be simple, can it... > With this, interrupts routed to a guest (such as the timers) will > always have the IRQD_IRQ_FLOW_MASKED flag set, which will never be > cleared. > > I wonder whether this have a chance to interact badly with > mask/unmask, or with the rest of the flow... > Isn't it the other way around? That is, eoi_irq() will clear IRQD_IRQ_FLOW_MASKED regardless of what happens within chip->irq_eoi(), so we would end up with !IRQD_IRQ_FLOW_MASKED even if the (physical) IRQ remains Active (irqd_is_forwarded_to_vcpu() case). This does not entirely match reality (if the IRQ is still Active then it is still "flow-masked"), but AFAICT this doesn't impact our handling of forwarded IRQs: IRQD_IRQ_FLOW_MASKED is only really relevant from ack_irq() to eoi_irq(), and deactivation-from-the-guest (propagated via LR.HW=1) happens after that.