Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp156085pxy; Thu, 6 May 2021 23:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3k4dmKS9fmH/1O75j2W19NEI2wKxjQl8oGGbdk4lWK/vNkOURhkD1y7qisrwFnZeRfR/p X-Received: by 2002:a17:906:3c51:: with SMTP id i17mr2517586ejg.314.1620369277875; Thu, 06 May 2021 23:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620369277; cv=none; d=google.com; s=arc-20160816; b=vpUJ87VOJhnJtAf6BtEvkmnP9HGME2kGwqvf91Td4G3E/ATolrOBOTAlxYXPLFaBPC lezsGSSf/shmAnHcHDaWSS2rYhfWlDwvEjI0jg2TsZzScm08V2vVOX/VH85lX85Yy4jt pnXJaFxmwJNpoTSHmTzjOdftU4CgRES1XkJFEIY/wBlwTWKzSkcIIknl8mF98frNZFAY DouoJNs2WK1RxZGSPjOP4DZ7L1M6zONiMZ6ugS6UZFqtT24kV5+pE7NYfb6v1wB+czRU Igb+JMTpXFoH+o1WtS0Pz0fmkKckAJJOpowLNIuHhAK5uCFdRDhhiUz/HiRKdsCT9G6e l06A== 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=Lym5IFcdXaDbeNnwtDKPcjOJJiR6vNqk+E2fR7F7mjk=; b=JWXFEAKOV+xagaCRDPzgQxpMmIcS0sfvOGb8cCk0XpvolrSZcIyrf+sJzX56f9UZOv jKbugrBVI6miEcR/Jhe89f85Y9ouN1atL501vj2stVmltmtV022CxbwsCbJvyl4+E7h7 5vfa/m9+m0wVO0AgvOtMJfJs4bfAdIjUbaeR7s8uLb0p4PZsTRG5T+PcPgz5PEFZmIVJ SfNf7YJfwLBekIFxuCrkuToh+fRvF09MCCNh6kIWA9wPctVhi+Eju8MJ/mdimt7JBkj2 uzaBA/eoiYwBs/BLmTG3ahw2bsQ9MuGc9cRdQVAy+vXBcNaN6rTC1R6h/yM3kNS8jR4i YxrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cFqveQV1; 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 t21si4282239edd.145.2021.05.06.23.34.14; Thu, 06 May 2021 23:34:37 -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=cFqveQV1; 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 S233619AbhEGDza (ORCPT + 99 others); Thu, 6 May 2021 23:55:30 -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 >