Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1210761pxb; Thu, 4 Mar 2021 06:14:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5PFe6mu4//DPxdnMWyAKT0UmjGIdHQXxaEenj1KLTQKPYUflGBxE4aqDcZ4r9KgA5CQVt X-Received: by 2002:a17:906:4fc8:: with SMTP id i8mr4364435ejw.228.1614867295556; Thu, 04 Mar 2021 06:14:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614867295; cv=none; d=google.com; s=arc-20160816; b=ueC3hlWVD4A7BOcchHBnMvH5OnT/5zx9sS6kWYvybWQXJL84nLM5AIJGuBp7Vv8z9e n2EMjN4te7uYlcpn7L1qyJbdQBjOc+Fo+V/YsLUVTztl9wqdcEqEIvumNx6HvvTtot0g EJG4bmKWY0tbSI1UPCwfBRoSMlMOC7c22Ym4KCA0QDalBxu4ZkNAGdD+ezuJNz67RM2l tuzM1OSl6v1aRBL8kWn3Hav02LE2n9YYrw/aN+rrgrXFPjrf1qXqJ/R9f0Lk6DHs6GIb 3BlwUkl+ml/horvodMac1iVVL1huJuZNDBZ/b5nG0/gUpHJ0YRrhFFMuz5Pd+2XH5GOr H68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=PfZ+OYxNm7h5tJK5w+oUr32uRv1k2kpI5yPw7ocFrgQ=; b=pe8tdEkEp8Un1ritpSZTBl8n9klUgGZo0LGZwI/wA+LnL2v0jRiFb90no2epi1RneP hQ2eQQhNn3iYVcypUd9ziw5rz4X/W9Jmh2+XntEvAdZe9hhIbH0D+h8mT2ROcObFAk2Z AExv+D2L/XYKVv+a+ACBFbAARNKKgDkSZl+slXGsxSlMtvmg/8EKQ8GpI9Jw95jPdczn KNGgrEGufl+i/JTo8koklqrTo8A8wTziG6Y0xRf7+n8lx3Yef+pfYSFtEEXQBEaINnM6 gojuDbxH86uWj4mLZVuDX0RAg5ldVHdYgmRYs01TTl021mJ6bCvLfZ4/px7oloaSf7dU d0rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X8eFB+3S; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x27si16723709ejb.603.2021.03.04.06.14.32; Thu, 04 Mar 2021 06:14:55 -0800 (PST) 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=@chromium.org header.s=google header.b=X8eFB+3S; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357030AbhCDBF2 (ORCPT + 99 others); Wed, 3 Mar 2021 20:05:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452899AbhCDAjM (ORCPT ); Wed, 3 Mar 2021 19:39:12 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60C6C061756 for ; Wed, 3 Mar 2021 16:38:31 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id t29so17546242pfg.11 for ; Wed, 03 Mar 2021 16:38:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=PfZ+OYxNm7h5tJK5w+oUr32uRv1k2kpI5yPw7ocFrgQ=; b=X8eFB+3ST2j16ARrJMB0ef0lcaSQd7pyQlhMRgb/UiCqNftC01OYAykqug2pE+HFnF QzwrkzbKEefyiVjp+hT6AFNyQlNzibYRR3rYc4gTqJZB8u62ZMFm8jbrPSXyugqQ5/i5 NEFoW3WcNnpW17d/5DJ6rTQurIeb5XwKW+u04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=PfZ+OYxNm7h5tJK5w+oUr32uRv1k2kpI5yPw7ocFrgQ=; b=gxPY2tk5/uzkVuFinkf88hYXpFGHIXx46Jy4kejm1BlZz+EYEP4negLlmyaJJld0MD obWiCtrvuHK52V0cH8tEcVALI4FJ26WPrVrxEJ/QacEqOCcPO4OdQN40O+4sycuB3W+a St28v2BmEQA9BcZU1yKmiARBL1sPYaiG5gpPmEYaLw8kAdKssAmvlYnQ6cuA4bFROCUe oysf9BbjJVjG19HXma9PAjUs4kAeOKRID4cf/mofgElKccMZ4UK68vhaw23vyXE3Cqr1 cHlniEeoV77/c2vLHT0dVsfJ1FQhsfQkJ4EdWL3rf+/V0W35gR22pru6eNbZNEVeNGx2 ftZA== X-Gm-Message-State: AOAM530wEFgio9/uj2PcQUIsGg6xd0k1blYGOCnwO87Qt4N5vXeqiPDO neKR+7NSbExZmAWSBU9Jbz9oDg== X-Received: by 2002:a63:c90c:: with SMTP id o12mr1448716pgg.210.1614818311181; Wed, 03 Mar 2021 16:38:31 -0800 (PST) Received: from chromium.org ([2620:15c:202:201:2510:ab07:78a:7d78]) by smtp.gmail.com with ESMTPSA id d16sm19780490pfq.203.2021.03.03.16.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 16:38:30 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20210301174749.1269154-1-swboyd@chromium.org> <20210301174749.1269154-6-swboyd@chromium.org> <20210303100012.0e6e4de3@gandalf.local.home> Subject: Re: [PATCH 5/7] printk: Make %pS and friends print module build ID From: Stephen Boyd Cc: Petr Mladek , Andrew Morton , linux-kernel@vger.kernel.org, Jiri Olsa , Alexei Starovoitov , Jessica Yu , Evan Green , Hsin-Yi Wang , Sergey Senozhatsky , Rasmus Villemoes , linux-doc@vger.kernel.org To: Andy Shevchenko , Steven Rostedt Date: Wed, 03 Mar 2021 16:38:28 -0800 Message-ID: <161481830876.1478170.4374239517736205573@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Andy Shevchenko (2021-03-03 08:17:01) > On Wed, Mar 03, 2021 at 10:00:12AM -0500, Steven Rostedt wrote: > > On Wed, 3 Mar 2021 11:25:58 +0100 > > Petr Mladek wrote: > >=20 > > > Alternative solution would be to minimize the information, for > > > example, by printing only the modules that appear in the backtrace. > > > But this might be complicated to implement. > >=20 > > It could be a list after the backtrace perhaps, and not part of the > > "modules linked in"? > >=20 > > But then you need a generic way of capturing those modules in the backt= race > > that works for every architecture. Right, and doing that is sort of complicated for something that really shouldn't need to be complicated. We're printing out information about a crash/hang/bug and that should be fast and not too computationally intensive so that the stacktrace can be printed before everything starts falling apart. I'd rather not save things away while processing the stacktrace and then print more info after the stacktrace. Seems fragile. >=20 > > Honestly, I don't even know what a buildid is, and it is totally useless > > information for myself. What exactly is it used for? >=20 > Dunno Stephen's motivation, but build ID is very useful when you do traci= ng, > then based on ID the decoders can know what exactly was the layout of the > binary and list of (exported) functions, etc. >=20 > At least that was my (shallow) experience with perf last time I have trie= d it. >=20 I'm starting to feel like nobody read the commit text, or I messed up somehow and the commit text was confusing? :( =E2=94=82 This is especially helpful for crash debugging with pstore or cra= shdump = =20 =E2=94=82 kernels. If we have the build ID for the module in the stacktrace= we can = =20 =E2=94=82 request the debug symbols for the module from a remote debuginfod= server = =20 =E2=94=82 or parse stacktraces at a later time with decode_stacktrace.sh by= = =20 =E2=94=82 downloading the correct symbols based on the build ID. This cuts = down on = =20 =E2=94=82 the amount of time and effort needed to find the correct kernel m= odules = =20 =E2=94=82 for a stacktrace by encoding that information into it. =20 In some distro (read: non-kernel dev) workflows the vmlinux isn't shipped on the device and crash handling is done offline or much later. Using the build ID[1] is a common way to identify the binary that's running on the device. In conjunction with a debuginfod[2] server you can download the symbols for a crash automatically if you have the build ID information. I can add a patch that updates decode_stacktrace.sh to show how it can download the correct vmlinux/modules if it isn't provided on the commandline. If the debug symbols are on some public server then in theory we could have some robot sitting on the mailing list that looks for stacktraces and automatically replies with information about the line number/file and even provides the code snippet for the code that's crashing from that binary, because it's all stored in the full debuginfo builds. [1] https://fedoraproject.org/wiki/RolandMcGrath/BuildID [2] https://sourceware.org/elfutils/Debuginfod.html