Received: by 10.223.185.116 with SMTP id b49csp6937829wrg; Wed, 28 Feb 2018 19:19:04 -0800 (PST) X-Google-Smtp-Source: AG47ELsHAnz/XPaqkjdDq3jAcnBVDnh6A/WTaSGMXtvmxfxLn/o5xVZGuytjCNP5LXDiyuneII57 X-Received: by 10.98.67.216 with SMTP id l85mr405755pfi.214.1519874343976; Wed, 28 Feb 2018 19:19:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519874343; cv=none; d=google.com; s=arc-20160816; b=0SU98QWTeLilR0Eehbz/FdIq8271IneEEarGKC/3TqvLjGS6V2QYbalSoXYNwuIiJG +6EY3hfZMgds3gvhZln/mEibh08rvML7EcyA9im4ss3TovcAHPuBc2W4zNCSqJ8TnKOA jdNyViO+wslAGqz5WO1tLsgx8to2oN+gfr4ZDWDgBv44DyGY2PSgU5MDmZm9waqYypsW 1rlGLarS1ZFXrWwBsCSnU9J72ORi9wssRQTPwNy4cPMBe1NdRmyiORbL6kJKonI+k0M8 j0OUkY87FkwuP5jNB9fwMHG4Ytw3fn0V7RxRKHOgOuST98Bkwom97FapdoBR7RMaCCQW 2RnQ== 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=vifSz20L3j6PoxMDLVXNt3Teyr6MUAVfzEolpzCnj2Y=; b=r5VX5fYk4emYKBHEwi8DcHqvoajqEOnoyAcPfRaFwvwJpoBkjMRYg15Vab7iqmZVB4 vzu0zojAzVumCuwy2ETAIOJVi9BmdYk0g6a7km0wnMPPGW23YO9gJb1kzVQtt9tOjRSr SoakHJKfCL499IoHB8oCobsi6IISHa0W+cgnhGESad+YOCz8uSL86POSyCXlgcU5YwhO XG6sLupPxyBRJB8w32cyUeqdUyJoEzwgN+ewoZqiZ5o0cHgodO80gLfDaIUbVe+u8A1N or8DQ7w4NgfKTAtgbpsvhB7ZCPY081p4xz5Kjcbngh3YR0Cvk1Hf3B1+V10itQxE8Sqa q4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3HD5fMY; 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 u2-v6si2367476plr.50.2018.02.28.19.18.49; Wed, 28 Feb 2018 19:19:03 -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=L3HD5fMY; 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 S965651AbeCADSI (ORCPT + 99 others); Wed, 28 Feb 2018 22:18:08 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:39582 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbeCADSF (ORCPT ); Wed, 28 Feb 2018 22:18:05 -0500 Received: by mail-pf0-f195.google.com with SMTP id u5so1899410pfh.6 for ; Wed, 28 Feb 2018 19:18:05 -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=vifSz20L3j6PoxMDLVXNt3Teyr6MUAVfzEolpzCnj2Y=; b=L3HD5fMY0/9I9qWjhMfGMuH940T/+XLk1sKs/pEwW1GmcE9wWIcqtGXmDwDoiGyltx OL16dF7k3DiGRmQxyBliT90CB5a5gSIULVGscxNFtRyxUMe9UkH1hc0eCaNoE6nQFytO ml6ErYlqQTDxRvJXCProGQ9eO4kfMpldfRVro= 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=vifSz20L3j6PoxMDLVXNt3Teyr6MUAVfzEolpzCnj2Y=; b=KOISgbNNTvZiSHmWXmyP8egFiNs20YUhlvWsXi9jWsdbv6wLSeM8g2fIYfAfBGomrQ 7FwOsITL2XeE//UpXQ1oAk7Zcez+r7zpr/Kwj52x7nuGYRKSuSFr3bMfUCYPu7I9ftiT zMGB3WBwpcu/BhXaS56FfeRahALvboF/fZJmm5zAfz/6i+l/MEOLZrsugt7MoWh2O689 ZPvwMBhxC7OFWrE3xEdm5aGfNiK46rff7cohp7Gh0LCduJw6AA0G6yKgEVlFA4fRORad /mBVEPOcmwsWz9DRrdtrQ74uVwJBWT23LENIWftWqT4tNG1msuTVgB4BVQ7hNCk+e8md Kxzw== X-Gm-Message-State: APf1xPB6FX8dYBpvAXHyee8xFBVdKnMAPp3qsHthxsC0yJEwgPdfWR5p I6y99pkyiFy+OKssPGwAF+i7VA== X-Received: by 10.99.164.81 with SMTP id c17mr344385pgp.114.1519874284859; Wed, 28 Feb 2018 19:18:04 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 75sm6383749pfl.169.2018.02.28.19.18.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 19:18:04 -0800 (PST) Date: Thu, 1 Mar 2018 12:18:13 +0900 From: AKASHI Takahiro To: Dave Young Cc: catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, julien.thierry@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 03/13] kexec_file,x86,powerpc: factor out kexec_file_ops functions Message-ID: <20180301031811.GM6019@linaro.org> Mail-Followup-To: AKASHI Takahiro , Dave Young , catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, julien.thierry@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20180222111732.23051-1-takahiro.akashi@linaro.org> <20180222111732.23051-4-takahiro.akashi@linaro.org> <20180223092459.GC4433@dhcp-128-65.nay.redhat.com> <20180226100138.GC6019@linaro.org> <20180228123800.GC2228@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180228123800.GC2228@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 Wed, Feb 28, 2018 at 08:38:00PM +0800, Dave Young wrote: > On 02/26/18 at 07:01pm, AKASHI Takahiro wrote: > > On Fri, Feb 23, 2018 at 05:24:59PM +0800, Dave Young wrote: > > > Hi AKASHI, > > > > > > On 02/22/18 at 08:17pm, AKASHI Takahiro wrote: > > > > As arch_kexec_kernel_*_{probe,load}(), arch_kimage_file_post_load_cleanup() > > > > and arch_kexec_kernel_verify_sg can be parameterized with a kexec_file_ops > > > > array and now duplicated among some architectures, let's factor them out. > > > > > > > > Signed-off-by: AKASHI Takahiro > > > > Cc: Dave Young > > > > Cc: Vivek Goyal > > > > Cc: Baoquan He > > > > Cc: Michael Ellerman > > > > Cc: Thiago Jung Bauermann > > > > --- > > > > 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/include/asm/kexec-bzimage64.h | 2 +- > > > > arch/x86/kernel/kexec-bzimage64.c | 2 +- > > > > arch/x86/kernel/machine_kexec_64.c | 45 +---------------------- > > > > include/linux/kexec.h | 15 ++++---- > > > > kernel/kexec_file.c | 57 +++++++++++++++++++++++++++-- > > > > 8 files changed, 70 insertions(+), 94 deletions(-) > > > > > > > > > > [snip] > > > > > > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > > > > index 990adae52151..a6d14a768b3e 100644 > > > > --- a/kernel/kexec_file.c > > > > +++ b/kernel/kexec_file.c > > > > @@ -26,34 +26,83 @@ > > > > #include > > > > #include "kexec_internal.h" > > > > > > > > +const __weak struct kexec_file_ops * const kexec_file_loaders[] = {NULL}; > > > > + > > > > #ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY > > > > static int kexec_calculate_store_digests(struct kimage *image); > > > > #else > > > > static int kexec_calculate_store_digests(struct kimage *image) { return 0; }; > > > > #endif > > > > > > > > +int _kexec_kernel_image_probe(struct kimage *image, void *buf, > > > > + unsigned long buf_len) > > > > +{ > > > > + const struct kexec_file_ops * const *fops; > > > > + int ret = -ENOEXEC; > > > > + > > > > + for (fops = &kexec_file_loaders[0]; *fops && (*fops)->probe; ++fops) { > > > > + ret = (*fops)->probe(buf, buf_len); > > > > + if (!ret) { > > > > + image->fops = *fops; > > > > + return ret; > > > > + } > > > > + } > > > > + > > > > + return ret; > > > > +} > > > > + > > > > /* Architectures can provide this probe function */ > > > > int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, > > > > unsigned long buf_len) > > > > { > > > > - return -ENOEXEC; > > > > + return _kexec_kernel_image_probe(image, buf, buf_len); > > > > > > > > > I vaguely remember previously I suggest split the _kexec_kernel_image_probe > > > because arch code can call them, and common code also use it like above. > > > But in your new series I do not find where else calls this function > > > except the common code arch_kexec_kernel_image_probe. If nobody use > > > them then it is not worth to split them out, it is better to just embed > > > them in the __weak functions. > > > > Powerpc's arch_kexec_kernel_image_probe() uses > > _kexec_kekrnel_image_probe() as it needs an extra check to rule out > > crash dump for now. > > Oops, I missed that, but what about other similar functions? Such as: > _kexec_kernel_image_load > _kimage_file_post_load_cleanup > _kexec_kernel_verify_sig Current no users. Given those functions are so simple, we could go either way. -Takahiro AKASHI > > > > Thanks, > > -Takahiro AKASHI > > > > > > > Ditto for other similar functions. > > > > > > [snip] > > > > > > Thanks > > > Dave > > Thanks > Dave