From patchwork Tue Jun 8 09:02:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 12305935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8864AC47082 for ; Tue, 8 Jun 2021 09:06:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5437061184 for ; Tue, 8 Jun 2021 09:06:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5437061184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QwtcyqLFSgQiYDKofLS9TktvPJrbTN5Ur4PzQpPNoNQ=; b=r4PoxRThk8uQ9W 2CGKQFWbgj+BovGis1LMLyhmoAnccRWn+kPs2GXE0CYVgflv4XztaDcQVT2mMbrni+TySxU1jz52R IpNXeBeduCZUg/JjfWdOLPY9fEoDhhVE45SCq5Vb9ZTeLoU+ZnNX/DSGdIMQOjS4LLMdKZCL7WocD 3hdigWkrzwItD4utmEduOZPUYN8cA/xV+PCb+MNJsXAtqFOeQDlwCEkMLa4uaS5Lw94bME7RekXLx wKuC43i0AyCZBgb9eyWdF47tAAi3LxPyr+W4ZntTIY1bNMqW5AOlFSbe6ZH4uCfsLX56TSX3dk06Z Scm6VS4wc8DCzgrJyLsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqXef-007F2x-FB; Tue, 08 Jun 2021 09:04:13 +0000 Received: from mail-lj1-f182.google.com ([209.85.208.182]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqXeY-007F0N-P6 for linux-arm-kernel@lists.infradead.org; Tue, 08 Jun 2021 09:04:10 +0000 Received: by mail-lj1-f182.google.com with SMTP id u18so5844185lju.12 for ; Tue, 08 Jun 2021 02:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K0ds+l2wwmikGBIkarzC+RWkNxvJMelGG4IknEWp7ak=; b=QzWpE4d7Czo3Zzuvhv+Wm8SOjKM7edThMVzlJK8RuUE5nNdoUEl19aWE/sd7LJmDHJ VqKCUb0i6PoLbvwyCMdn1VDa7/12/HC0sX0CyTwfcQgofGUxwmOY6YgoMa4J8armXTDn Jemd4DUXYbGk5wjagB0xfxRN/IIdjw1HWDjwNwFFMNbSnCA+s/WWOwZ1C+XkH5sN4nlm Sx8R1byKEXnCGlAClEtDjrPJJiL9xxPGswV/Z8x/EGAGVU/Lijv5j4QTCUXfqJdPvQ/k A6MmbefYfSU/d7S32LbjloQfzUELzcIHsB+ty+To3ojyeGIM6fvi7luoHXiA8treZv9K xbjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K0ds+l2wwmikGBIkarzC+RWkNxvJMelGG4IknEWp7ak=; b=uAO6GOARp/qaCs/WU052Xv5v8oF3FVCjwFUDv1Gy1NxNl9VBdcAQPVPqXLG3/LUW/2 tshY/yzH4hCzxyeWNKH4uLK3t9tell4pS3UltvgooVegc980FlI3evS3dbsea4FATLTF t4PkzxhkuQylFx+4cpYsgvuShs9I8ML+u8fCTkIkMtdc8bmsO9u2OzdBZRoa+V+X/mwZ o1TOqXGCYGv6fH5h2jzqRGxZi5eTF0hSgP19pPtveiC2uuqg9oYzWyHGcZYUC5hnhMZH a7zVsar22gvrH9ytlxytC6gSTkMCswqFCSQspl1/Oc05/gpQKvIs2MJf3KnnEqWujM84 4lzA== X-Gm-Message-State: AOAM5328cLldnTsQuab6WLADTPxz8pnkmJQTiV96CJa39LyY/Onx7zxZ ubR30aITF6y7ZO8kHWFVnc4uHg== X-Google-Smtp-Source: ABdhPJwkH3G8ZdlvfKKYqYu8Q01goGfnSxTrJLfHwYUX4RxNytFLFgCXQO7z+MAGuPyDCnsi8X9ewg== X-Received: by 2002:a2e:8817:: with SMTP id x23mr17928556ljh.17.1623142982721; Tue, 08 Jun 2021 02:03:02 -0700 (PDT) Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id n17sm1295197lfq.118.2021.06.08.02.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 02:03:01 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Saravana Kannan , Alan Stern , Adrian Hunter , Tony Lindgren , Kevin Hilman , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] PM: runtime: Update behaviour for no callbacks Date: Tue, 8 Jun 2021 11:02:47 +0200 Message-Id: <20210608090250.85256-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210608_020406_845867_ADDA87A3 X-CRM114-Status: GOOD ( 19.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org While reviewing a patch on the mmc-list, I ended up inspecting the behaviour of how we deal with the no callback case for runtime PM. A couple of observations: *) When pm_runtime_no_callbacks() have been called, it allows the PM core to takes a quicker path, but at the same time, consumer/supplier device links are being skipped in rpm_resume|suspend(). **) Calling pm_runtime_no_callbacks() to avoid boiler plate code (assigning empty functions to ->runtime_suspend|resume()), doesn't work if there could be consumer/supplier device link being used or a platform dependent PM domain that could get attached to the device. Therefore, this series suggests to change the behaviour in the PM core, to allow the ->runtime_suspend|resume() callbacks to be unassigned. This is already supported for ->runtime_idle() callbacks, so it would also move things into a more consistent behaviour. I have looked at various error paths, in the kernel of callers of pm_runtime_get_sync(). I couldn't find anyone that made sense, that looked for the special error code, -ENOSYS, which is the error code getting returned when a callback is missing. Whether that is sufficient proof that these changes are 100% safe, I can't guarantee, but I think it would be worth a try as the benefits of avoiding boilerplate code and the corresponding additional code paths are quite nice, if you ask me. Kind regards Ulf Hansson Ulf Hansson (3): PM: runtime: Improve path in rpm_idle() when no callback PM: runtime: Allow unassigned ->runtime_suspend|resume callbacks PM: runtime: Clarify documentation when callbacks are unassigned Documentation/power/runtime_pm.rst | 8 ++++++++ drivers/base/power/runtime.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) Acked-by: Alan Stern