Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp330810ybb; Thu, 28 Mar 2019 03:30:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbP8N8E5nkE1IJAZG8iFEs81ykW7y+yq4mzGI1WHYIWX0h3ACpxVgj064WfZuN1BS7a64s X-Received: by 2002:a17:902:54f:: with SMTP id 73mr42504811plf.210.1553769040104; Thu, 28 Mar 2019 03:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553769040; cv=none; d=google.com; s=arc-20160816; b=1CzUHeR5mqk0Uo8yL8azrvserCyYh8w9c0b9BpMSB5WimSrbRdAt0artKHTZDhTl/A CfGriAPKGT2ewoSgfHU6I3WrYmjMo6BmMeCvBdV393kRyPf7EPtRd20d1VKYk82twSd8 X+A9xYrZldf4V/O4TErHdAnPsQ5xxR/eUpthUlVzhl8biPiosGeL90927BE/nBK3cwxA tR8ayBSkZknB6ZQke3qaSQgcoxvGwaOpaPdoqDwa4VeoJ0KyLfrWpfnVOETiKKKGE/HB t4jfGmPuy7hTkzNytEHh+q5i202VIfipPZBtBRld5V4BizHWhuFlpCyvsBi5LP7VaiwZ gEBA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:dkim-filter :date; bh=RTPWUaWZRBMujFLU36QCKrAQYGhZNM4FWg3ATKGdYzQ=; b=DfNxh26B2eQewiAfy2jSC1xSr2zmLcsHSt1J9nphQOwblxvcW8w+t83WYMAhlLd3V4 yzqGWfCenIw34GOlnAYdgWpU2wNU4T2a5fvSOykc0Nxn3Jho8MlpMQjQsmFuFKz/hlbn Dru4ilBwW6dGM6ANxxO1alYARH/BXQfb5/S9fwTVpJoLADz7gNNFaS6frLg8pbOnChFm Wv3XU76lVyU0sMJiQ/QKDXA4gOp1d0DmKTn9uT0eOH1M3ryHfzwQBf1DUADzT65bXxN8 xhcZRnH+pdSAcHI/B5LnSmr6SQ5N5KXqXrkWNoEvBDYooDTBoW8Qn6gzluBCVzzyoyH+ +UhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=kQV1hvyM; 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=QUARANTINE dis=NONE) header.from=innovation.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e36si17073449pgm.89.2019.03.28.03.30.24; Thu, 28 Mar 2019 03:30:40 -0700 (PDT) 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=@innovation.ch header.s=default header.b=kQV1hvyM; 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=QUARANTINE dis=NONE) header.from=innovation.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbfC1K33 (ORCPT + 99 others); Thu, 28 Mar 2019 06:29:29 -0400 Received: from chill.innovation.ch ([216.218.245.220]:33982 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbfC1K33 (ORCPT ); Thu, 28 Mar 2019 06:29:29 -0400 Date: Thu, 28 Mar 2019 03:29:28 -0700 DKIM-Filter: OpenDKIM Filter v2.10.3 chill.innovation.ch A966C640114 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1553768968; bh=RTPWUaWZRBMujFLU36QCKrAQYGhZNM4FWg3ATKGdYzQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kQV1hvyMjYgr9u8HmlE0ojDfHMGXhBr6KmRciNTzK6PZ0uu26U5gaWFqIt9IH35rE /t7nUpIJJUO2uDB5+P9SeoOMUJcPPFn0JNPPyBw0rpM0hvDU8RH94gRFSZ4lzBi/px 7AaBG/D7NCavl4pTzVuJcKYksBIs0xB8WQLV+9zbATVvLJ1ch/ehfO+wfWQ7Wwp0Zl beB/1PiyU4gPhv0pidz219jnvqofhkadMx3LOSvIZa3GYcwVdZ16XdFY7wMHYjk0AO lUOCuirNVWmoOqwaA2vFsKCu6pn3c2xrMeheyaE9Ozkeej/T6fCDCGp5sHujJtZ2/H /QmI0EZTZDeXg== From: "Life is hard, and then you die" To: Andy Shevchenko Cc: Dmitry Torokhov , Henrik Rydberg , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , "Rafael J. Wysocki" , Lukas Wunner , Federico Lorenzi , linux-input , Linux Kernel Mailing List Subject: Re: [PATCH v3 2/4] lib/hexdump.c: factor out generic hexdump formatting for reuse. Message-ID: <20190328102928.GB26446@innovation.ch> References: <20190327014807.7472-1-ronald@innovation.ch> <20190327014807.7472-3-ronald@innovation.ch> <20190328003459.GG24753@innovation.ch> <20190328090350.GS9224@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190328090350.GS9224@smile.fi.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 28, 2019 at 11:03:50AM +0200, Andy Shevchenko wrote: > On Wed, Mar 27, 2019 at 05:34:59PM -0700, Life is hard, and then you die wrote: > > > > On Wed, Mar 27, 2019 at 09:46:48AM +0200, Andy Shevchenko wrote: > > > On Wed, Mar 27, 2019 at 3:49 AM Ronald Tschal?r wrote: > > > > > > > > This introduces print_hex_dump_to_cb() which contains all the hexdump > > > > formatting minus the actual printk() call, allowing an arbitrary print > > > > function to be supplied instead. And print_hex_dump() is re-implemented > > > > using print_hex_dump_to_cb(). > > > > > > > > This allows other hex-dump logging functions to be provided which call > > > > printk() differently or even log the hexdump somewhere entirely > > > > different. > > > > In any case, don't do it like this. smaller non-recursive printf() is > > > better than one big receursive call. > > > When it looks like an optimization, it's actually a regression. > > > > Not sure where you see recursion here - are you referring to the > > callback approach? > > %pV is a recursive printf(). Ah! > > Since dev_printk() ends up calling printk with a > > dictionary as well as additional formatting, vs print_hex_dump()'s > > stright use of printk, this seemed like the best way accommodate > > various possible ways of logging the messages. But as per below I > > guess this is moot. > > I recommend to read this: https://lwn.net/Articles/780556/ Thanks, quite informative. Cheers, Ronald