Received: by 10.223.185.116 with SMTP id b49csp464848wrg; Fri, 23 Feb 2018 01:27:31 -0800 (PST) X-Google-Smtp-Source: AH8x224dV4uA40Tv7RNzhGDsmc8UJtjksnqpageE+Q65ggkj4gP151hH4qJMEvz+nPL7ak/46gtT X-Received: by 10.98.51.70 with SMTP id z67mr1155585pfz.2.1519378051149; Fri, 23 Feb 2018 01:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519378051; cv=none; d=google.com; s=arc-20160816; b=CIL1eoZw8cU2Tch2thGK6UX0gW7bae0xSCPoQcmHfkDdzx145ZVF4kpB1u8F6R3hCa wi9jU3UVnifdPhTb3rEUp09FbTFLaQk4AmW5TSRJUnqgLVTRHDrQ2KcCg1flpePvtrLD M8N4JhmigA9oYt9Gu/V5ZVCQoU88SfJvXZKWhej31FpMqcsTGa+GJO/i7g/9jRwo8rD0 HhQegyUfsagxFwp/xlGe+DWFm1ZTyqafSIMB9i/1pxfIS9Jxib28v1tKotI9wDCcqkhS jIOKwiYFxlsjiKDtkuzj5CvSQ09dlcOQ8VsIHRGzBOsLBCmXE4u77VyJSMHNcUv0UjOa RvOA== 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:message-id:subject:cc :to:from:date:arc-authentication-results; bh=3l4H1a7TuOEdU5uqQJYJVAx2AriDN1OoUgB1Axm1fnQ=; b=vuCt42wn6zIX9EuMVqhnLiYFZZAvPvRebMpYq1UtcZjX4bV7vLIdurxXLe7XRWiR7G 3svh8AIvcWhjw6ilPKcOaSR1zAelPhzVnofoZjuSBi+OfIcF1iRe2xK0DR1tNY95OLj2 s/AiaveIlp6hQwF7Cwv4N2cTucOYsBkzbHKjHLeXQpeh4S3K78Yd4BTox1F3cnob41qp yhkhFkAAJS4wTs+g6ssYO8Dvi2WpowpS92jk9bL3KRyPYkpc+xrL7OhriWgMAWCK0GI5 xLKs1If+s74G/cjjDRPckb1ib/ARbNDrf0H/6tvpWqCkWxTTIR8YV0CdS91cpwWwTOGE ZTPw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n27si1533550pfg.102.2018.02.23.01.27.17; Fri, 23 Feb 2018 01:27:31 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbeBWJZO (ORCPT + 99 others); Fri, 23 Feb 2018 04:25:14 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56966 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751470AbeBWJZM (ORCPT ); Fri, 23 Feb 2018 04:25:12 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38364EAEB2; Fri, 23 Feb 2018 09:25:11 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-55.pek2.redhat.com [10.72.12.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7D62B3006; Fri, 23 Feb 2018 09:25:04 +0000 (UTC) Date: Fri, 23 Feb 2018 17:24:59 +0800 From: Dave Young To: AKASHI Takahiro 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: <20180223092459.GC4433@dhcp-128-65.nay.redhat.com> References: <20180222111732.23051-1-takahiro.akashi@linaro.org> <20180222111732.23051-4-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180222111732.23051-4-takahiro.akashi@linaro.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 23 Feb 2018 09:25:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 23 Feb 2018 09:25:11 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Ditto for other similar functions. [snip] Thanks Dave