Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1365534pxj; Fri, 18 Jun 2021 05:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFgFMdEQgNGECtiSn4tN7Tp24+NhDn7hSM0BebrAqQpP08HLTBK7gTPTiwfH5Xs24ndBqe X-Received: by 2002:a05:6402:c8:: with SMTP id i8mr4715211edu.380.1624020285541; Fri, 18 Jun 2021 05:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624020285; cv=none; d=google.com; s=arc-20160816; b=EtIOYTqzdq/DeQrLhEXvTiXDDAfCjIP5iJiSUuYzUGYQHMoDAhugX/nlV+g6ATAgr/ OixrsYZGlnrNqZ62njECWJ/swKRKirZLObvt4j9EjSmBA9sc7R+IUH94poN6NGktcGuc 8WagMqoD9D4WUN2AAFp0XF1mU53Q+aj+rQH+tL77rOOmEG9wkAXN4P7FcVd4qwC+b/2k H1DZs8pB2JnIfVkZzY4ttW7TBt0gmPcco2RA5DLIkJCGPNOZbgtZvq6rb9mo6+pWyKzV 7eajNbtx9AZx3CAm5G2OdAaW3YaL3pDQEWn8TdcTVPZPUZQgl5hHM9xxWFjx8MvbfpdY IOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TsVpxNkvhXQ64Q0WHw8rfWIz2NFlbiItXaeY2K5fawU=; b=qKbaEh2PoIBLtFcmmNTBou2f4KG4vuNcA7SuZB9wOCAR4T5K2N0lP8FJk7YOl7C2cK 1ImTsIX+lP2zTGob/A/7cd9xzHc/p7paGjT/QC0ZI8Vfprw/rEVArbrrwvIs1WQEoDpn clyFu5qNAXK2cGDqbyItP67STvEp+mqKlMCbfb5n0Smq+wMF8vIG9gmfm+rL1eq7IHvL J4dhmIf3Ab7QpofkSdjgMQUUQZ3uL+eMAFushDbelnjxf9vAL0OfY880nlaZD1h8L1iE LTdhh2l1ADxOxgpAATRGW9TgY5Sd83vTZ3oIZxW369WThTvtbuPO1PBfHf1p38GFDjL/ rj2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IRytBE4O; 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 g3si9133318edb.1.2021.06.18.05.44.22; Fri, 18 Jun 2021 05:44:45 -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=IRytBE4O; 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 S232825AbhFRLaw (ORCPT + 99 others); Fri, 18 Jun 2021 07:30:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:37743 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232027AbhFRLau (ORCPT ); Fri, 18 Jun 2021 07:30:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2329A61260; Fri, 18 Jun 2021 11:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624015721; bh=Sa6qZE3QNHE3M51R0IukZj2WfR63Jf3Sq9L759jl7Ms=; h=From:To:Cc:Subject:Date:From; b=IRytBE4Op3X7dUSIUjmwFxFrmCN6Y/x0UC3SEr8YvrKu3aJZUTq+qVP77rHQAjUUF 1/qFSWEyZoMVhM+x97DQLM/hTmt8gfas9bzYaF4CVnXEsHcnIqNUxgxN3y1zvCweGK 246H1koB/bB1FCkRhOMtc0mZtTaoPpgAZOxrjZ3WaPSuqaZ095LboV8SydRo+DRmxv Z9dELcHVNoAl+X8ElXBJrLrwBf3Gi6738iVWyhVZpS7FWP2BrHhnlbB9dwFtayefwh J+NXKAR8sMtX1TszlmESvCvIMYVPgECZJv9g0LeSnuzy4HIPBMWSndLf1El8vQhqXM 8pJZ1YgdTEi1A== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1luCfu-008agJ-Qk; Fri, 18 Jun 2021 13:28:38 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg KH Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , Jonathan Cameron Subject: [PATCH RFC 0/1] get_abi.pl: add support for ABI valitation in runtime Date: Fri, 18 Jun 2021 13:28:36 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, I was talking today with Jonathan Cameron today about how to ensure that the ABI is not missing something. While it would be doable to validate the ABI by searching __ATTR and similar macros around the driver, this would probably be very complex and would take a while to parse. Yet, there's one way that should be quick and easier to implement: Read the symbols from the current system in runtime, and check if everything is declared under Documentation/ABI. As you know, scripts/get_abi.pl has already a search command, that would allow seeking for a symbol inside the ABI. Using a logic similar to that, but checking for all symbols under /sys is not hard to implemenent. That's what patch 1 does. Right now, the results aren't exaustive (I opted this way for the RFC version, as otherwise there will be too many symbols that won't match the regexes generated from the What: fields). It basically reports results where the sysfs nodename matches one or more What, but doesn't match the regex. This implementation runs very quick on my desktop: it takes less than 2 seconds to run. So, it sounds a good start to help identifying what's missing. One of the problems with the ABI definitions is how to define wildcards there. Different ABI declarations use different notations. For this first RFC version, it all the above as wildcards[1]: {foo} [foo] /.../ * and convert them into: .* [1] perhaps the better would be to just use regex on What:, as this would avoid extra heuristics at get_abi.pl, but this is somewhat OOT from this patch. One of the first results is that some /sys symbols that are present on *lots* of sysfs nodes, but they aren't properly defined at ABI: /sys/.*/(initstate|bind|unbind) (there are definitions, but those aren't covering all occurrences) Another problem it caught is that slab definitions are like: /sys/kernel/slab/cache/alloc_calls Instead of using a wildcard, like: /sys/kernel/slab/*/alloc_calls or: /sys/kernel/slab//alloc_calls So, they don't match the actual symbols found at the system. What do you think? Regards, Mauro Mauro Carvalho Chehab (1): get_abi.pl: Check for missing symbols at the ABI specs scripts/get_abi.pl | 72 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) -- 2.31.1