Received: by 10.223.185.116 with SMTP id b49csp3560713wrg; Mon, 26 Feb 2018 02:02:32 -0800 (PST) X-Google-Smtp-Source: AH8x227dtPuGNWwgsjyC09lZjlzlJoBZ0vF66LiwnBUcIB+YMy+R3Fu58rORWz/SHQUzhYAZJMVy X-Received: by 2002:a17:902:9306:: with SMTP id bc6-v6mr9969263plb.29.1519639352280; Mon, 26 Feb 2018 02:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519639352; cv=none; d=google.com; s=arc-20160816; b=Z8RvqCBaieOU+f5ug3jTVPR/b42sLdLwvqvBbT0zwaQ80eTNeGn3f1s5s2sZZNdsBY YYoTf8OiaBwg0RNx6qnh0HRgCS9wqgyGa+4MF0sB5/951A9jIgS0dQzRfQGumjyGZRmy +yfaAYSJKZwuKGKr/0a0i7OZOSQjZeWh6RQ+FON1Ok5VW03iGeNp3Em8SDlqviRY6RTt Wz1+ZSYhk4pAdc8r1JqPu+xiEUtrxqQBCLSlLfR1PCHtpGi573k01h599wDdb7TotZWQ KRnsQrp8+l8xS4zxShcW1JwT23ka//OGOKEuELJLcNeImWoCk1XVKtTiWxv+Ab0xaQk6 8DsQ== 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=dOoWNzgFaqAzbni0Ut3tu+qNv5MrItMsUILKicIxbWU=; b=qptoU+e/UkuYgl2l7F7V0ZpQKBS2B3QGKVqxGZkZS+U0mGWFk3WiP9hNHrDiggTaR9 lhDPrllVnsqsE+besBj4xqB7F09crgUGDATcxRux3uyZW/UsgdPkBCTDABWcltOz2+A+ yLLkEqZj0o0fSdO6IvUoOjHVYZlh2q4TzLPrqX6MIs9acvu4m/HplHqN675xJgshIcwE yyAZweUkl4Z3CHJLRKi1Q4+DZmb0QUga93gEq0FQ3AdExTF1XuidRXsQLbEyBE2Mkgbv N3r6tWsgDh/PahiQ3RhRR2IDFPiAyxjbmdGMRxT2jfQe8hijspsIpitNQ/iKe913pz7H yztA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ur3EKkJU; 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 n19-v6si6426924plp.808.2018.02.26.02.02.18; Mon, 26 Feb 2018 02:02:32 -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=Ur3EKkJU; 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 S1752457AbeBZKBl (ORCPT + 99 others); Mon, 26 Feb 2018 05:01:41 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:56089 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752024AbeBZKBh (ORCPT ); Mon, 26 Feb 2018 05:01:37 -0500 Received: by mail-it0-f67.google.com with SMTP id n7so10091292ita.5 for ; Mon, 26 Feb 2018 02:01:37 -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=dOoWNzgFaqAzbni0Ut3tu+qNv5MrItMsUILKicIxbWU=; b=Ur3EKkJU+9ABs9p9kg4yWxHKxXVqSMslNBHcm1ghj0ax0tj2lGtb3tN0Dnp7Mdzak1 eNDDFAgjcgSXShNyQneBMAeAiBV2HRoBD0QR45en9GLlqn77fZkBEwuTyzjPC1qkpsSj vZly1OBw4tcwsB72Cv86sCgGgElyfZEGy6dl0= 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=dOoWNzgFaqAzbni0Ut3tu+qNv5MrItMsUILKicIxbWU=; b=eSmBBX+BagpWn9NttwO8SQg4NkZHlvh1GbWrjrh9zUSJ+DKtTMTHD/VRWaJJ8pJyPB gk7NRN1LL1nvZuXnrCqHqVUsOHj9dFWiIfjpIGcrKWkzuCV9ayPWqUNqCirvpDDMBQnX GVqH7bLXa9j3vjbPe7RMB2pZCYhYzaXOrPFt5zraAyYfghHSZOax2nw5+6In6s18znWw ha/jylQ/21P9+6pUb+4VgTp8Xk+iajlPNK+EfVDYkYm6p+GXugX7hYXCsIgGG75cx28z 1fnvODfjkujcu/MRFfTfcBL2T3tfnDp0565beFroZHV5iVfrgPVDJjomeO/Bk0Z89o4I +/oQ== X-Gm-Message-State: APf1xPDzKUgNe6doKZpymPFRWuKdU+P50/CJiNCw4YTQp5GEphRaIDVQ bQZwuZUP5RocZppsST8opV5VBg== X-Received: by 10.36.164.74 with SMTP id v10mr11649177iti.25.1519639297127; Mon, 26 Feb 2018 02:01:37 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id w6sm5077639itc.5.2018.02.26.02.01.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 02:01:36 -0800 (PST) Date: Mon, 26 Feb 2018 19:01:39 +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: <20180226100138.GC6019@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180223092459.GC4433@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, 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. Thanks, -Takahiro AKASHI > Ditto for other similar functions. > > [snip] > > Thanks > Dave