From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9E47C43462 for ; Fri, 7 May 2021 03:54:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4B96613D9 for ; Fri, 7 May 2021 03:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233632AbhEGDzg (ORCPT ); Thu, 6 May 2021 23:55:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54434 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231401AbhEGDz3 (ORCPT ); Thu, 6 May 2021 23:55:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620359669; 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=Lym5IFcdXaDbeNnwtDKPcjOJJiR6vNqk+E2fR7F7mjk=; b=cFqveQV1ng3OlFXRK7tWEottiv9aNO1jwpXWQ3lZdHhfD6te9aN8UkKP1sk9vGAeFosKR2 TCbDg95iQY2O5Qv1Aoqiuxp0emEHlDzn9pzI8wV0P/v1QiUNBMuVyVom177yhc9+VvuHG8 XBa4fTnnZevSAfBhfho3YVXyVu87aaE= 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-165-Y4bpuEWqNZi42SO4pjFObA-1; Thu, 06 May 2021 23:54:26 -0400 X-MC-Unique: Y4bpuEWqNZi42SO4pjFObA-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 92B53107ACCD; Fri, 7 May 2021 03:54:24 +0000 (UTC) Received: from localhost (ovpn-13-30.pek2.redhat.com [10.72.13.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B48D81A870; Fri, 7 May 2021 03:54:20 +0000 (UTC) Date: Fri, 7 May 2021 11:54:18 +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: <20210507035418.GA23668@MiWiFi-R3L-srv> References: <20210420215003.3510247-1-swboyd@chromium.org> <20210420215003.3510247-14-swboyd@chromium.org> <20210428101355.GB8374@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lerZQ-006YKy-FF for kexec@lists.infradead.org; Fri, 07 May 2021 03:54:34 +0000 Date: Fri, 7 May 2021 11:54:18 +0800 From: Baoquan He Subject: Re: [PATCH v5 13/13] kdump: Use vmlinux_build_id to simplify Message-ID: <20210507035418.GA23668@MiWiFi-R3L-srv> References: <20210420215003.3510247-1-swboyd@chromium.org> <20210420215003.3510247-14-swboyd@chromium.org> <20210428101355.GB8374@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org 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 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 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