Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2533280rwo; Thu, 3 Aug 2023 10:43:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiO0oAvvV/evzyZTAddv/bxOzVoE8Smwn+dlmyhpmgNzanICcJJ+/cxf1YE2Mgc6vWAWPQ X-Received: by 2002:a17:902:b412:b0:1bc:e6a:205a with SMTP id x18-20020a170902b41200b001bc0e6a205amr12325007plr.4.1691084615933; Thu, 03 Aug 2023 10:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691084615; cv=none; d=google.com; s=arc-20160816; b=Gwosn2hnFonYTe8GozV0+DCv8KVTmQcFRodszjJpyyANmENZDSvI4LWgi9wKZ7iUhn zEQ31Vh7/WoH4EVjvEkQSUNcfT/jVd334PURcIDtNwoaaGd8u7dhoiRm/7mRqc0K1pGj nb2mHJ3jWTlDvKQk9lO8jgDnGEoLD0xXJ0k0Jawcjd4hWsa5c+TlDGV3uNSc9RPZOg+A 9xlmDLOZw71CWdfscQzPJIl1sUjCp3BUECmugF1Fkzs+0OpJwlCu9aoJ032sbxoUlKEB y32Fnq69CUqyxofHCftele/zoNelkulcUO4id8361ypHkIehsPn83gqq1djKQimjNRdV LaSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hEzhPRdTD+fDuYbhKrYmZSEqpZqahW5WFlqeU5TqQQU=; fh=EkXd9mulaEwhN/gYQbLN171OqS+TkA74SfbkC4a6Z8Y=; b=pP0L7BzJEa3ML58I+XH5In6YLaryXo4z7Z50pP1M0Z9+PsvbYq6piHZgIadaeNNcQh 9bRY2ZQhCCOIc5yLMixjmGdYS76A+aMawBlv2zq7+ntEIYcYzqxcqoWVBJaLeSbD1wQb kliurqo5XHkpeFSURv1mIujYIk2cUED4Q05O5ugRUPSS/8EHBTEYBUFxIku99Hd5N5sy x/w1Nky/wzHMKSyxobgqDQ9xH5sf4a1dwymBZ6mYWv0qTUTnhFhwsMfhDEMdbf8fPKvl WjxfvE+Aoc/Y514bqqDOSSlFw1yuY6Rjxrslrvg+9WSqrSPm/oqmXpip9Nc3UdNOEacQ vxGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RD6Z3o9r; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a170902ceca00b001b890b3a512si251699plg.615.2023.08.03.10.43.23; Thu, 03 Aug 2023 10:43:35 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RD6Z3o9r; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234179AbjHCRNe (ORCPT + 99 others); Thu, 3 Aug 2023 13:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233188AbjHCRNc (ORCPT ); Thu, 3 Aug 2023 13:13:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B5831FF3 for ; Thu, 3 Aug 2023 10:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691082764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=hEzhPRdTD+fDuYbhKrYmZSEqpZqahW5WFlqeU5TqQQU=; b=RD6Z3o9rvTwdWkKuhezRQPeiFWwIi63vGQvoy/mLyR62tUI32maoO8mV0PwcOUgUthTI+G eyjTf4HJwhCMnE450ECGagvYgQbwecAjj8igrCnFSb0oejqVecrWgz2RIZEnz4YljvkG6a KYVuCGuI6mjcBzlkjzw8BZy/hRe4cIU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-Wa-CLyNiNTm7cACxcz5cOA-1; Thu, 03 Aug 2023 13:12:43 -0400 X-MC-Unique: Wa-CLyNiNTm7cACxcz5cOA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E838286801E; Thu, 3 Aug 2023 17:12:42 +0000 (UTC) Received: from omen.home.shazbot.org (unknown [10.22.10.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B1284021C9; Thu, 3 Aug 2023 17:12:42 +0000 (UTC) From: Alex Williamson To: bhelgaas@google.com Cc: Alex Williamson , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, eric.auger@redhat.com Subject: [PATCH v2 0/2] PCI: Protect VPD and PME accesses from power management Date: Thu, 3 Aug 2023 11:12:31 -0600 Message-Id: <20230803171233.3810944-1-alex.williamson@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 Since v5.19, vfio-pci makes use of runtime power management on devices. This has the effect of potentially putting entire sub-hierarchies into lower power states, which has exposed some gaps in the PCI subsystem around power management support. The first issue is that lspci accesses the VPD sysfs interface, which does not provide the same power management wrappers as general config space. The next covers PME, where we attempt to skip devices based on their PCI power state, but don't protect changes to that state or look at the overall runtime power management state of the device. This latter patch addresses the issue noted by Eric in the follow-ups to v1 linked below. These patches are logically independent, but only together resolve an issue on Eric's system where a pair of endpoints bound to vfio-pci and unused by userspace drivers trigger faults through lspci and PME polling. Thanks, Alex v1: https://lore.kernel.org/all/20230707151044.1311544-1-alex.williamson@redhat.com/ Alex Williamson (2): PCI/VPD: Add runtime power management to sysfs interface PCI: Fix runtime PM race with PME polling drivers/pci/pci.c | 23 ++++++++++++++++------- drivers/pci/vpd.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 9 deletions(-) -- 2.40.1