Received: by 10.223.185.116 with SMTP id b49csp8279838wrg; Thu, 1 Mar 2018 21:54:11 -0800 (PST) X-Google-Smtp-Source: AG47ELsXSpICPoZ1hIi63ICwfwwsZENbW3AsKzG+LzdEbYA4cNv+1VcWIgK/ED02Qj0oxc0aE3dg X-Received: by 10.98.74.140 with SMTP id c12mr4623691pfj.44.1519970051550; Thu, 01 Mar 2018 21:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519970051; cv=none; d=google.com; s=arc-20160816; b=USsNMCNtQYRUpQmpC8i4pe6Jc+hg1gqzIFyT6EDwyOPyNAJuINQldjw3E0ppYEo1N4 m0Rw8QnBscaoJgohJ5yULCs9N/U/dd+bid/3ubAg7RL4XO7lxPoASy+PF64n/2tz7S7X vxAt00BcFVlV2RQ/xsvIdI22/LuSUQhHMATXZ/nSc7iBk1s5i4A4L+wKXh+Z8uLzKXD6 7TD7x2CdO20wPo/osMthXJDJatAzrA2jVUxAUKNg8JB8xsCmNPlUDiFYKW8FdW6fDtq8 L3/bsRqcDqplut1scoL1tt+Fpkw/IY7yBuHKf7JNjCi3xmjBfkenAvzsx+g4kvZlLtth qowg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=6eNlBD0iH12uh8tEtBunQSWY5K08L1Ej9lzOAL+c5F4=; b=rWXth7obtisGmV7q7qM3rO0gRUwhB6ROS52Jihu/qTQFJPtT4MWwFlFUIXiVW4hxg3 vPKSF6DnyhLDZ/YSt+reJjN/m7BX10QTAJDfHFQTNVodRQSB6r52Rb5bRJ4NmHMW/Lcd CRWgSF5AVdQJexZuZPtAC8kZDYOgCEDibSRLMTwlr4potRQP65ec2ZkQDdH5G8eImhhV qnDvkcih/LpRdbVy1qQl+MxkoB5LyL8IdBrqF16T5PFL64Zr+i9OJjN62OEoOg4KguiA /HKzYD+ZFrFEaLctPFSmkRlL0ZZEM/GcQWxfE9uFK/W5ojPTbAWc8+Vr+8uri9RMltYn WTFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQ3mSntO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si3545029pgs.276.2018.03.01.21.53.56; Thu, 01 Mar 2018 21:54:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQ3mSntO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935846AbeCBFdR (ORCPT + 99 others); Fri, 2 Mar 2018 00:33:17 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:39974 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932845AbeCBFdO (ORCPT ); Fri, 2 Mar 2018 00:33:14 -0500 Received: by mail-pl0-f65.google.com with SMTP id i6-v6so5062435plt.7 for ; Thu, 01 Mar 2018 21:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6eNlBD0iH12uh8tEtBunQSWY5K08L1Ej9lzOAL+c5F4=; b=iQ3mSntOWrxGxCEBZrhr6kk24VlrjCWhX344F7nQHOsSmYkU7BSZczglw366JCuYEa XMmaaurau47YgsZ2q2fOIWD744siHcUCl0E2TdP7A2LyD8IaPXwfEA3xa8fmt9z6JQXi GPTFhKuMs9iD7dGEeiMYQlNLr+/DIDAAjbOFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=6eNlBD0iH12uh8tEtBunQSWY5K08L1Ej9lzOAL+c5F4=; b=DmSNq/ewo2v7AglNQvMtRxaYbjB8kAFGdBoiafYwJm+p5Y8CVXgzS/LmScPcwBeTRm KBPtxNiqJm/2VfSJxztIjgJnXyBc53NGqoZdBRAgenkbd4nYIpHrrzqWAeo8T2WDBoRB OYBjG+XsAlztntxGbE4tKRPB/CIEqu84iciTh7maGmp7QApEXKHUNyIeZZU0wMmFbXVI 7D9L+ZkKKkthFaPDq3/nAPmoBffAaDEU0Hs2C5k63WTiihfYMCdiMhfOVRA+Eic6FCCQ BUeUlqJtBFhH+5pRbsi+4UWLWAGkgHQ8R6462GTs7+g8aJ2WHXEHSsGknlx51BLz+BpJ DUhw== X-Gm-Message-State: APf1xPCYR6bgaaZqx1OwgH5ecE+1igX6/FE4YGWUvMPshOf1fL7qYoTR hMV4rc3zxVfS6BotSdt5NWeJWQ== X-Received: by 2002:a17:902:bd83:: with SMTP id q3-v6mr4345446pls.13.1519968794170; Thu, 01 Mar 2018 21:33:14 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id z28sm8576082pgc.69.2018.03.01.21.33.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 21:33:13 -0800 (PST) Date: Fri, 2 Mar 2018 14:33:26 +0900 From: AKASHI Takahiro To: Dave Young Cc: vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 4/7] x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers() Message-ID: <20180302053325.GO6019@linaro.org> Mail-Followup-To: AKASHI Takahiro , Dave Young , vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org References: <20180227044814.24808-1-takahiro.akashi@linaro.org> <20180227044814.24808-5-takahiro.akashi@linaro.org> <20180302051956.GB2952@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180302051956.GB2952@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 02, 2018 at 01:19:56PM +0800, Dave Young wrote: > On 02/27/18 at 01:48pm, AKASHI Takahiro wrote: > > The code guarded by CONFIG_X86_64 is necessary on some architectures > > which have a dedicated kernel mapping outside of linear memory mapping. > > (arm64 is among those.) > > > > In this patch, an additional argument, kernel_map, is added to enable/ > > disable the code removing #ifdef. > > > > Signed-off-by: AKASHI Takahiro > > Cc: Dave Young > > Cc: Vivek Goyal > > Cc: Baoquan He > > --- > > arch/x86/kernel/crash.c | 25 +++++++++++++------------ > > 1 file changed, 13 insertions(+), 12 deletions(-) > > > > diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c > > index 2123fa0efc17..913fd8021f8a 100644 > > --- a/arch/x86/kernel/crash.c > > +++ b/arch/x86/kernel/crash.c > > @@ -347,7 +347,7 @@ static int prepare_elf64_ram_headers_callback(struct resource *res, void *arg) > > return 0; > > } > > > > -static int prepare_elf64_headers(struct crash_elf_data *ced, > > +static int prepare_elf64_headers(struct crash_elf_data *ced, int kernel_map, > > void **addr, unsigned long *sz) > > { > > Elf64_Ehdr *ehdr; > > @@ -414,17 +414,17 @@ static int prepare_elf64_headers(struct crash_elf_data *ced, > > phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; > > (ehdr->e_phnum)++; > > > > -#ifdef CONFIG_X86_64 > > /* Prepare PT_LOAD type program header for kernel text region */ > > - phdr = (Elf64_Phdr *)bufp; > > - bufp += sizeof(Elf64_Phdr); > > - phdr->p_type = PT_LOAD; > > - phdr->p_flags = PF_R|PF_W|PF_X; > > - phdr->p_vaddr = (Elf64_Addr)_text; > > - phdr->p_filesz = phdr->p_memsz = _end - _text; > > - phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); > > - (ehdr->e_phnum)++; > > -#endif > > + if (kernel_map) { > > + phdr = (Elf64_Phdr *)bufp; > > + bufp += sizeof(Elf64_Phdr); > > + phdr->p_type = PT_LOAD; > > + phdr->p_flags = PF_R|PF_W|PF_X; > > + phdr->p_vaddr = (Elf64_Addr)_text; > > + phdr->p_filesz = phdr->p_memsz = _end - _text; > > + phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); > > + (ehdr->e_phnum)++; > > + } > > > > /* Go through all the ranges in cmem->ranges[] and prepare phdr */ > > for (i = 0; i < cmem->nr_ranges; i++) { > > @@ -477,7 +477,8 @@ static int prepare_elf_headers(struct kimage *image, void **addr, > > goto out; > > > > /* By default prepare 64bit headers */ > > - ret = prepare_elf64_headers(ced, addr, sz); > > + ret = prepare_elf64_headers(ced, > > + (int)IS_ENABLED(CONFIG_X86_64), addr, sz); > > A bool would be enough for kernel_map Yeah, for now. What I thought of is that we might want to extend its functionality in the future as I did here for kernel_map without changing its interface. But I'd defer to you. -Takahiro AKASHI > > if (ret) > > goto out; > > > > Thanks > Dave > > -- > > 2.16.2 > >