Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757132AbcLPGhl (ORCPT ); Fri, 16 Dec 2016 01:37:41 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54977 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755622AbcLPGhe (ORCPT ); Fri, 16 Dec 2016 01:37:34 -0500 Subject: Re: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions To: "Eric W. Biederman" 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> <87mvge16gw.fsf@xmission.com> Cc: fenghua.yu@intel.com, tony.luck@intel.com, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Young , vgoyal@redhat.com From: Hari Bathini Date: Fri, 16 Dec 2016 12:07:23 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <87mvge16gw.fsf@xmission.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16121606-0008-0000-0000-000000F24F10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16121606-0009-0000-0000-000008B75D45 Message-Id: <34293693-5424-9bdc-c693-dc385a5935e3@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-16_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612160108 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2684 Lines: 80 On Saturday 03 December 2016 12:52 AM, Eric W. Biederman wrote: > 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 > Thanks for the review, Eric. Will address this in the next version. As some recent changes in powerpc tree may cause merger conflicts, I will wait for those changes to get into linus's tree and rebase the next version on top of that.. Thanks Hari