Received: from eggs.gnu.org ([2001:4830:134:3::10]:45376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTBDT-0006dQ-MY for qemu-devel@nongnu.org; Thu, 06 Jul 2017 14:09:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTBDP-0005YW-LQ for qemu-devel@nongnu.org; Thu, 06 Jul 2017 14:09:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42764) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTBDP-0005Xd-Cy for qemu-devel@nongnu.org; Thu, 06 Jul 2017 14:09:23 -0400 Date: Thu, 6 Jul 2017 14:09:18 -0400 (EDT) From: Dave Anderson Message-ID: <850987754.33489091.1499364558887.JavaMail.zimbra@redhat.com> In-Reply-To: References: <20170706101611.27031-1-marcandre.lureau@redhat.com> <20170706101611.27031-6-marcandre.lureau@redhat.com> <72817738-deb5-f64e-7247-89dbdf10ddbd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 5/7] kdump: add vmcoreinfo ELF note List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: Laszlo Ersek , QEMU , Igor Mammedov , Eduardo Habkost ----- Original Message ----- > Hi >=20 > On Thu, Jul 6, 2017 at 7:13 PM, Laszlo Ersek wrote: > > On 07/06/17 12:16, Marc-Andr=C3=A9 Lureau wrote: > >> kdump header provides offset and size of the vmcoreinfo ELF note, > >> append it if available. > >> > >> Signed-off-by: Marc-Andr=C3=A9 Lureau > >> --- > >> dump.c | 20 ++++++++++++++++++++ > >> 1 file changed, 20 insertions(+) > >> > >> diff --git a/dump.c b/dump.c > >> index f699198204..dd416ad271 100644 > >> --- a/dump.c > >> +++ b/dump.c > >> @@ -839,6 +839,16 @@ static void create_header32(DumpState *s, Error > >> **errp) > >> kh->dump_level =3D cpu_to_dump32(s, DUMP_LEVEL); > >> > >> offset_note =3D DISKDUMP_HEADER_BLOCKS * block_size + size; > >> + if (s->vmcoreinfo) { > >> + uint64_t hsize, name_size, size_vmcoreinfo_desc, > >> offset_vmcoreinfo; > >> + > >> + get_note_sizes(s, s->vmcoreinfo, &hsize, &name_size, > >> &size_vmcoreinfo_desc); > >> + offset_vmcoreinfo =3D offset_note + s->note_size - > >> s->vmcoreinfo_size + > >> + (DIV_ROUND_UP(hsize, 4) + DIV_ROUND_UP(name_size, 4)) * 4= ; > >> + kh->offset_vmcoreinfo =3D cpu_to_dump64(s, offset_vmcoreinfo)= ; > >> + kh->size_vmcoreinfo =3D cpu_to_dump32(s, size_vmcoreinfo_desc= ); > >> + } > >> + > >> kh->offset_note =3D cpu_to_dump64(s, offset_note); > >> kh->note_size =3D cpu_to_dump32(s, s->note_size); > >> > >> @@ -939,6 +949,16 @@ static void create_header64(DumpState *s, Error > >> **errp) > >> kh->dump_level =3D cpu_to_dump32(s, DUMP_LEVEL); > >> > >> offset_note =3D DISKDUMP_HEADER_BLOCKS * block_size + size; > >> + if (s->vmcoreinfo) { > >> + uint64_t hsize, name_size, size_vmcoreinfo_desc, > >> offset_vmcoreinfo; > >> + > >> + get_note_sizes(s, s->vmcoreinfo, &hsize, &name_size, > >> &size_vmcoreinfo_desc); > >> + offset_vmcoreinfo =3D offset_note + s->note_size - > >> s->vmcoreinfo_size + > >> + (DIV_ROUND_UP(hsize, 4) + DIV_ROUND_UP(name_size, 4)) * 4= ; > >> + kh->offset_vmcoreinfo =3D cpu_to_dump64(s, offset_vmcoreinfo)= ; > >> + kh->size_vmcoreinfo =3D cpu_to_dump64(s, size_vmcoreinfo_desc= ); > >> + } > >> + > >> kh->offset_note =3D cpu_to_dump64(s, offset_note); > >> kh->note_size =3D cpu_to_dump64(s, s->note_size); > >> > >> > > > > I continue to think that this patch is unnecessary, but if you insist, > > it does look OK to me. > > > > Reviewed-by: Laszlo Ersek >=20 > Without it, crash doesn't read the vmcoreinfo PT_NOTE. And for some > reason, the phys_base in the header wasn't enough (to be doubled > checked). > > Any comment Dave about crash handling of vmcoreinfo in kdump files? It just reads the kdump_sub_header's offset_vmcoreinfo and size_vmcoreinfo fields to gather the vmcoreinfo data into a local buffer of memory, and scans the strings for whatever it's looking for.=20 With respect to phys_base, the only thing that might be of consequence is this fairly recent change that's currently only in the github repo, queued for crash-7.2.0: commit a4a538caca140a8e948bbdae2be311168db7a1eb Author: Dave Anderson Date: Tue May 2 16:51:53 2017 -0400 Fix for Linux 4.10 and later kdump dumpfiles, or kernels that have backported commit 401721ecd1dcb0a428aa5d6832ee05ffbdbffbbe, titled "kexec: export the value of phys_base instead of symbol address". Without the patch, if the x86_64 "phys_base" value in the VMCOREINFO note is a negative decimal number, the crash session fails during session intialization with a "page excluded" or "seek error" when reading "page_offset_base". (anderson@redhat.com) Also, crash-7.1.9 was the first version that started looking in the=20 vmcoreinfo data for phys_base instead of in the kdump_sub_header. Dave >=20 >=20 >=20 > -- > Marc-Andr=C3=A9 Lureau >=20