From patchwork Fri Mar 9 09:33:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10270217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC15C6016D for ; Fri, 9 Mar 2018 09:33:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C422129DA3 for ; Fri, 9 Mar 2018 09:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8CF829DA5; Fri, 9 Mar 2018 09:33:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E63829DA3 for ; Fri, 9 Mar 2018 09:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CqSmm/XHTiWPZcEm4EpUaL1sKZMfrA1hX9bcOGHsPpk=; b=MRNnkVjSZHO2du y6ejFw5G3RKcR5Ybcsvz2u44Xukmy8kwPHT1BXsMrVFhcdbSx51eaJOSz+yXmH7GR8yRgiRoefOl1 e373BunAYFwGazWi4rKLOUsgbaCtNRRCJmXglrdnLt2bfdPerkG0m9JtNxt6ZgsD9E4jdgOzNQ7FW o+DEzrGtbz6xDfYPnGRmg+sAu8tXQwzzEg9Gj+Fm4l941h33z8D1q/Rr2TmSh1PIJWzqnmRaK+oS5 xGi2xklncALH7on6T1Ys7ihP+SeNNwgYYsYnz4qPZDM7PnjNxmnkSRwhkoEgtinn9H5AhBKCXsi3h +Q8aVvn3/v9cGd3cCSjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euEPK-0004Dl-Gl; Fri, 09 Mar 2018 09:33:46 +0000 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euEPC-0004BA-Lb for linux-arm-kernel@lists.infradead.org; Fri, 09 Mar 2018 09:33:40 +0000 Received: by mail-it0-x242.google.com with SMTP id v194-v6so2142505itb.0 for ; Fri, 09 Mar 2018 01:33:28 -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=vpf2uQiquzCxCLyfkIzGDlYB277t5U1+JMZX352FOhc=; b=MJpcp8ptz++S9qWfHebm8J5y3tdysuEIiIWeFDVOpVsoVUXt9yqIp3MFOc/ZUpy0Ca 0vLEIqQg4nwOEMswjDlrAFHRznaduUGWHuZMXYEOnaEeIraePBYFeOeVVha71bbEGAbz 3JPJGZsMiDjhknD5zvZ3gVIGuUlm/gFgQNX4o= 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=vpf2uQiquzCxCLyfkIzGDlYB277t5U1+JMZX352FOhc=; b=bNAtg0MaItjt4hKTEgW5Y0mbv5oAL+KlBVMIIEY32vbemr57x/kt30sjEr4ahhK65M G3FssO/oC9YA6+UhZKoDleFpLjdiPjs37LetSXspFrJawwlnR+w99coWFnsFFzgG/jpc d8xoJbprDMhTjxQ75dX7n6zwJsmt/N716mpfHt0HbRpqu3zz1HAnTMxwfLAjLReA8Pja iq4E2pdFDNESIqq8vokBOtNHbi8RrfjClDE8nmLEllz5ia/tk+oc6VzYaAPxRahRRg6l RTxhWJ6jx2ox16fE6updHMSxX1wKzUPZO5vCksmlnfMsEp3R1/N9sfirr6L3m9nQDd5+ 7QPA== X-Gm-Message-State: AElRT7GafDfp7cdaAlWJg1EbmHvt66GMVNL6cBi0HaAMDVwjb9ooHo5Q mTStvk3QLr6kQ4Qo4gXbC9OiOA== X-Google-Smtp-Source: AG47ELsV6UQKcMH3VeWnxlLYvY5TZlulM2NAyrZBszp+ChQRJheT4zL/MO/ewnyk8CgLAgm3rlYwLA== X-Received: by 10.36.225.72 with SMTP id n69mr2698354ith.82.1520588007388; Fri, 09 Mar 2018 01:33:27 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id t21sm559603ioa.64.2018.03.09.01.33.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 01:33:26 -0800 (PST) Date: Fri, 9 Mar 2018 18:33:47 +0900 From: AKASHI Takahiro To: Dave Young Subject: Re: [PATCH v2 0/7] kexec_file, x86, powerpc: refactoring for other architecutres Message-ID: <20180309093346.GF25863@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, akpm@linux-foundation.org References: <20180306102303.9063-1-takahiro.akashi@linaro.org> <20180308010502.GA2600@dhcp-128-65.nay.redhat.com> <20180309060254.GA9728@dhcp-128-65.nay.redhat.com> <20180309064412.GA5327@dhcp-128-65.nay.redhat.com> <20180309071813.GE25863@linaro.org> <20180309074613.GA6331@dhcp-128-65.nay.redhat.com> <20180309075547.GA6718@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180309075547.GA6718@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_013338_760294_9D4D35BA X-CRM114-Status: GOOD ( 37.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, prudo@linux.vnet.ibm.com, bhe@redhat.com, mpe@ellerman.id.au, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bauerman@linux.vnet.ibm.com, akpm@linux-foundation.org, vgoyal@redhat.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Dave, On Fri, Mar 09, 2018 at 03:55:47PM +0800, Dave Young wrote: > On 03/09/18 at 03:46pm, Dave Young wrote: > > Hi AKASHI, > > > > On 03/09/18 at 04:18pm, AKASHI Takahiro wrote: > > > Dave, > > > > > > On Fri, Mar 09, 2018 at 02:44:12PM +0800, Dave Young wrote: > > > > On 03/09/18 at 02:02pm, Dave Young wrote: > > > > > On 03/08/18 at 09:05am, Dave Young wrote: > > > > > > [Cc Andrew] > > > > > > > > > > > > On 03/06/18 at 07:22pm, AKASHI Takahiro wrote: > > > > > > > This is a preparatory patch set for adding kexec_file support on arm64. > > > > > > > > > > > > > > It was originally included in a arm64 patch set[1], but Philipp is also > > > > > > > working on their kexec_file support on s390[2] and some changes are now > > > > > > > conflicting. > > > > > > > > > > > > > > So these common parts were extracted and put into a separate patch set for > > > > > > > better integration. What's more, my original patch#4 was split into a few > > > > > > > small chunks for easier review after Dave's comment. > > > > > > > > > > > > > > As such, the resulting code is basically identical with my original, and > > > > > > > the only *visible* differences are: > > > > > > > * renamings of _kexec_kernel_image_probe() and > > > > > > > _kimage_file_post_load_cleanup() > > > > > > > * change one of types of arguments at prepare_elf64_headers() > > > > > > > Those, unfortunately, require a couple of trivial changes on the rest > > > > > > > (#1, #6 to #13) of my arm64 kexec_file patch set[1]. > > > > > > > > > > > > > > Patch#1 allows making a use of purgatory optional, particularly useful > > > > > > > for arm64. > > > > > > > Patch#2 commonalizes arch_kexec_kernel_{image_probe, image_load, > > > > > > > verify_sig}() and arch_kimage_file_post_load_cleanup() across architectures. > > > > > > > Patch#3-#7 is also intended to generalize parse_elf64_headers(), along with > > > > > > > exclude_mem_range(), to be made best re-use of. > > > > > > > > > > > > > > [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-February/561182.html > > > > > > > [2] http://lkml.iu.edu//hypermail/linux/kernel/1802.1/02596.html > > > > > > > > > > > > > > > > > > > > > Changes in v2 (Mar 6, 2018) > > > > > > > * use IS_ENABLED() instead of #ifdef's in kexec_calculate_store_digests() > > > > > > > * rename _kexec_kernel_*() and make them static for now except for > > > > > > > kexec_image_probe_default() which is actually used by arch(powerpc) code > > > > > > > (Note: kexec_image_post_load_cleanup_default() will also be exported by > > > > > > > arm64 patches.) > > > > > > > * change a type of kernel_map in prepare_elf64_headers() to "int" > > > > > > > * check for a total number of system ram regions in full_up_crash_elf_data() > > > > > > > and use vzalloc() instead of vmalloc() > > > > > > > > > > > > > > AKASHI Takahiro (7): > > > > > > > kexec_file: make an use of purgatory optional > > > > > > > kexec_file,x86,powerpc: factor out kexec_file_ops functions > > > > > > > x86: kexec_file: purge system-ram walking from prepare_elf64_headers() > > > > > > > x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers() > > > > > > > x86: kexec_file: lift CRASH_MAX_RANGES limit on crash_mem buffer > > > > > > > x86: kexec_file: clean up prepare_elf64_headers() > > > > > > > kexec_file, x86: move re-factored code to generic side > > > > > > > > > > > > > > arch/powerpc/Kconfig | 3 + > > > > > > > arch/powerpc/include/asm/kexec.h | 2 +- > > > > > > > arch/powerpc/kernel/kexec_elf_64.c | 2 +- > > > > > > > arch/powerpc/kernel/machine_kexec_file_64.c | 39 +--- > > > > > > > arch/x86/Kconfig | 3 + > > > > > > > arch/x86/include/asm/kexec-bzimage64.h | 2 +- > > > > > > > arch/x86/kernel/crash.c | 334 ++++++---------------------- > > > > > > > arch/x86/kernel/kexec-bzimage64.c | 2 +- > > > > > > > arch/x86/kernel/machine_kexec_64.c | 45 +--- > > > > > > > include/linux/kexec.h | 32 ++- > > > > > > > kernel/kexec_file.c | 240 +++++++++++++++++++- > > > > > > > 11 files changed, 338 insertions(+), 366 deletions(-) > > > > > > > > > > > > > > -- > > > > > > > 2.16.2 > > > > > > > > > > > > > > > > > > > AKASHI, thanks for another update, looks good to me: > > > > > > > > > > > > Acked-by: Dave Young > > > > > > > > > > Hold on the ack, during today's tests kexec kernel can not boot, it > > > > > hangs early. Will see if it is caused by this series and come back > > > > > later. > > > > > > > > AKASHI, it seems the first patch causes the hang, can you take a look? > > > > > > Sure, but can you first tell me specifics about what you have observed? > > > > It is a kexec load test like below: > > kexec -s -l /boot/vmlinuz-`uname -r` --reuse-cmdline > > sync > > sync > > kexec -e > > > > And it hangs after the message "Starting new kernel". Now I'm not sure > > how I tested the vmcore parsing before, maybe I forgot to add "-s" > > option in kexec-tools.. > > BTW kdump kernel also failed to boot. > I use linus tree, the git HEAD is > 86f84779d8e9 (origin/master, origin/HEAD, master) Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace > > It is a little odd for my testing, for kdump testing I did before, I do > not need add "-s" explictly since Fedora will take it automatically in > case Secure Boot and I always enabled Secure Boot. Oops, please apply the fix below to my first patch ("kexec_file: make an use of purgatory optional"). My screw-up is trivial here :) Please let me know if you think that I should repost my patch set. Thanks, -Takahiro AKASHI ===>8=== > > > > Thanks > > Dave > > > > > > > > Thanks, > > > -Takahiro AKASHI > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > Dave > > > > > > > > > > Thanks > > > > > Dave ===8<=== diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 6dbbb89cbbac..ab1dced677fd 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -532,7 +532,7 @@ static int kexec_calculate_store_digests(struct kimage *image) struct kexec_sha_region *sha_regions; struct purgatory_info *pi = &image->purgatory_info; - if (!IS_ENABLED(ARCH_HAS_KEXEC_PURGATORY)) + if (!IS_ENABLED(CONFIG_ARCH_HAS_KEXEC_PURGATORY)) return 0; zero_buf = __va(page_to_pfn(ZERO_PAGE(0)) << PAGE_SHIFT);