Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp39488pxb; Tue, 28 Sep 2021 14:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjqjwTQqcjLZlAvZxI8viP942kAJtSkEHNEeFPU/atmQ9YXsJMMpvovrSpLg+285B27iLV X-Received: by 2002:a63:7447:: with SMTP id e7mr6563968pgn.240.1632866156937; Tue, 28 Sep 2021 14:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632866156; cv=none; d=google.com; s=arc-20160816; b=oCocpBqjIqKgG2IPHWr9LEKdXTkLH7zyyiLt1XQZ8UAk9zHKWU0Hdz2JMZ2CeMpFKS 3+uYopq1YGQKeHJM0xvGixgmCov4Os24rOInaLdgCPvRP9kcNixa6vVXZRudNosPbA0C m9xzlMK5kwze7JWXAGpvbGS7Y82DFJQnaljjf9//Ao2U0E4KcEdKhDuRi/MU/feitgB6 L95s8VsENVpkwI5GIIBI5V6sBp1jxtDhR7/M999NYH6HAgPZXruMZ2uYoUFx98R/rkbx PUaQRXCVGZo5AfEvYN2oItJ8x/8VbKoAc7iguMEWtwuPH98m9sNseQoXr+Z4UCSTsZ94 2HDA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/4FuFPhgYhyuoUZyhtRplTNcJ0AKm7jNGTP+lpCV5xc=; b=AHh8mpSslwAubP6UPEY37rykQulmycbKiZId5TtrFYtcveCUm/HPI1gDxhhUSnoXwP NkSAlvrxpzyaurFXLz2mlVNOWfG2bM4YdUY8X5YP9kjvWqAb/lbscaVZi3CS4EcNcMNT 2iwGIAZjibU/iiv+6vyFPLSbge5N8ritA2RvhjwuLrmyctAmVGmBZtfMFdyFE6Bf3u4F LxlGbxf61ST2VG7k7MEcW32KSA6yK6kuaq1bDsf1iaKJw5jKYd5B8tCdHwBxwhJ/gtYp 1NUuXuOlUkHOZ03P+QrGs5q0ohMuwEckNfqauy+LjAPZv4t6Gmgvp1+A9oc9AwtIjUf9 5nNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TB91dGpa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si437858pgp.468.2021.09.28.14.55.43; Tue, 28 Sep 2021 14:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TB91dGpa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241482AbhI1V4Q (ORCPT + 99 others); Tue, 28 Sep 2021 17:56:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:60886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242953AbhI1V4N (ORCPT ); Tue, 28 Sep 2021 17:56:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C37E361361; Tue, 28 Sep 2021 21:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632866068; bh=5DC628JTfQgAdUOV20xA7AYdGWA68TDRdk2X9voYma8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TB91dGpae+2oXhyXtRjt4A/AnKDSZeaXqF/4nC/GuwWNcBeXU2xgPv+aMyqqnWhpQ R8hRAFfta3yO3WW9M76wiJqw6ODyBncufTbJ+umXyxMQ5+t06scVlpgQrBz4khL5uL BQrq7J2g4CXvO6qL5E8U0Qqs1xXtCV9JLC84N2xMqJ+wfoTI2Jksi7t9Ygyn4LLLNv HklrdNY5cvq5ZFwsrpJGTYtrAavSGtAbeg+nNTnS3zJD629U94HoLP1u+a3bMnlBsG xes10S4H6jPKqEweMzWOZZ+9SyJxszj/o3hZ2mkeBRUwi+wKzZSTJzhF5V8xUdR3Js qeI7Y3CCeHRlQ== Date: Tue, 28 Sep 2021 23:54:25 +0200 From: Mauro Carvalho Chehab To: Greg Kroah-Hartman Cc: Linux Doc Mailing List , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: Re: [PATCH 0/3] get_abi: improve message output and fix a regression Message-ID: <20210928235425.02ffa1a4@coco.lan> In-Reply-To: References: <20210928142739.2ffe380b@coco.lan> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, 28 Sep 2021 19:18:31 +0200 Greg Kroah-Hartman escreveu: > On Tue, Sep 28, 2021 at 02:27:39PM +0200, Mauro Carvalho Chehab wrote: > > Em Tue, 28 Sep 2021 13:04:22 +0200 > > Greg Kroah-Hartman escreveu: > > > > > On Tue, Sep 28, 2021 at 12:14:01PM +0200, Mauro Carvalho Chehab wrote: > > > > Hi Greg, > > > > > > > > As promised on > > > > > > > > https://lore.kernel.org/lkml/20210928120304.62319fba@coco.lan/T/#u > > > > > > > > I'm adding progress info when get_abi.pl is checking for undefined ABI symbols > > > > on patches 1 and 2. > > > > > > > > That will help not only to identify what is causing delays on the script, but also > > > > to notify the user that processing it could take some time on some systems. > > > > > > > > If you run it on your big server with: > > > > > > > > scripts/get_abi.pl undefined 2>logs > > > > > > > > The "logs" file will contain timestamps relative to the time the script started to > > > > do the regex matches for sysfs files. It should be printing one line every > > > > time the progress completes 1% or one second after the last progress output. > > > > > > Adding more debugging and tweaking the script a bit to show the file it > > > is about to check, not the one it finished checking, > > > > Feel free to modify the script and add such debug/tweaks if you find > > it useful. > > > > > I got the following > > > debug output that seems to pinpoint the problem file. > > > > > > The sysfs file that is causing problems is: > > > /sys/devices/pci0000:40/0000:40:00.2/iommu/ivhd1/amd-iommu/cap > > > > > > and here's some debugging output for the regex it needs to search for > > > this: > > > > > > /sys/devices/pci0000:40/0000:40:00.2/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/amd\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:00.2/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/intel\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:00.2/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/devices/pci.*.*.*.*\:.*.*/0000\:.*.*\:.*.*..*/dma/dma.*chan.*/quickdata/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:07.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/amd\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:07.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/intel\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:07.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/devices/pci.*.*.*.*\:.*.*/0000\:.*.*\:.*.*..*/dma/dma.*chan.*/quickdata/cap$)$/ > > > /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:02/device:7a/physical_node/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/amd\-iommu/cap$)$/ > > > /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:02/device:7a/physical_node/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/intel\-iommu/cap$)$/ > > > /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:02/device:7a/physical_node/iommu/ivhd1/amd-iommu/cap =~ /^(?^:^/sys/devices/pci.*.*.*.*\:.*.*/0000\:.*.*\:.*.*..*/dma/dma.*chan.*/quickdata/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:01.3/0000:4a:00.0/0000:4b:0a.0/0000:50:00.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/amd\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:01.3/0000:4a:00.0/0000:4b:0a.0/0000:50:00.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/class/iommu/.*/intel\-iommu/cap$)$/ > > > /sys/devices/pci0000:40/0000:40:01.3/0000:4a:00.0/0000:4b:0a.0/0000:50:00.0/iommu/amd-iommu/cap =~ /^(?^:^/sys/devices/pci.*.*.*.*\:.*.*/0000\:.*.*\:.*.*..*/dma/dma.*chan.*/quickdata/cap$)$/ > > > > Hmm... interesting. Perhaps the problem is on regexes like this: > > > > /^(?^:^/sys/devices/pci.*.*.*.*\:.*.*/0000\:.*.*\:.*.*..*/dma/dma.*chan.*/quickdata/cap$)$/ > > > > Which actually represents this What: > > /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dmachan/quickdata/cap > > > > The script could have done a better job escaping "." character on > > it (but that is not too trivial) and grouping altogether ".*" > > repetitions, although, in this specific case, probably the best > > regex would be, instead: > > > > /sys/devices/pci[\da-f:\.]+/dma/dma\d+chan\d+/quickdata/cap > > > > One possible long-term solution would be to directly use regexes > > directly on "What" fields inside Documentation/ABI, but on some parts > > this would require some changes, like, for instance: > > > > /sys/bus/usb/devices/-:./::./kone/roccatkone/weight > > > > Ok, we could likely use capture groups like: > > > > (?pattern) > > > > but IMO that would make it a lot harder to be understood by humans. > > > > > > > And sometimes this thing finishes in 20 seconds, and others, many many > > > minutes. It's not deterministic at all, which is odd. Is the sysfs > > > tree being sorted so that this should always have the same search order? > > > > No, because it uses a lot of hashes in order to speed it up. Yet, > > it shouldn't be hard - nor it would significantly affect the processing > > time - to make it more deterministic. See the enclosed path. > > That patch solved everything. > > It now only takes 10 seconds. Every time. Without the patch, it feels > hung for some reason. The explanation is simple - still weird :-) - basically, when an ABI symbol is found, the regex test loop stops. Sorting the regexes probably placed the slowest regex to happen *after* the one that matched the ABI symbol. > Care to turn that into a patch that I can take? Sure. Just sent it. > > > > Anyway, I've applied this series as well, this helps in finding the > > > problems :) > > > > Thanks! > > > > > Note, I can provide an off-list tarball of /sys/ if that would help in > > > debugging anything on your end. > > > > Yeah, that can help. Feel free to send it to me. > > > > Btw, I just got an arm64 server with 128 CPUs for testing. I'm trying > > to allocate also a big x86 server here, but I'm not sure if it is AMD or > > Intel. > > This is on perl 5.34 here. > > thanks, > > greg k-h Thanks, Mauro