Message ID | 20230925155806.1812249-1-laura.nao@collabora.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1615736vqu; Mon, 25 Sep 2023 19:03:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAYy8i1HAsoWuOyxHKaFT8SyMwfl216FnxFuup9yGPaU6qBz4w3NENUhOCYOdqJHkSwsb4 X-Received: by 2002:a05:6102:11e3:b0:452:5d45:6345 with SMTP id e3-20020a05610211e300b004525d456345mr5280905vsg.34.1695693790692; Mon, 25 Sep 2023 19:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695693790; cv=none; d=google.com; s=arc-20160816; b=EgXK7S8jafNckRy+zpa+aa+ePiSW5H4Ve3bBzJIviJkfstBlFG6Tx0ITzm7zCmQIfh p0/qLDRYhyFFgOi3dG5CDsldKdJSm9WR2SIbAGhAQId0PFntQt49KV/qEsGCQqGL65Ik NEWtSI9raI8CIDglM1fE87+fYBpKygJ22p2Y+OcueA0VV2jCjPgq8cW3mslTijxLBtqM bZPpH8jikbxZhp6puKycjp+qBGR8rE6TkdG9jdmFv7pIJwmFWfRp8LE024t3erLjXwlf 1auhcyRbfoYyFFhmnr+vEF3lyoWy4fJ2fI2EPXJVdnw/QGP5VWyatlq3DxI1bmt860uI 3/1w== 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=df+hhupkKUPOCtNQfjuHQM39kta9RjPk/8X762Oizek=; fh=9MGv7YQUmVE5emCVkJ+3ACi12HMYxsP9CRM6tyK4U0Q=; b=iqBqDauTykjeDlD2xr7ffkVHR00iG2E78ygrpg2QELWXA2/ycgIM/b+eO9uZi79k8F yHdm6mAElnxM77H47fK4gPRXa7oAznNci8VYwDIOCK+OBLeX8Hjj7KOok6mQWbh48kQG HQg4k8RC708YieEXFFzmkCrKTao1ynUk98jHzkdUveoydspikB4r6+u3nfdntRrS2DvE KqLEX8DOL54+Qw74UQdkkJmzKSnSsqHfKaxECk4MY55DcmGQhd1YjL9jO7nT5FXLBvCs BPUEo2q0nFgsWeKO9938rPI4qVqQw51+Ds+vtfoVvvd0wO69CLFmSNhAauPA5SLoZBCe eJjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Yj7TZPGy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b0057c3fb18aafsi9678066pgb.78.2023.09.25.19.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 19:03:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Yj7TZPGy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 72172802F686; Mon, 25 Sep 2023 08:58:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232931AbjIYP6W (ORCPT <rfc822;pusanteemu@gmail.com> + 29 others); Mon, 25 Sep 2023 11:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232660AbjIYP6T (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 25 Sep 2023 11:58:19 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9CE6B8; Mon, 25 Sep 2023 08:58:11 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2001:b07:646b:e2:e4be:399f:af39:e0db]) (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) (No client certificate requested) (Authenticated sender: laura.nao) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7587266072FC; Mon, 25 Sep 2023 16:58:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695657489; bh=/jor1FFC8SKohb/3sjU4fNSEVcDdd5txHAwwx7fIBc0=; h=From:To:Cc:Subject:Date:From; b=Yj7TZPGyFSKyYUXBAftWJ3qbMbHh0mNoeK4uMfrKq9i3JM/0QRIIHCkI+AyPTbQAl P/89sJTx9UWu7mnSpcKa03WHuHHuo6EjAquah4HRMEB+hajtAU9dLrsPklof/fEIRg ZQ35ITZn9dbYss1m75f6PsBPGP+sLgA7pCL1hdhhYs4RGi70xIteGWNGIE4gKwmYcW nHLW++Y1ii3M7l7DeJ0upjzB84UscOnXAhY1RtHIBSlWqBE1AnIyuEoTZeyMulbfVW SYEmByZhyhfZlKGQCMwcE6GeryzXqOtL9oFmtKW5PCkq/3IqiXEYKFfS9WNxwC3TN3 8TjP9ypoHuQhw== From: Laura Nao <laura.nao@collabora.com> To: rafael@kernel.org, lenb@kernel.org, shuah@kernel.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, groeck@chromium.org, broonie@kernel.org, robh+dt@kernel.org, kernelci@lists.linux.dev, kernel@collabora.com, Laura Nao <laura.nao@collabora.com> Subject: [RFC PATCH 0/2] Add a test to verify device probing on ACPI platforms Date: Mon, 25 Sep 2023 17:58:04 +0200 Message-Id: <20230925155806.1812249-1-laura.nao@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:58:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778063811983994702 X-GMAIL-MSGID: 1778063811983994702 |
Series |
Add a test to verify device probing on ACPI platforms
|
|
Message
Laura Nao
Sept. 25, 2023, 3:58 p.m. UTC
Regressions that prevent a driver from probing a device can significantly affect the functionality of a platform. A kselftest to verify if devices on a DT-based platform are probed correctly was recently introduced [1], but no such generic test is available for ACPI platforms yet. bootrr [2] provides device probe testing, but relies on a pre-defined list of the peripherals present on each DUT. On ACPI based hardware, a complete description of the platform is provided to the OS by the system firmware. ACPI namespace objects are mapped by the Linux ACPI subsystem into a device tree in /sys/devices/LNXSYSTEM:00; the information in this subtree can be parsed to build a list of the hw peripherals present on the DUT dynamically. This series adds a test to verify if the devices declared in the ACPI namespace and supported by the kernel are probed correctly. This work follows a similar approach to [1], adapted for the ACPI use case. The first patch introduces a script that builds a list of all ACPI device IDs supported by the kernel, by inspecting the acpi_device_id structs in the sources. This list can be used to avoid testing ACPI-enumerated devices that don't have a matching driver in the kernel. This script was highly inspired by the dt-extract-compatibles script [3]. In the second patch, a new kselftest is added. It parses the /sys/devices/LNXSYSTEM:00 tree to obtain a list of all platform peripherals and verifies which of those, if supported, are correctly bound to a driver. Feedback is much appreciated, Thank you, Laura [1] https://lore.kernel.org/all/20230828211424.2964562-1-nfraprado@collabora.com/ [2] https://github.com/kernelci/bootr [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/dtc/dt-extract-compatibles Laura Nao (2): acpi: Add script to extract ACPI device ids in the kernel kselftest: Add test to detect unprobed devices on ACPI platforms MAINTAINERS | 2 + scripts/acpi/acpi-extract-ids | 60 +++++++++++++++ tools/testing/selftests/Makefile | 1 + tools/testing/selftests/acpi/.gitignore | 2 + tools/testing/selftests/acpi/Makefile | 23 ++++++ .../selftests/acpi/test_unprobed_devices.sh | 75 +++++++++++++++++++ 6 files changed, 163 insertions(+) create mode 100755 scripts/acpi/acpi-extract-ids create mode 100644 tools/testing/selftests/acpi/.gitignore create mode 100644 tools/testing/selftests/acpi/Makefile create mode 100755 tools/testing/selftests/acpi/test_unprobed_devices.sh
Comments
Gentle ping to check if there are any feedback or comments on this series. Thanks, Laura
Your talk was interesting at Linux Plumbers. https://www.youtube.com/watch?v=oE73eVSyFXQ [time +2:35] This is probably a stupid question, but why not just add something to call_driver_probe() which creates a sysfs directory tree with all the driver information? regards, dan carpenter
> Your talk was interesting at Linux Plumbers. > > https://www.youtube.com/watch?v=oE73eVSyFXQ [time +2:35] > > This is probably a stupid question, but why not just add something to > call_driver_probe() which creates a sysfs directory tree with all the > driver information? > Thanks for the feedback! Improving the device driver model to publish driver and devices info was indeed another option we considered. We could have a debugfs entry storing this kind of information, similar to what devices_deferred does and in a standardized format. This would provide an interface that is easier to query at runtime for getting a list of devices that were probed correctly. This would cover devices with a driver that's built into the kernel or as a module; in view of catching also those cases where a device is not probed because the relevant config is not enabled, I think we'd still need another way of building a list of devices present on the platform to be used as reference. The solution proposed in this RFC follows the same approach used for dt based platforms for simplicity. But if adding a new sysfs entry storing devices and driver info proves to be a viable option for upstream, we can surely explore it and improve the probe test to leverage that. Best, Laura
On Thu, Nov 23, 2023 at 01:09:42PM +0100, Laura Nao wrote: > > Your talk was interesting at Linux Plumbers. > > > > https://www.youtube.com/watch?v=oE73eVSyFXQ [time +2:35] > > > > This is probably a stupid question, but why not just add something to > > call_driver_probe() which creates a sysfs directory tree with all the > > driver information? > > > > Thanks for the feedback! > > Improving the device driver model to publish driver and devices info > was indeed another option we considered. We could have a debugfs entry > storing this kind of information, similar to what devices_deferred > does and in a standardized format. This would provide an interface > that is easier to query at runtime for getting a list of devices that > were probed correctly. > This would cover devices with a driver that's built into the kernel or > as a module; in view of catching also those cases where a device is > not probed because the relevant config is not enabled, I think we'd > still need another way of building a list of devices present on the > platform to be used as reference. Yeah. So we'd still need patch #1 as-is and but patch #2 would probably be simpler if we had this information in sysfs. Or a different solution would be to do what someone said in the LPC talk and just save the output of the previous boot and complain if there was a regression where something didn't probe. > > The solution proposed in this RFC follows the same approach used for > dt based platforms for simplicity. But if adding a new sysfs entry > storing devices and driver info proves to be a viable option for > upstream, we can surely explore it and improve the probe test to > leverage that. You're saying "simplicity" but I think you mean easiest from a political point of view. It's not the most simple format at all. It's like massive detective work to find the information and then you'll have to redo it for DT and for USB. Are there other kinds of devices which can be probed? I feel like you're not valuing your stuff at the right level. This shouldn't be in debugfs. It should be a first class citizen in sysfs. The exact format for this information is slightly tricky and people will probably debate that. But I think most people will agree that it's super useful. regards, dan carpenter
On 11/23/23 16:14, Dan Carpenter wrote: > On Thu, Nov 23, 2023 at 01:09:42PM +0100, Laura Nao wrote: >>> Your talk was interesting at Linux Plumbers. >>> >>> https://www.youtube.com/watch?v=oE73eVSyFXQ [time +2:35] >>> >>> This is probably a stupid question, but why not just add something to >>> call_driver_probe() which creates a sysfs directory tree with all the >>> driver information? >>> >> >> Thanks for the feedback! >> >> Improving the device driver model to publish driver and devices info >> was indeed another option we considered. We could have a debugfs entry >> storing this kind of information, similar to what devices_deferred >> does and in a standardized format. This would provide an interface >> that is easier to query at runtime for getting a list of devices that >> were probed correctly. >> This would cover devices with a driver that's built into the kernel or >> as a module; in view of catching also those cases where a device is >> not probed because the relevant config is not enabled, I think we'd >> still need another way of building a list of devices present on the >> platform to be used as reference. > > Yeah. So we'd still need patch #1 as-is and but patch #2 would probably > be simpler if we had this information in sysfs. Or a different solution > would be to do what someone said in the LPC talk and just save the > output of the previous boot and complain if there was a regression where > something didn't probe. > Right. The main drawback of using the status of a known good boot as reference is to keep it up to date over time. If support for a peripheral gets added at a later stage, the reference needs to be updated as well. >> >> The solution proposed in this RFC follows the same approach used for >> dt based platforms for simplicity. But if adding a new sysfs entry >> storing devices and driver info proves to be a viable option for >> upstream, we can surely explore it and improve the probe test to >> leverage that. > > You're saying "simplicity" but I think you mean easiest from a political > point of view. It's not the most simple format at all. It's like > massive detective work to find the information and then you'll have to > redo it for DT and for USB. Are there other kinds of devices which can > be probed? > Yeah, that's what I meant. The ACPI use case is in a way simpler to handle than the dt one, as we can get information on non removable devices on enumerable buses such as PCI from the ACPI tables (leveraging the _ADR objects). But it still requires quite a lot digging in sysfs to get info on what was actually probed. So having a list of probed devices would help both use cases. > I feel like you're not valuing your stuff at the right level. This > shouldn't be in debugfs. It should be a first class citizen in sysfs. > > The exact format for this information is slightly tricky and people will > probably debate that. But I think most people will agree that it's > super useful. > Right, agreeing on a format will be tricky. Judging by the response here and in LPC it's still worth a shot though. I'll put some thought into this and experiment a bit to come up with a proposal to submit in another RFC. Again, thanks for the helpful feedback! Best, Laura