Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp875095pxy; Wed, 28 Apr 2021 16:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnKcGBERdgsy1hpq3yfmI9WWIn1wq/0Lf1t6qLzs4bNI7g6TBehhXFWzsXVtUGUSxxe6Ul X-Received: by 2002:a17:906:c40f:: with SMTP id u15mr15698328ejz.11.1619651759426; Wed, 28 Apr 2021 16:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619651759; cv=none; d=google.com; s=arc-20160816; b=frQttpbQruEKuARgoFSo17NdJesNHLdYj9I4wyB5gclzpiuKhoM7MfmngmuL23TVXX kPRKNTSyfY7mOkBfuUjVMV7KHC9PcAwn4aaBK6UZgXU5b49hvbN3DTvOpZNieZs4Z57+ QIKiLxnuICCyYsBqolBkjK6/hw3q7J37hjk6nXje4AH1EIArBSjToQ601eaUhbxZH3OM Vi4VON21rU48N+Nd0p51RvRbhtXUZwieF+wTKOP2n1H6DhACwLVTubCBO2uFF7QtCc5c oZ86rR/TyJkmxnECYdvnNb0jKXbDJpbgLAHyMkcb9Vaj7OdAQRyC3IfnNAJqUvTXv6SB BdTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=wJJ8QiWGv/JVmwQ5VkteCr60IW5p6zpCwSUgzllQPe8=; b=SIoJOvgRyfjEEqUG3tB/HGrYOz5B/3SLl2leQV2GP5pVIZ55kKKOQDPYoVQOpwsSPG QTTfd7LJX1JRYbpsTENR51TzV0Bvn2VMW5Xaads8OmUs/1gc0vWJYgel2ZptELvyGiDY zeichsZGv282rgBY7ZNkFTFE67mBPZbw8GM/3V0s0OwBDdoH2i3QFoo8DbQ7Q4GrlbAT ON4vUsPWxvtAoaA06r23MrSA1rtB+YPU2U/q2cPZI481wqpkM9e8RdePUYJPOeqrU5vu Q7BrM+vitOv4LyEqDz8f0pSXJFV8Sf1CMBcX95TTHJwMf16bwnauJGqo1X6V1qar+nvX 4btg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xa5ecP80; 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 bu2si1108873edb.151.2021.04.28.16.15.36; Wed, 28 Apr 2021 16:15:59 -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=@chromium.org header.s=google header.b=Xa5ecP80; 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 S234398AbhD1XPa (ORCPT + 99 others); Wed, 28 Apr 2021 19:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238304AbhD1XP3 (ORCPT ); Wed, 28 Apr 2021 19:15:29 -0400 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3948DC06138B for ; Wed, 28 Apr 2021 16:14:44 -0700 (PDT) Received: by mail-oo1-xc2f.google.com with SMTP id i3-20020a4ad3830000b02901ef20f8cae8so6967702oos.11 for ; Wed, 28 Apr 2021 16:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=wJJ8QiWGv/JVmwQ5VkteCr60IW5p6zpCwSUgzllQPe8=; b=Xa5ecP80tPGOMiGg8GhHfpXJpzPYGQr/odIbRKQUNi89lg2BLnhXdkS4LS2tAW5VG1 P+kgkGNesIl9xUi53nBNzYFMxnuVjjNrO+Op42nVOHMsBnDP3VHOX+MP1ZHKcgqhwy8T EjBGzf/zr/5owdbtGE5qDNPwD5Ww108yi7ILo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=wJJ8QiWGv/JVmwQ5VkteCr60IW5p6zpCwSUgzllQPe8=; b=LWeuDo1IXZw8SHGndU1WFlaQxgB3kHl5n+vZlHKhjbZJVNlMOrONV4ZInFYbqWMEWv gUY8tyX+b9WflxcAtIG1c2xnmZKUVJ7yqqzc22K5WdZqb7wuqDSCCScix/2pj2yb/Xs/ AZqNghmu60jQvT3HvLJfB0rP+b80M3Pto4/thfpeziBrQM9SpyRQhmbm5azj8X13d6m3 l8ZQ/yW/l8ID037WxDDX8l53160MeSgGrhk67FiMWB/Px6cmgQey8qxTqEE3Hk0NYyVQ wOZUk8wuomzffrt5t9Db/iBvTBf7Y44vIjQ5MusxOsDv5c/+XVvKLg+OEVVOdHO4DKLo MO+g== X-Gm-Message-State: AOAM532XAxS3FNeGqq234ElseL8vVNrU7YnDe0r+mbN6qNILZ8kj8of0 EmyzYJ10QCKZd+dof1TLjk+UBTUIBwGC0akOqQSoTQ== X-Received: by 2002:a05:6820:381:: with SMTP id r1mr24770069ooj.79.1619651683707; Wed, 28 Apr 2021 16:14:43 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 29 Apr 2021 01:14:43 +0200 MIME-Version: 1.0 In-Reply-To: <20210428101355.GB8374@localhost.localdomain> References: <20210420215003.3510247-1-swboyd@chromium.org> <20210420215003.3510247-14-swboyd@chromium.org> <20210428101355.GB8374@localhost.localdomain> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Thu, 29 Apr 2021 01:14:43 +0200 Message-ID: Subject: Re: [PATCH v5 13/13] kdump: Use vmlinux_build_id to simplify To: Baoquan He Cc: Andrew Morton , linux-kernel@vger.kernel.org, Jiri Olsa , Alexei Starovoitov , Jessica Yu , Evan Green , Hsin-Yi Wang , Dave Young , Vivek Goyal , kexec@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Baoquan He (2021-04-28 03:13:55) > On 04/20/21 at 02:50pm, Stephen Boyd wrote: > > We can use the vmlinux_build_id array here now instead of open coding > > it. This mostly consolidates code. > > > > Cc: Jiri Olsa > > Cc: Alexei Starovoitov > > Cc: Jessica Yu > > Cc: Evan Green > > Cc: Hsin-Yi Wang > > Cc: Dave Young > > Cc: Baoquan He > > Cc: Vivek Goyal > > Cc: > > Signed-off-by: Stephen Boyd > > --- > > include/linux/crash_core.h | 12 ++++----- > > kernel/crash_core.c | 50 ++------------------------------------ > > 2 files changed, 8 insertions(+), 54 deletions(-) > > > > diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h > > index 206bde8308b2..de62a722431e 100644 > > --- a/include/linux/crash_core.h > > +++ b/include/linux/crash_core.h > > @@ -38,8 +38,12 @@ phys_addr_t paddr_vmcoreinfo_note(void); > > > > #define VMCOREINFO_OSRELEASE(value) \ > > vmcoreinfo_append_str("OSRELEASE=%s\n", value) > > -#define VMCOREINFO_BUILD_ID(value) \ > > - vmcoreinfo_append_str("BUILD-ID=%s\n", value) > > +#define VMCOREINFO_BUILD_ID() \ > > + ({ \ > > + static_assert(sizeof(vmlinux_build_id) == 20); \ > > + vmcoreinfo_append_str("BUILD-ID=%20phN\n", vmlinux_build_id); \ > > Since there has been static_assert at above, can we remove the magic > number '20'? > > And I checked format_decode(), didn't find which type corresponds to > 'N', could you tell? It is documented in Documentation/core-api/printk-formats.rst (see "Raw buffer as a hex string") where the '20' replaces the '*' to specify a fixed size buffer to format. We could pass the 20 as an argument instead of encoding it in the format, but then it would still be there twice. We could use a #define but then it would have to be passed as an argument. I don't know of a good way to enforce in printk that the buffer is the size that matches the format size. Maybe it shouldn't be an option to have a size in the format string if it's a problem to put the size of the buffer in there. > > Other than these, this patch looks good to me, thanks for the effort. > Thanks.