Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbcLBT0g (ORCPT ); Fri, 2 Dec 2016 14:26:36 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:33992 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbcLBT0d (ORCPT ); Fri, 2 Dec 2016 14:26:33 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Hari Bathini Cc: Dave Young , linux-kernel@vger.kernel.org, fenghua.yu@intel.com, tony.luck@intel.com, linux-ia64@vger.kernel.org, kexec@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , vgoyal@redhat.com References: <148007477669.1053.4107773905913128028.stgit@hbathini.in.ibm.com> <148007484315.1053.12317233313990302812.stgit@hbathini.in.ibm.com> <20161201045653.GA13670@dhcp-128-65.nay.redhat.com> Date: Fri, 02 Dec 2016 13:22:39 -0600 In-Reply-To: (Hari Bathini's message of "Fri, 2 Dec 2016 16:56:48 +0530") Message-ID: <87mvge16gw.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cCtSb-0005Ac-62;;;mid=<87mvge16gw.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.225.221;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+rwZM+bQBxacQ0hxnsqzMb4DFxGFI+1k0= X-SA-Exim-Connect-IP: 67.3.225.221 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 1.0 XM_H_SpoofStaff3 XMission Staff Spoof X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Hari Bathini X-Spam-Relay-Country: X-Spam-Timing: total 514 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.7 (0.7%), b_tie_ro: 2.6 (0.5%), parse: 1.13 (0.2%), extract_message_metadata: 3.9 (0.8%), get_uri_detail_list: 1.94 (0.4%), tests_pri_-1000: 3.5 (0.7%), tests_pri_-950: 1.13 (0.2%), tests_pri_-900: 0.98 (0.2%), tests_pri_-400: 25 (4.8%), check_bayes: 24 (4.6%), b_tokenize: 7 (1.4%), b_tok_get_all: 8 (1.6%), b_comp_prob: 2.0 (0.4%), b_tok_touch_all: 4.0 (0.8%), b_finish: 0.84 (0.2%), tests_pri_0: 460 (89.5%), check_dkim_signature: 0.47 (0.1%), check_dkim_adsp: 2.8 (0.5%), tests_pri_500: 6 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2287 Lines: 69 Hari Bathini writes: > Hi Dave, > > > Thanks for the review. > > > On Thursday 01 December 2016 10:26 AM, Dave Young wrote: >> Hi Hari >> >> Personally I like V1 more, but split the patch 2 is easier for ia64 >> people to reivew. I did basic x86 testing, it runs ok. >> >> On 11/25/16 at 05:24pm, Hari Bathini wrote: >>> Get rid of multiple definitions of append_elf_note() & final_note() >>> functions. Reuse these functions compiled under CONFIG_CRASH_CORE. >>> >>> Signed-off-by: Hari Bathini >>> --- >>> arch/ia64/kernel/crash.c | 22 ---------------------- >>> include/linux/crash_core.h | 4 ++++ >>> kernel/crash_core.c | 6 +++--- >>> kernel/kexec_core.c | 28 ---------------------------- >>> 4 files changed, 7 insertions(+), 53 deletions(-) >>> >>> diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c >>> index 2955f35..75859a0 100644 >>> --- a/arch/ia64/kernel/crash.c >>> +++ b/arch/ia64/kernel/crash.c >>> @@ -27,28 +27,6 @@ static int kdump_freeze_monarch; >>> static int kdump_on_init = 1; >>> static int kdump_on_fatal_mca = 1; >>> -static inline Elf64_Word >>> -*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data, >>> - size_t data_len) >>> -{ >>> - struct elf_note *note = (struct elf_note *)buf; >>> - note->n_namesz = strlen(name) + 1; >>> - note->n_descsz = data_len; >>> - note->n_type = type; >>> - buf += (sizeof(*note) + 3)/4; >>> - memcpy(buf, name, note->n_namesz); >>> - buf += (note->n_namesz + 3)/4; >>> - memcpy(buf, data, data_len); >>> - buf += (data_len + 3)/4; >>> - return buf; >>> -} >>> - >>> -static void >>> -final_note(void *buf) >>> -{ >>> - memset(buf, 0, sizeof(struct elf_note)); >>> -} >>> - >> The above IA64 version looks better than the functions in kexec_core.c >> about the Elf64_Word type usage and the simpler final_note function. > > Hmmm.. Is void* better over Elf64_Word* to be agnostic of Elf32 or > Elf64 type? Both Elf64_Word and Elf32_Word result in a u32. So I expect the right solution is to add a definition of Elf_Word to include/linux/elf.h and to make the buffer "Elf_Word *buf". That way we preserve the alignment knowledge, while making the code depend on 32bit or 64bit. Eric