Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9351993rwr; Thu, 11 May 2023 13:42:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WhqPNl6IJj42fPQdv2oL1AXCprRgVXTRWo7tPR/Ctxds5MdSBcQYxEfABCl8slxpvOyzi X-Received: by 2002:a05:6a21:99a1:b0:f2:f505:951 with SMTP id ve33-20020a056a2199a100b000f2f5050951mr30007946pzb.13.1683837741192; Thu, 11 May 2023 13:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683837741; cv=none; d=google.com; s=arc-20160816; b=ra5Ir/or5kcsnQoPp5GBG+M+RiE8aQ9bKzY1ho9mIh02jLOFwkhHxuGAdNjtfpcQK3 svIT1h+mnQZCA/RCDJqiElFx7GaTAXBAPY+I7eXXvA0uCG4qWSPWje0S7Y2zExqUfO6C uOT0X1pTboUN9pEui27YJQcF1+/09+IUxiTQrJT423aF6y0LmAigmzeR+vE7c/4Fd3Ah /yRmrxY3o8eqdCos7KFJodUbRkqxhtIxM6bq7Rj3CeERtY8n/0CmKHIvL1efnjcpRxZ+ nRVSLnqQGiGWK/E5nzQGW/3MlCLPuM/54k9LB6wlEzTticpabjXM6xwkQrZRx1HjgXNo /H9g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=55Y+DuUjaT+axZ7C3vNDsbbT+Fuj7gAg/pMkUgCc3iQ=; b=t+iB+DPE7+TW2GTeSLugnrfFq59KMKqwCZLf9LdhY9Ov15JdI1gdA5QNPgS0xcXmHg cOqIGB2Tp5+Dt/e9qhSIecotOJlP/QFOPmNM9Qyv5p1QPMY8hWPU0Xuh0tP2vpbGLkEH Oj+B9jyWqW4ACPrPRV4Hv9ntHH0tNO7u5PTmKqlHGUFesqZtPvqJVWUMPDZYjRGU1bzu FXndCxVwhNDz5GQwH57uuyCgjQvh8DGEbddrdp8iRa2VX9bDh++UHOL4693hKdckQeR7 jl9wBfE8pruENXcUJQ8sWmHXv06UpB1MfKe1B6lU+zvCW3RQxPrU8ypVPDRfFPBElgkA je3A== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f29-20020a63381d000000b005289dd5ba0bsi7705163pga.410.2023.05.11.13.42.08; Thu, 11 May 2023 13:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239596AbjEKUCv (ORCPT + 99 others); Thu, 11 May 2023 16:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239589AbjEKUCs (ORCPT ); Thu, 11 May 2023 16:02:48 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B578A72; Thu, 11 May 2023 13:02:46 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (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 bmailout1.hostsharing.net (Postfix) with ESMTPS id DAC4E300002CB; Thu, 11 May 2023 22:02:44 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id CD6831D8B48; Thu, 11 May 2023 22:02:44 +0200 (CEST) Date: Thu, 11 May 2023 22:02:44 +0200 From: Lukas Wunner To: Heiner Kallweit Cc: Ilpo =?iso-8859-1?Q?J=E4rvinen?= , linux-pci@vger.kernel.org, Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Krzysztof Wilczy??ski , nic_swsd@realtek.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 14/17] r8169: Use pcie_lnkctl_clear_and_set() for changing LNKCTL Message-ID: <20230511200244.GA31598@wunner.de> References: <20230511131441.45704-1-ilpo.jarvinen@linux.intel.com> <20230511131441.45704-15-ilpo.jarvinen@linux.intel.com> <98b3b70a-86c0-78c0-b734-0764bb5a21fc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98b3b70a-86c0-78c0-b734-0764bb5a21fc@gmail.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, T_SCC_BODY_TEXT_LINE 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 On Thu, May 11, 2023 at 09:49:52PM +0200, Heiner Kallweit wrote: > On 11.05.2023 15:14, Ilpo J?rvinen wrote: > > Don't assume that only the driver would be accessing LNKCTL. ASPM > > policy changes can trigger write to LNKCTL outside of driver's control. > > > > Use pcie_lnkctl_clear_and_set() which does proper locking to avoid > > losing concurrent updates to the register value. > > Wouldn't it be more appropriate to add proper locking to the > underlying pcie_capability_clear_and_set_word()? PCI config space accessors such as this one are also used in hot paths (e.g. interrupt handlers). They should be kept lean (and lockless) by default. We only need locking for specific PCIe Extended Capabilities which are concurrently accessed by PCI core code and drivers. Thanks, Lukas