Message ID | 12097002.O9o76ZdvQC@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2080890wrs; Tue, 18 Oct 2022 10:41:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZA/tDcvblvFH3ogY+9V9lVQeKnskrPTs1ImZaoZ2Gg301rrEH4h8wHcJM1NkrHqWWEF6x X-Received: by 2002:a17:907:2e19:b0:78e:281d:91fe with SMTP id ig25-20020a1709072e1900b0078e281d91femr3442350ejc.482.1666114880300; Tue, 18 Oct 2022 10:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666114880; cv=none; d=google.com; s=arc-20160816; b=rQa2NaViIcjhhqDgK7S22HvZ/5R3PjAIxJg09gcH0OHUh1lCwNigvEyNuE6auGfnvV +PIcw+vmEPzi7CWkwo+gCilW6YHb1yMvXTq5sp6rOgaX2SR3uU8/YgeebqczokX4h+5h x7/9W3+53YZUFvvqDvHmXzPYms1cb6a4eNkHDexA7/55ESU3MpsgCKjc6DGLPaVqsF6N OW4hGvv1UwEHmF3dTcCJbPjrSwILkI6er40/XbqiHpufsCjtYX95wxxt8YQ1flKt9gdW BGZJwMIEotzYcwS/NL+oaFzt7bs3juKCf1yOS6rAOfnvb2xgjZc7tzbNZFGCLjXdhHfV zdmA== 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; bh=HA5fb2pbkyrxHTn22vsyOQ7wsZ9jvVpC3w69Uu8hBto=; b=rH0TVwzopJJEvbI8C8azcdEp69RWPrz2JsULiAn4/8y+DSt21jqTSqQE+O3S8d7jJy gA6DTT14eV/NoOVadIOFT1loDGTqjmS5M0xr+yBueuVMIYv0RQEZvWvDT/PRCOoOLZkS zpSmsNLjC1Lq6KLq7Qni8h9P31PCaOCrS5pV1ulmYVHXprOOEAjH4nn33QPfH78unhUL QxPG2kkm/P9TGPb/sUI9GsdcgAuqBdP1FbCk78/ir8qYSc6khKqWmaulGQMsysu2fJMA G4aCRc4qKRIMri3LLoXIYFOgnMgRm95/15PqQiPz5Q3vsrvN88/yBn5HQWldZEuorsHB BjHQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wv2-20020a170907080200b0078dc3cb8b48si13617353ejb.625.2022.10.18.10.40.51; Tue, 18 Oct 2022 10:41:20 -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 S229989AbiJRReK (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 18 Oct 2022 13:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiJRReI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Oct 2022 13:34:08 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FE46B1DF7; Tue, 18 Oct 2022 10:34:06 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id b51b4719d7d11cff; Tue, 18 Oct 2022 19:34:04 +0200 Received: from kreacher.localnet (unknown [213.134.183.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 01841666955; Tue, 18 Oct 2022 19:34:03 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PCI <linux-pci@vger.kernel.org> Cc: Linux ACPI <linux-acpi@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bjorn Helgaas <helgaas@kernel.org> Subject: [PATCH] ACPI: PCI: Fix device reference counting in acpi_get_pci_dev() Date: Tue, 18 Oct 2022 19:34:03 +0200 Message-ID: <12097002.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.183.104 X-CLIENT-HOSTNAME: 213.134.183.104 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelvddgkeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddukeefrddutdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekfedruddtgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhptghisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg pdhrtghpthhtohephhgvlhhgrggrsheskhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747048076472673213?= X-GMAIL-MSGID: =?utf-8?q?1747048076472673213?= |
Series |
ACPI: PCI: Fix device reference counting in acpi_get_pci_dev()
|
|
Commit Message
Rafael J. Wysocki
Oct. 18, 2022, 5:34 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed to reference count the device returned by acpi_get_pci_dev() as expected by its callers which in some cases may cause device objects to be dropped prematurely. Add the missing get_device() to acpi_get_pci_dev(). Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/pci_root.c | 1 + 1 file changed, 1 insertion(+)
Comments
On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > to reference count the device returned by acpi_get_pci_dev() as > expected by its callers which in some cases may cause device objects > to be dropped prematurely. > > Add the missing get_device() to acpi_get_pci_dev(). > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") FYI this (and the rtc-cmos regression discussed in https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) took down the entire Intel gfx CI. I've applied both fixes into our fixup branch and things are looking much healthier now. This one caused i915 selftests to eat a lot of POISON_FREE in the CI. While bisecting it locally I didn't have poisoning enabled so I got refcount_t undeflows instead. https://intel-gfx-ci.01.org/tree/drm-tip/index.html has a lot of colorful boxes to click if you're interested in any of the logs. The fixes are included in the CI_DRM_12259 build. Earlier builds were broken. > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > drivers/acpi/pci_root.c | 1 + > 1 file changed, 1 insertion(+) > > Index: linux-pm/drivers/acpi/pci_root.c > =================================================================== > --- linux-pm.orig/drivers/acpi/pci_root.c > +++ linux-pm/drivers/acpi/pci_root.c > @@ -323,6 +323,7 @@ struct pci_dev *acpi_get_pci_dev(acpi_ha > > list_for_each_entry(pn, &adev->physical_node_list, node) { > if (dev_is_pci(pn->dev)) { > + get_device(pn->dev); > pci_dev = to_pci_dev(pn->dev); > break; > } > > >
On Wed, Oct 19, 2022 at 11:02 AM Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > > to reference count the device returned by acpi_get_pci_dev() as > > expected by its callers which in some cases may cause device objects > > to be dropped prematurely. > > > > Add the missing get_device() to acpi_get_pci_dev(). > > > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") > > FYI this (and the rtc-cmos regression discussed in > https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) > took down the entire Intel gfx CI. Sorry for the disturbance. > I've applied both fixes into our fixup branch and things are looking much > healthier now. Thanks for letting me know. I've just added the $subject patch to my linux-next branch as an urgent fix and the other one has been applied to the RTC tree. > This one caused i915 selftests to eat a lot of POISON_FREE > in the CI. While bisecting it locally I didn't have > poisoning enabled so I got refcount_t undeflows instead. Unfortunately, making no mistakes is generally hard to offer. If catching things like this early is better, what about pulling my bleeding-edge branch, where all of my changes are staged before going into linux-next, into the CI? > https://intel-gfx-ci.01.org/tree/drm-tip/index.html has a lot > of colorful boxes to click if you're interested in any of the > logs. The fixes are included in the CI_DRM_12259 build. Earlier > builds were broken. Thanks!
On Wed, Oct 19, 2022 at 01:35:26PM +0200, Rafael J. Wysocki wrote: > On Wed, Oct 19, 2022 at 11:02 AM Ville Syrjälä > <ville.syrjala@linux.intel.com> wrote: > > > > On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > > > to reference count the device returned by acpi_get_pci_dev() as > > > expected by its callers which in some cases may cause device objects > > > to be dropped prematurely. > > > > > > Add the missing get_device() to acpi_get_pci_dev(). > > > > > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") > > > > FYI this (and the rtc-cmos regression discussed in > > https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) > > took down the entire Intel gfx CI. > > Sorry for the disturbance. > > > I've applied both fixes into our fixup branch and things are looking much > > healthier now. > > Thanks for letting me know. > > I've just added the $subject patch to my linux-next branch as an > urgent fix and the other one has been applied to the RTC tree. > > > This one caused i915 selftests to eat a lot of POISON_FREE > > in the CI. While bisecting it locally I didn't have > > poisoning enabled so I got refcount_t undeflows instead. > > Unfortunately, making no mistakes is generally hard to offer. > > If catching things like this early is better, what about pulling my > bleeding-edge branch, where all of my changes are staged before going > into linux-next, into the CI? Pretty sure we don't have the resources to become the CI for everyone. So testing random trees is not really possible. And the alternative of pulling random trees into drm-tip is probably a not a popular idea either. We used to pull in the sound tree since it's pretty closely tied to graphics, but I think we stopped even that because it eneded up pulling the whole of -rc1 in at random points in time when we were't expecting it. Ideally each subsystem would have its own CI, or there should be some kernel wide thing. But I suppose the progress towards something like that is glacial. That said, we do test linux-next to some degree. And looks like at least one of these could have been caught a bit earlier through that. Unfortunately no one is really keeping an eye on that so things tend to slip through. Probably need to figure out something to make better use of that. > > > https://intel-gfx-ci.01.org/tree/drm-tip/index.html has a lot > > of colorful boxes to click if you're interested in any of the > > logs. The fixes are included in the CI_DRM_12259 build. Earlier > > builds were broken. > > Thanks!
On Wed, 19 Oct 2022, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > On Wed, Oct 19, 2022 at 01:35:26PM +0200, Rafael J. Wysocki wrote: >> If catching things like this early is better, what about pulling my >> bleeding-edge branch, where all of my changes are staged before going >> into linux-next, into the CI? > > Pretty sure we don't have the resources to become the CI for > everyone. So testing random trees is not really possible. And > the alternative of pulling random trees into drm-tip is probably > a not a popular idea either. We used to pull in the sound tree > since it's pretty closely tied to graphics, but I think we > stopped even that because it eneded up pulling the whole of > -rc1 in at random points in time when we were't expecting it. Basically, we only pull branches to drm-tip that are managed using our tools and our development model and under our control. It was too much trouble dealing with conflicts, Linus' master being pulled in at random points (like in the middle of the merge window), and stuff like that, with the external trees. > Ideally each subsystem would have its own CI, or there should > be some kernel wide thing. But I suppose the progress towards > something like that is glacial. > > That said, we do test linux-next to some degree. And looks like > at least one of these could have been caught a bit earlier through > that. Unfortunately no one is really keeping an eye on that so > things tend to slip through. Probably need to figure out something > to make better use of that. Yeah, we need to pay more attention to linux-next test results, as well as Linus' master during the merge window. It's not necessarily easy with the volatility of linux-next, you could easily have very broken runs followed by good ones, but the low hanging fruit is raising more flags and being louder about it earlier when everything's busted for several days in linux-next or Linus' master. BR, Jani.
On Wed, Oct 19, 2022 at 2:22 PM Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Wed, Oct 19, 2022 at 01:35:26PM +0200, Rafael J. Wysocki wrote: > > On Wed, Oct 19, 2022 at 11:02 AM Ville Syrjälä > > <ville.syrjala@linux.intel.com> wrote: > > > > > > On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > > > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > > > > to reference count the device returned by acpi_get_pci_dev() as > > > > expected by its callers which in some cases may cause device objects > > > > to be dropped prematurely. > > > > > > > > Add the missing get_device() to acpi_get_pci_dev(). > > > > > > > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") > > > > > > FYI this (and the rtc-cmos regression discussed in > > > https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) > > > took down the entire Intel gfx CI. > > > > Sorry for the disturbance. > > > > > I've applied both fixes into our fixup branch and things are looking much > > > healthier now. > > > > Thanks for letting me know. > > > > I've just added the $subject patch to my linux-next branch as an > > urgent fix and the other one has been applied to the RTC tree. > > > > > This one caused i915 selftests to eat a lot of POISON_FREE > > > in the CI. While bisecting it locally I didn't have > > > poisoning enabled so I got refcount_t undeflows instead. > > > > Unfortunately, making no mistakes is generally hard to offer. > > > > If catching things like this early is better, what about pulling my > > bleeding-edge branch, where all of my changes are staged before going > > into linux-next, into the CI? > > Pretty sure we don't have the resources to become the CI for > everyone. So testing random trees is not really possible. And > the alternative of pulling random trees into drm-tip is probably > a not a popular idea either. We used to pull in the sound tree > since it's pretty closely tied to graphics, but I think we > stopped even that because it eneded up pulling the whole of > -rc1 in at random points in time when we were't expecting it. I see. > Ideally each subsystem would have its own CI, or there should > be some kernel wide thing. But I suppose the progress towards > something like that is glacial. Well, I definitely cannot afford a dedicated CI just for my tree and I haven't got any useful information from KernlCI yet (even though hey pull and test my linux-next branch on a regular basis). KernelCI seems to be focusing on different set of hardware, so to speak. > That said, we do test linux-next to some degree. And looks like > at least one of these could have been caught a bit earlier through > that. Unfortunately no one is really keeping an eye on that so > things tend to slip through. Probably need to figure out something > to make better use of that. I think it could also be possible to contribute to KernelCI to get more useful x86 coverage from it.
On Wed, Oct 19, 2022 at 11:54:42AM +0300, Ville Syrjälä wrote: > On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > > to reference count the device returned by acpi_get_pci_dev() as > > expected by its callers which in some cases may cause device objects > > to be dropped prematurely. > > > > Add the missing get_device() to acpi_get_pci_dev(). > > > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") > > FYI this (and the rtc-cmos regression discussed in > https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) > took down the entire Intel gfx CI. From 1000 miles away and zero background with the gfx CI, this sounds like "our CI system, whose purpose is to find bugs, found one", which is a good thing. Bjorn
On Wed, Oct 19, 2022 at 11:53:26AM -0500, Bjorn Helgaas wrote: > On Wed, Oct 19, 2022 at 11:54:42AM +0300, Ville Syrjälä wrote: > > On Tue, Oct 18, 2022 at 07:34:03PM +0200, Rafael J. Wysocki wrote: > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > > Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed > > > to reference count the device returned by acpi_get_pci_dev() as > > > expected by its callers which in some cases may cause device objects > > > to be dropped prematurely. > > > > > > Add the missing get_device() to acpi_get_pci_dev(). > > > > > > Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") > > > > FYI this (and the rtc-cmos regression discussed in > > https://lore.kernel.org/linux-acpi/5887691.lOV4Wx5bFT@kreacher/) > > took down the entire Intel gfx CI. > > >From 1000 miles away and zero background with the gfx CI, this sounds > like "our CI system, whose purpose is to find bugs, found one", which > is a good thing. Mostly. It's certainly better than it going entirely undetected. Sadly we found it after rc1 because no one was really looking at linux-next results. Something we need to improve. But ideally it would have been found by some other CI system whose primary job is to prevent bugs in those subsystems, rather than the one whose primary job is to prevent bugs in gfx drivers. Also ideally it wouldn't have been me bisecting this :P The biggest downside of bugs reaching our CI via rc1/etc. is that it pretty much stops everyone from getting premerge results for their graphics driver patches since the CI keeps tripping over the already existing bugs. But I guess you can call this one a somewhat self inflicted wound and we should just try harder to keep new code out of our tree until it's known to be healthy.
Index: linux-pm/drivers/acpi/pci_root.c =================================================================== --- linux-pm.orig/drivers/acpi/pci_root.c +++ linux-pm/drivers/acpi/pci_root.c @@ -323,6 +323,7 @@ struct pci_dev *acpi_get_pci_dev(acpi_ha list_for_each_entry(pn, &adev->physical_node_list, node) { if (dev_is_pci(pn->dev)) { + get_device(pn->dev); pci_dev = to_pci_dev(pn->dev); break; }