Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2194704rdb; Tue, 3 Oct 2023 13:15:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGenZ0oc6tho/XQhiAjmdWXGSyWwFNMrzKQIR31TI1Xdjz7D7n5WjQtAFjDJxLkuccFsHOs X-Received: by 2002:a05:6871:28a:b0:1d6:5442:271d with SMTP id i10-20020a056871028a00b001d65442271dmr723548oae.24.1696364119781; Tue, 03 Oct 2023 13:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696364119; cv=none; d=google.com; s=arc-20160816; b=Rd+k8HOx+/bqvoy5pUI0jg7syhdqrGXhZ5zTwpnherheFxFMk68UAxYcWW8uqsfy6i w9kF/2/1J4OtccYgHjbJQOFfJEVttgyuXphrH3H6jUDBZ+2YC+syR66Cw6VBGTZGgf63 JiEGjnDTcr0MBxNL9x9tSv4oQ7lmDARXDSOWp/jZKHcOzgTn2syx4P6ZHsXnO6ncl+Tq WLrzchIrj7xAwMw6WctO+EvTsaUzhLmLqTValVRNp+b6bVqMXj7ERRokKNSzSsY4irf8 DEdIZ5FotbtjGrgKe1f9tPP2cU7N5DHBqOQpe+ieqpJxvFEmwdvpAaeOyyQeMH5ZKar0 uS1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=aE7lV17spxR/8FUdIhNIPSHbmZZ+UHinYNvjSmaMnrs=; fh=ecG2mcoRAv882Hfy7eZwqtfqruVMobcBHWSPGB+tScU=; b=sUzJ2x+HmH4pLFCJdqRbpNs33AsZzMH6U9T2xtL+EgFE7o6iA3Zo/KCqqNSHwwiEK4 bXVKbdzzCfKz10SrSjIZHaPyP7Beu1NRR53by0IBy1vx8kAuVTREfhpr19Fpi/pC42q4 Aevd8/QydLmYAaegK5u0zgwVx2hY1fUOUFmOoMUIINBHOC6GLB4BH+m0Xk4/vkMycCdn jAmi4Wvy3ZHdxIiG/I/nJLfL/5AFA3tWt7H7FBZw0wpOQ5K5t1ih9l4fI4HVtKtCqtp6 aPWRQUlyhsYGaZYzsRj2M3khdXs2ePnLi2n3b7VUMnLPaEv5KyoiG++aVuLJJc761Sf1 D2UQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i185-20020a6387c2000000b005641ddd0309si2107273pge.599.2023.10.03.13.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 13:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BEF1482DC61F; Tue, 3 Oct 2023 13:15:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241027AbjJCUPS (ORCPT + 99 others); Tue, 3 Oct 2023 16:15:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231426AbjJCUPR (ORCPT ); Tue, 3 Oct 2023 16:15:17 -0400 X-Greylist: delayed 450 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 03 Oct 2023 13:15:13 PDT Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BCD9E for ; Tue, 3 Oct 2023 13:15:12 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id C0EFC2800BBF9; Tue, 3 Oct 2023 22:07:39 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B44184497E; Tue, 3 Oct 2023 22:07:39 +0200 (CEST) Date: Tue, 3 Oct 2023 22:07:39 +0200 From: Lukas Wunner To: Mario Limonciello Cc: Mika Westerberg , bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] PCI: Make d3cold_allowed sysfs attribute read only Message-ID: <20231003200739.GC16417@wunner.de> References: <20231002181025.82746-1-mario.limonciello@amd.com> <20231003094407.GG3208943@black.fi.intel.com> <6291393a-b830-4a37-ad2a-1e23b6ec778e@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6291393a-b830-4a37-ad2a-1e23b6ec778e@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 13:15:18 -0700 (PDT) On Tue, Oct 03, 2023 at 11:30:54AM -0500, Mario Limonciello wrote: > On 10/3/2023 04:44, Mika Westerberg wrote: > > On Mon, Oct 02, 2023 at 01:10:25PM -0500, Mario Limonciello wrote: > > > Before d3cold was stable userspace was allowed to influence the kernel's > > > decision of whether to enable d3cold for a device by a sysfs file > > > `d3cold_allowed`. This potentially allows userspace to break the suspend > > > for the system. > > > > > > For debugging purposes `pci_port_pm=` can be used to control whether > > > a PCI port will go into D3cold and runtime PM can be turned off by > > > sysfs on PCI end points. > > > > > > Change the sysfs attribute to read-only and simplify the internal kernel > > > logic to avoid needing to store the userspace request. > > > > I wonder if this ends up breaking some userspace apps? Not objecting > > though, just wanted to mention ;-) > > > > One thing we could do is to taint the kernel or log a warning if > > userspace touches this but allow it to do so. > > If we collectively decide it needs to stay RW for userspace compatbility > then I'll respin it to keep the store call but ignore whatever is written, > return -EINVAL and emit a pr_warn_once() that it's a no-op. I'd suggest to return 0 to avoid even the faintest ABI change whiff. Just emit a warning once explaining that the feature is deprecated and mark the attribute as such in ABI documentation. Thanks, Lukas