Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp103682lqc; Thu, 29 Feb 2024 11:31:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUn/8UqjdVrRQy3A87fURiNVGwBy6jkHoPrsYFIQK6hgBBT/6r8EGeL+1V6KM07P16s4lw416OFkubp9/pIZsBtDFUp7mAv5Rw8Nw3twA== X-Google-Smtp-Source: AGHT+IEgTCXwfaFUHYlP23poQwtUpkZdbgHsND4cCvE2BsHCvOAIO2Da4Wrfa7CoyLntqzB6AJ3D X-Received: by 2002:a17:902:f944:b0:1db:fc18:2da5 with SMTP id kx4-20020a170902f94400b001dbfc182da5mr3075882plb.30.1709235110753; Thu, 29 Feb 2024 11:31:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709235110; cv=pass; d=google.com; s=arc-20160816; b=k3Sb7RtXwKBDZh6QbC4k49igSxIdNoSWGLsH3T+dDA3IynP+4DtufnkioFP69CZUby D2HqsKAoJiFDQH8sVRzbs0kiTvS84xNQVjfo9gdlEDRVmKo6ImDZ9u8yIhctagUDRjOM h1aLiSfaSzJAPr3DWWMGzUsf1s+nZ0PMegcmv/pV+Ptr+CiluW3oNVdb9oF+j1agKxr3 Ye22akrZcikc/t5nGNn1oQzTM41UB1oyg5OvgG6OZsVveMAZtvjmL0SVZGCB5ZVUcMHt aXBB6hLl8KQN7FoalDvFAHrT5u2FX4MxokjaUg7fuOnBkdrSKenVpak21ZTmTwd/Z19y lhlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=4ETKftWBVy6GzKkutN2GcCGR5cKv1VIm/ZISCNpvf9s=; fh=ENYEVYLDWnOp6bgH2x8eY9hDPYg+RUSzSKsGgV6b2DM=; b=oP+fianOwPOxBoBs3C34Zwe96Ry6xOjolw4cUJZYOV9tV/1xPlMa/+fT6yLwKPSEeg kWwg18FWMx2PT7q5TpcTpsnnBj8PTuMoSEa825iADQzQVJ1mS52XyG2agtOsWjl20ROH IuwuKon9FXNdHvFZNjUA8YkKN30qqaCubC16LBXxSwIxE1cJLgnVQ2koDMNhdUJr6HJF GMOW4uS0MxBjGI61ag4BMs5dKkcLsg4bjIzW3RINs6cy29GmPbuPoLmSqgFk0V1umqnN jpJbygDpeiBdHJXzxEtbArujNN+sAeCXzPk6DZpQxUBYWGyGRc/rgJZ52Zypx+iuZt+y CtLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-87356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o8-20020a170902d4c800b001dbc1a37d6dsi1940798plg.462.2024.02.29.11.31.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:31:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-87356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6ECEEB212B1 for ; Thu, 29 Feb 2024 19:31:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15ED113C9F3; Thu, 29 Feb 2024 19:31:35 +0000 (UTC) Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A9B1134434; Thu, 29 Feb 2024 19:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235094; cv=none; b=rDEFNbGswC3EBmVqy2wuvWuaHC8PlDZ6UWDGUwJE/H+1c9NiTdD+g5Kf8nCEV3qDd5KKFdp2vck9d02CfCZPmjXz3uOvry5hHuVLMN02/GOE3kr/OI4ki+fqvUjU1iob1WVFWQ/0cvpAFuUl+VSuq3OY4jf4gd7h+6FXVUj9Ar8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235094; c=relaxed/simple; bh=njFwzLd3O52eEHT6q0dizalujYRQxu7MHu33B3xG37M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=la0MaT/u3liZ7z31t3QT9y8HFexAeyEaygWTx69Y/ekKQ9qWLbrhAK8CvrxuFTEu6ayfH63KRg16oMnLko0K4+7f9JHSMNslZHovcIKgUuadzKF6+Jc7ZkFMGthsqtDJ2SAUPMb7EaSzdnvyxguhFLgfBjz3pOrVYpN+F1RboKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6e447c39525so254035a34.0; Thu, 29 Feb 2024 11:31:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709235092; x=1709839892; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4ETKftWBVy6GzKkutN2GcCGR5cKv1VIm/ZISCNpvf9s=; b=hbex2avBQN5FU2dLnTmtpsxc8FstanMwpTMEGU9b/60T0rXeRMQi5NIPPORt424HZX eGpgWcd8tHv2Kny01G8NLxuZA+PqwZloYplHfqt30B/4YiMQXNM0KIKmhiiqw8ulxX2b BSTfY1cGQ9E5NYJpfX4OtruL4EQCnwhAScQsWDiX+dNElEl/PlpAxRq2pMEc9jy7/II6 hdpSLej3xdwskqM0gRZ2xcgT8008oGEgZqdzCbJDUdqNCo3a/UfMbah94Ocz4B6Xb3vi keea8QB0oYhgLExvzZnrhNRhO8UlCs6DeVO/lSKZpPXs5dIdoeITCHM6Q1lkHWY7hzr+ 9JAQ== X-Forwarded-Encrypted: i=1; AJvYcCWxfZYpMDBUEaX6yuRnqIGaeLOJ6mVQvc8ctmt6xymS2ptXOPtJSwT1GkR2tui/luLjFLNZbsQNSU27LLF2gwZ+Ld42/mkVZ3zPtSmjuT0EkVQ/XA5Gzv5z/WBbWqdoXxH3Hi4vgH0= X-Gm-Message-State: AOJu0YzzxvLDzB42aNcbriWdjvEuSgQd+Z17pRgyUh/2Y8T0EUy0xOU5 KuW5eW5NVlzrbQ2dg3hNRLWV3YAhYeOpNocdekLVUrY+FeQdodk3Nw2k3XAgtJ92Nw4Fa+gAKNe d4L5F6nG9tnDHpfceWFGcPcVzxoc= X-Received: by 2002:a05:6820:352:b0:5a0:6ef3:ed8e with SMTP id m18-20020a056820035200b005a06ef3ed8emr3073771ooe.1.1709235092242; Thu, 29 Feb 2024 11:31:32 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240228020040.25815-1-qingliang.li@mediatek.com> <1390e743-2216-4435-b2ef-7d92a55605b1@ti.com> <0c1e972cf506b22cb1de73c8509bf2b917c0806b.camel@mediatek.com> In-Reply-To: <0c1e972cf506b22cb1de73c8509bf2b917c0806b.camel@mediatek.com> From: "Rafael J. Wysocki" Date: Thu, 29 Feb 2024 20:31:20 +0100 Message-ID: Subject: Re: [PATCH] PM: wakeirq: fix wake irq warning in system suspend stage To: =?UTF-8?B?UWluZ2xpYW5nIExpICjpu47mmbTkuq4p?= Cc: "johan+linaro@kernel.org" , "d-gole@ti.com" , "pavel@ucw.cz" , "gregkh@linuxfoundation.org" , "tony@atomide.com" , "len.brown@intel.com" , "rafael@kernel.org" , "matthias.bgg@gmail.com" , "angelogioacchino.delregno@collabora.com" , =?UTF-8?B?QXhlIFlhbmcgKOadqOejiik=?= , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-pm@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 28, 2024 at 9:33=E2=80=AFAM Qingliang Li (=E9=BB=8E=E6=99=B4=E4= =BA=AE) wrote: > > On Wed, 2024-02-28 at 11:34 +0530, Dhruva Gole wrote: > > > > External email : Please do not click links or open attachments until > > you have verified the sender or the content. > > Hi, > > > > On 28/02/24 07:30, Qingliang Li wrote: > > > When driver registers the wake irq with reverse enable ordering, > > > the wake irq will be re-enabled when entering system suspend, > > triggering > > > an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be > > > enabled in both dev_pm_enable_wake_irq_complete() and > > dev_pm_arm_wake_irq() > > > > > > To fix this issue, complete the setting of > > WAKE_IRQ_DEDICATED_ENABLED flag > > > in dev_pm_enable_wake_irq_complete() to avoid redundant irq > > enablement. > > > > > > Just trying to understand, why not in dev_pm_arm_wake_irq ? > > Is it cuz it's called much after dev_pm_enable_wake_irq_complete ? > > Not sure what's the exact call order, but I am assuming > > dev_pm_enable_wake_irq_complete is more of a runtime thing and > > dev_pm_arm_wake_irq happens finally at system suspend? > > You are right, the involvement of 'dev_pm_enable_wake_irq_complete' is > due to the driver selecting 'pm_runtime_force_suspend' as the callback > function for system suspend. In this scenario, the call sequence during > system suspend is as follows: > dpm_suspend_start -> dpm_run_callback -> pm_runtime_force_suspend -> > dev_pm_enable_wake_irq_check/complete > suspend_enter -> dpm_suspend_noirq -> dev_pm_arm_wake_irq > > Based on the above, if the driver (i) chooses pm_runtime_force_suspend > as the system suspend callback function and (ii) registers wake irq > with reverse enable ordering, the wake irq will be enabled twice during > system suspend. It would be good to put the above information into the patch changelog, as it actually explains the problem. Thanks!