Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp177153pxy; Fri, 7 May 2021 00:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv1nVlubwOzNUkN/onhbKGzu11G5wDHZElQFsJUP6N6LsbfylUONwyN7/ydTGUFRiYR7Am X-Received: by 2002:aa7:d699:: with SMTP id d25mr9413709edr.107.1620371521779; Fri, 07 May 2021 00:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620371521; cv=none; d=google.com; s=arc-20160816; b=gcPVehnbR1mbLQ1wh0xaEqMla1RR2yyVxTB3zaIlcOEf4PYx+U4VzXGkYzFEAkMUFG Ib9GWSARGX8wJKXxHOyesDECusOVf6wObwHRCALKNi6akn9flzZSabEHfODIVmSFTuhS jrc7BwgATyW3lJI1TIjwHYHCVVmfdOXMzx9F3zb7sI29XpnH2Okctnr9+5UTWhI3zwzf Q2uAv8iu/m/NqOD1EaYbIxyUvuI5ryr/U+zfAH+ZBM4nY7SbXsDRQJJMXu3D5HTk0Z9N L2CcLqWrhj7aqzSTRKWbTPcY3iciYZcM67TcRq5S/yPnMlzQAU9/GRE43yPwmLy6OpsB V1sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SM2Z2RJmf/HvwWoGqGzjgfGTsjHITFB7ckefQrdnYRA=; b=cRPsi7QTkWfS9b44ouKD+0nxxvpcRw6FX+LbmyuAyNlImGuHJ08HIbayJ+w+6/KOSp DiOHEoEhb1gw2QEvXQw4Z7aPRqKj/45/DEuC9YD3nJ+zuw+tMptiLLhM2aLLzjLW339H XCltAGkt5Av/aUPoS9ZpoSwaR0CJT+JzEi1EOqFAa5YBb6x4ARaIFw9NHn2QELwKTCLe BZFaxI0MZwtRMeJrOjemzYMWd5JlGRYqL+CICEdru/b4Q3yzPDBnWL5GlQz+j4oVeG0o wEQ1s8TsWcblDcXS/DVaITVK4TIwlct+ak8NRTRtUyBdpeekPq/zKdFe0vpFgwY9dpMh PX0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cZ9nLlZL; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id au16si2430771ejc.178.2021.05.07.00.11.38; Fri, 07 May 2021 00:12:01 -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=@redhat.com header.s=mimecast20190719 header.b=cZ9nLlZL; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbhEGEGL (ORCPT + 99 others); Fri, 7 May 2021 00:06:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41771 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbhEGEGJ (ORCPT ); Fri, 7 May 2021 00:06:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620360309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SM2Z2RJmf/HvwWoGqGzjgfGTsjHITFB7ckefQrdnYRA=; b=cZ9nLlZL2MgMeHDNdEEi6ejCZLkWkm4FeiAlt60H3XA/83SKkSR7aClOLUVqUe6f9Q58MN EPyNlKbRRjKYIhJyDU6Yoxq8CFdNDRE+SGwl4p4U1Jjuy6z5emQcv3l4SwHvjufP0YfOpi vehkMD7RqvqayGFQEmHWhNCREaUJgZ0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-1NtUBs4DO8iuBndeOELhRg-1; Fri, 07 May 2021 00:05:05 -0400 X-MC-Unique: 1NtUBs4DO8iuBndeOELhRg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90D781006C80; Fri, 7 May 2021 04:05:04 +0000 (UTC) Received: from localhost (ovpn-13-30.pek2.redhat.com [10.72.13.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71EE91A866; Fri, 7 May 2021 04:05:00 +0000 (UTC) Date: Fri, 7 May 2021 12:04:57 +0800 From: Baoquan He To: Stephen Boyd 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 Subject: Re: [PATCH v5 13/13] kdump: Use vmlinux_build_id to simplify Message-ID: <20210507040457.GB23668@MiWiFi-R3L-srv> References: <20210420215003.3510247-1-swboyd@chromium.org> <20210420215003.3510247-14-swboyd@chromium.org> <20210428101355.GB8374@localhost.localdomain> <20210507035418.GA23668@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210507035418.GA23668@MiWiFi-R3L-srv> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/21 at 11:54am, Baoquan He wrote: > On 04/29/21 at 01:14am, Stephen Boyd wrote: > > 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. > > Thanks for telling, I can see 'phN' is used in many places, but haven't > figured out how it's parsed, e.g in format_decode() it's not related. > Anyway, I may need dig further or search to get it. > > > > > 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. > > Oh, I meant that we may not need to enforce that because the size of > vmlinux_build_id can be guaranteed, always 20, we do not need to specify > the '20'? Afaik, we usually specify the format size when the string size > is variable, and we want to add '0' to make the width of printing is ~'space' I meant > fixed. Anyway, this dones't matter much. > > Acked-by: Baoquan He > > Thanks > Baoquan > > > > > > > > > Other than these, this patch looks good to me, thanks for the effort. > > > > > > > Thanks. > > > > _______________________________________________ > > kexec mailing list > > kexec@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/kexec > > > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec >