From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82FE71EFF93 for ; Wed, 21 Jan 2026 20:27:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769027270; cv=none; b=N9X7hZLmOjo09aPh1m0IQRlRc1aTxdwJnOHArvVf4g6NU1AcLf4ZcKPHN/gPP5xS/3d/0YCienYdmNvu555yAWLnFgivsHpkTI9CUiKKuHAVwNSvAwdAOFzsdfinS3Z/U+yhQrTRbvXc/Jx+47kQv6T/vPdS+IIonMoNjvCTYQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769027270; c=relaxed/simple; bh=zy4Z/nzYYWhFM98siSDgUGUtRtb9mcUzc0xxcxhixkY=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=lj62SdHBMpzNllinpFw0cy+w2V8eKyZbTb/RFOhLGkNC0e2Hc9XHoGd6mGih3WaOEgsYs2iBrKLTtAJ0wSj2fKr0CS8JEjHo5SoBy2J3YrxsfsKrn9dHToBXx2VgnbKwujtaokyzq4UGyhPJJrlMiQdOxCm6Q9l4gsAaBZZTSs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=NaFeeK5b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="NaFeeK5b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71400C4CEF1; Wed, 21 Jan 2026 20:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1769027268; bh=zy4Z/nzYYWhFM98siSDgUGUtRtb9mcUzc0xxcxhixkY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NaFeeK5bOT3Ovy2TRqggSFGIOIvCOI5RQUOY7FHQMzzFEvFuFO3C9FMQ+Bz/N6mCh mJNPKvst4XCqxNvSK14sa39UGsz97yAUuOArH+t+fY0nZTibZTVPWRacIwjSIY0pO9 eEHmjq6HDTd8yik/t1SVMlq4JdPLuxzYupVgsn24= Date: Wed, 21 Jan 2026 12:27:47 -0800 From: Andrew Morton To: Breno Leitao Cc: bhe@redhat.com, vgoyal@redhat.com, dyoung@redhat.com, xueshuai@linux.alibaba.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, osandov@osandov.com, kernel-team@meta.com Subject: Re: [PATCH] vmcoreinfo: make hwerr_data visible for debugging Message-Id: <20260121122747.0e169a554e6d94abcb3e6307@linux-foundation.org> In-Reply-To: <20260121-fix_vmcoreinfo-v1-1-39e96fab670e@debian.org> References: <20260121-fix_vmcoreinfo-v1-1-39e96fab670e@debian.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 21 Jan 2026 03:05:44 -0800 Breno Leitao wrote: > If the kernel is compiled with LTO, hwerr_data symbol might be lost, and > vmcoreinfo doesn't have it dumped. This is currently seen in some > production kernels with LTO enabled. > > Remove the static qualifier from hwerr_data so that the information is > still preserved when the kernel is built with LTO. Making hwerr_data > a global symbol ensures its debug info survives the LTO link process and > appears in kallsyms. > > --- a/kernel/vmcore_info.c > +++ b/kernel/vmcore_info.c > @@ -36,7 +36,7 @@ struct hwerr_info { > time64_t timestamp; > }; > > -static struct hwerr_info hwerr_data[HWERR_RECOV_MAX]; > +struct hwerr_info hwerr_data[HWERR_RECOV_MAX]; > > Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, > void *data, size_t data_len) > A non-static symbol which has no external references will be made static again by those who like to send in little fixups. A comment will help prevent that. How's this? --- a/kernel/vmcore_info.c~vmcoreinfo-make-hwerr_data-visible-for-debugging-fix +++ a/kernel/vmcore_info.c @@ -36,6 +36,7 @@ struct hwerr_info { time64_t timestamp; }; +/* hwerr_data[] has global scope to make it available in vmcoreinfo under LTO */ struct hwerr_info hwerr_data[HWERR_RECOV_MAX]; Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, _