From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752790AbdKWMqw (ORCPT ); Thu, 23 Nov 2017 07:46:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:58022 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752683AbdKWMqu (ORCPT ); Thu, 23 Nov 2017 07:46:50 -0500 Date: Thu, 23 Nov 2017 13:46:48 +0100 From: Petr Mladek To: Thomas Gleixner Cc: LKML , Linus Torvalds , Prarit Bhargava , Mark Salyzyn , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches , Linus Torvalds Subject: Re: [RFC patch 5/7] crash: Add VMCOREINFO_FIELD_AND_OFFSET() Message-ID: <20171123124648.s4oigunxjfzvhtqh@pathway.suse.cz> References: <20171115181531.322572387@linutronix.de> <20171115182657.542096222@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171115182657.542096222@linutronix.de> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2017-11-15 19:15:36, Thomas Gleixner wrote: > Changing the time stamp storage in the printk ringbuffer entries would > break existing tools which rely on the availability of the 'ts_nsec' field > in vmcore info. > > Provide a new macro which allows to store the offset of a member of struct > printk_log with a different name. This allows to change the underlying > storage and without breaking tools. It seems that this cheating is not enough. I tried to use it in printk (6th patch in this patch set) and the "crash" tool complained: ===== cut ===== WARNING: log buf data structure(s) have changed log: invalid structure member offset: log_ts_nsec FILE: kernel.c LINE: 5055 FUNCTION: dump_log_entry() ===== cut ===== The crash tool get this value using the following code: MEMBER_OFFSET_INIT(log_ts_nsec, "printk_log", "ts_nsec"); + MEMBER_OFFSET() + datatype_info((X), (Y), NULL) , where the last function does something like: long datatype_info(char *name, char *member, struct datatype_member *dm) { struct gnu_request *req; req->command = GNU_GET_DATATYPE; req->name = name; req->member = member; gdb_interface(req); I am not completely sure what it does. I guess that gdb is able to get information about the real types either from vmlinux binary or vmcore. It is not able to find "ts_nsec" in the struct "printk_log" and fails. I am afraid that we would need to fix crash for the modified struct printk_log. Then this hack will not be needed. Best Regards, Petr