From patchwork Mon Jul 6 17:06:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Aravamudan X-Patchwork-Id: 6726831 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7ED499F38C for ; Mon, 6 Jul 2015 17:06:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C0392066B for ; Mon, 6 Jul 2015 17:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D409205EC for ; Mon, 6 Jul 2015 17:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752568AbbGFRGb (ORCPT ); Mon, 6 Jul 2015 13:06:31 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:43145 "EHLO e19.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbbGFRGa (ORCPT ); Mon, 6 Jul 2015 13:06:30 -0400 Received: from /spool/local by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Jul 2015 13:06:29 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 6 Jul 2015 13:06:26 -0400 X-Helo: d01dlp01.pok.ibm.com X-MailFrom: nacc@linux.vnet.ibm.com X-RcptTo: linux-crypto@vger.kernel.org Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id EEFAA38C805E for ; Mon, 6 Jul 2015 13:06:25 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t66H6PgZ23593064 for ; Mon, 6 Jul 2015 17:06:25 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t66H6NMp016770 for ; Mon, 6 Jul 2015 13:06:25 -0400 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t66H6M93016658; Mon, 6 Jul 2015 13:06:22 -0400 Received: by kernel.stglabs.ibm.com (Postfix, from userid 1031) id 975B024024F; Mon, 6 Jul 2015 10:06:21 -0700 (PDT) Date: Mon, 6 Jul 2015 10:06:21 -0700 From: Nishanth Aravamudan To: Michael Ellerman Cc: Dan Streetman , linux-crypto@vger.kernel.org, gustavold@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, Herbert Xu , "David S. Miller" Subject: [PATCH v2] crypto/nx-842-{powerpc,pseries}: reduce chattiness of platform drivers Message-ID: <20150706170621.GA3578@linux.vnet.ibm.com> References: <20150702223800.GA1712@linux.vnet.ibm.com> <20150702224049.GE1712@linux.vnet.ibm.com> <1435887032.3665.1.camel@ellerman.id.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1435887032.3665.1.camel@ellerman.id.au> X-Operating-System: Linux 3.13.0-40-generic (x86_64) User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15070617-0057-0000-0000-000000A6A936 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 03.07.2015 [11:30:32 +1000], Michael Ellerman wrote: > On Thu, 2015-07-02 at 15:40 -0700, Nishanth Aravamudan wrote: > > While we never would successfully load on the wrong machine type, there > > is extra output by default regardless of machine type. > > > > For instance, on a PowerVM LPAR, we see the following: > > > > nx_compress_powernv: loading > > nx_compress_powernv: no coprocessors found > > > > even though those coprocessors could never be found. Similar pseries > > messages are printed on powernv. > > I know I've been converting init calls to machine_initcalls() to avoid > these sort of issues in platform code. But for a driver it should be > trivial for it to only probe when the hardware is found. > > By which I mean I think we shouldn't need these. Ok. > > diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c > > index 33b3b0abf4ae..6b5e5143c95b 100644 > > --- a/drivers/crypto/nx/nx-842-powernv.c > > +++ b/drivers/crypto/nx/nx-842-powernv.c > > @@ -594,6 +594,9 @@ static __init int nx842_powernv_init(void) > > BUILD_BUG_ON(DDE_BUFFER_ALIGN % DDE_BUFFER_SIZE_MULT); > > BUILD_BUG_ON(DDE_BUFFER_SIZE_MULT % DDE_BUFFER_LAST_MULT); > > > > + if (!machine_is(powernv)) > > + return -ENODEV; > > + > > pr_info("loading\n"); > > This is just too chatty, drop it. > > > for_each_compatible_node(dn, NULL, "ibm,power-nx") > > It shouldn't be printing anything unless it finds some devices in this loop. > > And you should drop the print in here: > > if (!nx842_ct) { > pr_err("no coprocessors found\n"); > return -ENODEV; > } > > And that should mean no output unless hardware is found I think? Yep, will adjust. > > @@ -625,6 +628,9 @@ static void __exit nx842_powernv_exit(void) > > { > > struct nx842_coproc *coproc, *n; > > > > + if (!machine_is(powernv)) > > + return; > > You shouldn't need to touch the exit paths if the drivers were never > loaded? Duh, yep. > > diff --git a/drivers/crypto/nx/nx-842-pseries.c b/drivers/crypto/nx/nx-842-pseries.c > > index b84b0ceeb46e..75a7bfdc160e 100644 > > --- a/drivers/crypto/nx/nx-842-pseries.c > > +++ b/drivers/crypto/nx/nx-842-pseries.c > > @@ -1091,6 +1091,9 @@ static int __init nx842_pseries_init(void) > > struct nx842_devdata *new_devdata; > > int ret; > > > > + if (!machine_is(pseries)) > > + return -ENODEV; > > + > > pr_info("Registering IBM Power 842 compression driver\n"); > > Again this is too chatty, just remove it. Will do. > > if (!of_find_compatible_node(NULL, NULL, "ibm,compression")) > return -ENODEV; > > That should do the trick shouldn't it? Yep, I think so. Thanks Michael! While we never would successfully load on the wrong machine type, there is extra output by default regardless of machine type. For instance, on a PowerVM LPAR, we see the following: nx_compress_powernv: loading nx_compress_powernv: no coprocessors found even though those coprocessors could never be found. Signed-off-by: Nishanth Aravamudan Cc: Dan Streetman Cc: Herbert Xu Cc: "David S. Miller" Cc: linux-crypto@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Acked-by: Michael Ellerman --- v2: Rather than not loading, just reduce the verbosity drivers/crypto/nx/nx-842-powernv.c | 10 +--------- drivers/crypto/nx/nx-842-pseries.c | 3 --- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c index 33b3b0abf4ae..7e474562058d 100644 --- a/drivers/crypto/nx/nx-842-powernv.c +++ b/drivers/crypto/nx/nx-842-powernv.c @@ -594,15 +594,11 @@ static __init int nx842_powernv_init(void) BUILD_BUG_ON(DDE_BUFFER_ALIGN % DDE_BUFFER_SIZE_MULT); BUILD_BUG_ON(DDE_BUFFER_SIZE_MULT % DDE_BUFFER_LAST_MULT); - pr_info("loading\n"); - for_each_compatible_node(dn, NULL, "ibm,power-nx") nx842_powernv_probe(dn); - if (!nx842_ct) { - pr_err("no coprocessors found\n"); + if (!nx842_ct) return -ENODEV; - } if (!nx842_platform_driver_set(&nx842_powernv_driver)) { struct nx842_coproc *coproc, *n; @@ -615,8 +611,6 @@ static __init int nx842_powernv_init(void) return -EEXIST; } - pr_info("loaded\n"); - return 0; } module_init(nx842_powernv_init); @@ -631,7 +625,5 @@ static void __exit nx842_powernv_exit(void) list_del(&coproc->list); kfree(coproc); } - - pr_info("unloaded\n"); } module_exit(nx842_powernv_exit); diff --git a/drivers/crypto/nx/nx-842-pseries.c b/drivers/crypto/nx/nx-842-pseries.c index b84b0ceeb46e..d44524da6589 100644 --- a/drivers/crypto/nx/nx-842-pseries.c +++ b/drivers/crypto/nx/nx-842-pseries.c @@ -1091,8 +1091,6 @@ static int __init nx842_pseries_init(void) struct nx842_devdata *new_devdata; int ret; - pr_info("Registering IBM Power 842 compression driver\n"); - if (!of_find_compatible_node(NULL, NULL, "ibm,compression")) return -ENODEV; @@ -1129,7 +1127,6 @@ static void __exit nx842_pseries_exit(void) struct nx842_devdata *old_devdata; unsigned long flags; - pr_info("Exiting IBM Power 842 compression driver\n"); nx842_platform_driver_unset(&nx842_pseries_driver); spin_lock_irqsave(&devdata_mutex, flags); old_devdata = rcu_dereference_check(devdata,