Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2419328iof; Wed, 8 Jun 2022 04:43:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw04Pu4EG+uOTTVdjTJSrr1sCo+AznPgR45Ec29/wZrR3L08Oy0O6ZNKox3lOwd4/qIYuHs X-Received: by 2002:a05:6a00:1152:b0:4be:ab79:fcfa with SMTP id b18-20020a056a00115200b004beab79fcfamr100768450pfm.3.1654688604384; Wed, 08 Jun 2022 04:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654688604; cv=none; d=google.com; s=arc-20160816; b=v10i1OelRUWfGdT1ilLbjYn43Nn8gcaFbxa/C8D+/x1kZfpmx1Ix27kZlYFVtfN/DU E4NDUfQRC9UajLE3ehyZBGb7zyndvuOAuLJOFwmvr1qdZo/HhGgT8D1c+jhidu1htE1S ydiTdtmgnLVgZu7Hs/6JClbs7/jKMwwraAljL/z118Xz2ieVuyhPzfp5ACTIT4YUhx+b 8bYyLgQrbbO2bdCNVfDQMH7WhRx1pxJdc4qZAp8d9bRk7E2L5BLsMzb8oe6yYHaqIO7E Uv3RBNTNw5CxjcenKuZ74i46enFCOTJhYBPUqvOpRakg75iesH/kv45b8gRP9D3yazq8 qZCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=Pc8sxjRlyZLiUc2vjV2mNnQdPSrQGggcOwRrmtPvRmQ=; b=f2t3MzBcGf+FQnSYPaQJUmXu7TuXqSLMVH3JN13JU/serRTvZbT/3ZDvf01XbEu42j Zx0XqXnlkMPYQywN0pPxjhtIC5LcmVLLQrI2m+nAgVTpTZG5QGDDFy04I1W07j42y559 idXijskgdXzoJwjqhVPJsFzsQuTBfbh6A7ylqLk17Mo4EVPCWpXdTcpPbnmIeGZ3JJX6 KR1WHbYwLWztiN4hX4WdyCdy0vGTu4at1JweP5EIo3+aNjEBNV8ofp/PtksGAD3Frau8 yxP19oMSqVoJPa9+MI0TffiKGwtdQYqDkZX2JEh+V66a10TE7cdvZBHhs0CU7CKtDV4J rAew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v4-20020a17090a898400b001e2e267a475si25403698pjn.129.2022.06.08.04.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 04:43:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76122248557; Wed, 8 Jun 2022 04:12:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238253AbiFHLLm (ORCPT + 99 others); Wed, 8 Jun 2022 07:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238228AbiFHLKo (ORCPT ); Wed, 8 Jun 2022 07:10:44 -0400 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3D712200B2; Wed, 8 Jun 2022 04:10:03 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id l204so35903331ybf.10; Wed, 08 Jun 2022 04:10:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Pc8sxjRlyZLiUc2vjV2mNnQdPSrQGggcOwRrmtPvRmQ=; b=qe4IyOMZ1enGiEf1hklCCFUi3b60/6BlA5Lg/UspYBtAOyv0XMu9/oKSbuc3JFHEYf K5HVWjr13x2ZZqbt6+Qgb0IhV/GR4LEH2dKXjk8WnFsnvCIsp7+DQbmAsd6VWECEJvbK 4dhpMtk5cK2w69gqeS9/p/96DXD4OGZ4GI6JtQcfG/CVNgATHQg/HRSIBYR+czqTGTeU Om5DmRJ8AqmFUEVwY/uWkeApI7PEUjazHu+sZYZ5GRaQq7421CHYTLNR6BVA+qf83n9J w5EkumHngZxtsvCUBkV00gXXseSCSfN1A8KVNKKYJBhg44gP1DliJn771LN6Cgbr+css LNqg== X-Gm-Message-State: AOAM531ouiHgI3ieRHcSXolGy+SBFr/HQxFyrRxFaZiQKFvTizm/yGR7 eUw9Aiq1P1E8QvW42APNoJ/wj0PudKoXEqEmnOk= X-Received: by 2002:a25:84ca:0:b0:65c:b5a4:3d0a with SMTP id x10-20020a2584ca000000b0065cb5a43d0amr34085830ybm.137.1654686601554; Wed, 08 Jun 2022 04:10:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 8 Jun 2022 13:09:50 +0200 Message-ID: Subject: Re: [PATCH net v2 0/1] PHY interruptus horribilis To: Lukas Wunner Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Andrew Lunn , Heiner Kallweit , Russell King , Marek Szyprowski , Thomas Gleixner , "Rafael J. Wysocki" , Len Brown , Pavel Machek , netdev , Steve Glendinning , UNGLinuxDriver@microchip.com, Oliver Neukum , Andre Edich , Oleksij Rempel , Martyn Welch , Gabriel Hojda , Christoph Fritz , Lino Sanfilippo , Philipp Rosenberger , Ferry Toth , Krzysztof Kozlowski , Linux Samsung SoC , Linux Kernel Mailing List , Linux PM Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Jun 8, 2022 at 12:35 PM Rafael J. Wysocki wrote: > > On Wed, Jun 8, 2022 at 11:52 AM Lukas Wunner wrote: > > > > Andrew Lunn (PHY maintainer) asked me to resend this patch and cc the > > IRQ maintainer. I'm also cc'ing PM maintainers for good measure. > > > > The patch addresses an issue with PHY interrupts occurring during a > > system sleep transition after the PHY has already been suspended. > > > > The IRQ subsystem uses an internal flag IRQD_WAKEUP_ARMED to avoid > > handling such interrupts, but it's not set until suspend_device_irqs() > > is called during the ->suspend_noirq() phase. That's too late in this > > case as PHYs are suspended in the ->suspend() phase. And there's > > no external interface to set the flag earlier. > > Yes, it is not there intentionally. > > Strictly speaking, IRQD_WAKEUP_ARMED is there to indicate to the IRQ > subsystem that the given IRQ is a system wakeup one and has been left > enabled specifically in order to signal system wakeup. It allows the > IRQ to trigger between suspend_device_irqs() and resume_device_irqs() > exactly once, which causes the system to wake up from suspend-to-idle > (that's the primary use case for it) or aborts system suspends in > progress. > > As you have noticed, it is set automatically by suspend_device_irqs() > if the given IRQ has IRQD_WAKEUP_STATE which is the case when it has > been enabled for system wakeup. > > > As I'm lacking access to the flag, I'm open coding its functionality > > in this patch. Is this the correct approach or should I instead look > > into providing an external interface to the flag? > > The idea is that the regular IRQ "action" handler will run before > suspend_device_irqs(), so it should take care of signaling wakeup if > need be. IRQD_WAKEUP_ARMED to trigger wakeup when IRQ "action" > handlers don't run. That said IMV there could be a wrapper around suspend_device_irq() to mark a specific IRQ as "suspended" before running suspend_device_irqs(), but that would require adding "suspend depth" to struct irq_desc, so the IRQ is not "resumed" prematurely by resume_device_irqs(). And there needs to be an analogous wrapper around resume_irq() for the resume path. Does the single prospective user justify this?