Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4893063yba; Wed, 8 May 2019 04:44:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzztsoW4Gd6OnkoGubbxJRmLDUP928o/FJqIpJ0bpPyqYpYMerjdTrL/o/gfqC8rI/kZ9q1 X-Received: by 2002:a63:2c4c:: with SMTP id s73mr45958053pgs.42.1557315873850; Wed, 08 May 2019 04:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557315873; cv=none; d=google.com; s=arc-20160816; b=vlJCAUdSDOpf56k3jC8tLn1GK6D2liSmacpLSr7kkFG4ngb4xfZ3ng4CNTbOiUQ79k jOzFFb4kIgXt6p3+uRe+aP+qFpdPWJw0CL+YON27wPT4yEFFIdGTEsxfoJxP2MhIl5Ae /5WSVw8TXbOfoppkIpsfLp5KtFMnARTFk1cVbf4YHzic7L2lm+oMtNUN6pvIsNIAPt6X f+hawmjD5LBWSLQQBMk6YW/aoGF1QrGu9lshA6Rw8+Vg6jUh1/lhSN7+9OhunUeFXbGK 2Kxc3wK5hGSSA0E7KQQ4iGoREdepKcL4RO5u2zm1YXkU6wZIPeJfiG5D0BTr4cblKe5L Ip0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature; bh=GokriSx99OtTYNclvVAWT2CMn9llMAI4oT+y0253DpQ=; b=FZyhzIjGsO3t4KJjt8UdkTH5gje/rRWq/P6d7LjxZEcnfQOoRaQhTr2DsBNx18ljAN jL8rOknY0raioKRcF4Kjl0hBg6vOlP+DXwX1k+aO/6jy9+F42zH8Yqp0UFWBKAzsqiRp TidC9NSiob0vN41vUgyu4tR9l7zyw5mngFuhRoS0rvM3v9jp48IasihNwafdEO2qOqHN a8DDpMo7c2QGKfVXOnl6GreLmoXlub1qDG87LwwSTXRviWngHh3CzqW6vIoaQauAE5FZ oMA2FMPt1//Km1qXrs5KwTwM3ozQjt7mhDWlG4yVEsINbVfutTFgPEgQ80MYqUPUiR2Y bRfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=D+zmQJif; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si6301665pgj.312.2019.05.08.04.44.17; Wed, 08 May 2019 04:44:33 -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=@d-silva.org header.s=201810a header.b=D+zmQJif; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727783AbfEHLld (ORCPT + 99 others); Wed, 8 May 2019 07:41:33 -0400 Received: from [66.55.73.32] ([66.55.73.32]:39688 "EHLO ushosting.nmnhosting.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1727516AbfEHLld (ORCPT ); Wed, 8 May 2019 07:41:33 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id DDDBC2DC005C; Wed, 8 May 2019 07:41:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1557315692; bh=qGJ1gft/kRGbomR5Gk2AnhkGNE1jEj5BAJb5oyv/unk=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=D+zmQJifkhs/X6hPId/5NOett9ofrnDtUcWmjqgDQKc3MmGh9k5veKFfjfUsCtBRf FZFf+wE05oyytQb7I5QSxpb8YxDDNMe6ras9l+lOOdI2I4wiVfcvVdJcxhmp074fZd eRfG22Mm+p4YPGTk3H20/tVbabqxfxaCBFrcWbKEadAx4wluAml+keUbhh37xxzXH1 jtnTkpsPpKimyEG7DXFY/jeFQeaJwfUkTK4Y4DMRUEvIV24VAnYN4wKYIXpQo7fIGQ VGyU0Ocndb2O+pHLhMLiHTXnhHlfJTLiOr/fkcrymF6eMLuTxDHq2RU1TzLj/TXOk3 0DHxjm3K4DlaD2QfxJxOwBDRpmGvsUA8eIUifWm1Sn5HQZJb+LlRhYErwP2ZYDV3+C 49RUeWCn3gF4iQu8ftb0irqDnHSyUrWFqyq4nWWgrsBOv2CSo+ZX1rkDkY6YAan0OZ R5UsEzcVLiOBK726gA7kr8p0v149w9/LtDfcs4XWO4JVXsDJSNWwTjckKovyK9ONYa 5CpWuRo7c7nrXNmuqkuBSzsJddB0icDr3C5q9J7R5hsEiM6ZjPf1kRCxaGMNO/56Lw 6LX/sDBs5uEivJwatqdQjgbEIoWnyCHietGWGP4y8wVI8SHGxaoZVonCIdFTE8Jl3v W7xdnNfZrPNxEU3wwX3/F4u4= Received: from Hawking (ntp.lan [10.0.1.1]) (authenticated bits=0) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTPSA id x48BfEeD017421 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 8 May 2019 21:41:15 +1000 (AEST) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: "'David Laight'" , "'Alastair D'Silva'" Cc: "'Jani Nikula'" , "'Joonas Lahtinen'" , "'Rodrigo Vivi'" , "'David Airlie'" , "'Daniel Vetter'" , "'Dan Carpenter'" , "'Karsten Keil'" , "'Jassi Brar'" , "'Tom Lendacky'" , "'David S. Miller'" , "'Jose Abreu'" , "'Kalle Valo'" , "'Stanislaw Gruszka'" , "'Benson Leung'" , "'Enric Balletbo i Serra'" , "'James E.J. Bottomley'" , "'Martin K. Petersen'" , "'Greg Kroah-Hartman'" , "'Alexander Viro'" , "'Petr Mladek'" , "'Sergey Senozhatsky'" , "'Steven Rostedt'" , "'Andrew Morton'" , , , , , , , , , , References: <20190508070148.23130-1-alastair@au1.ibm.com> <20190508070148.23130-5-alastair@au1.ibm.com> In-Reply-To: Subject: RE: [PATCH v2 4/7] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags Date: Wed, 8 May 2019 21:41:15 +1000 Message-ID: <0a1c01d50592$f90f6f00$eb2e4d00$@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGz7QD7bMLLz3XdMyQiMIIzLY+D4AHts+RHAcfZVGymhZij0A== Content-Language: en-au X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Wed, 08 May 2019 21:41:26 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: David Laight > Sent: Wednesday, 8 May 2019 7:20 PM > To: 'Alastair D'Silva' ; alastair@d-silva.org > Cc: Jani Nikula ; Joonas Lahtinen > ; Rodrigo Vivi = ; > David Airlie ; Daniel Vetter ; Dan > Carpenter ; Karsten Keil pingi.de>; Jassi Brar ; Tom Lendacky > ; David S. Miller ; > Jose Abreu ; Kalle Valo > ; Stanislaw Gruszka ; > Benson Leung ; Enric Balletbo i Serra > ; James E.J. Bottomley > ; Martin K. Petersen ; > Greg Kroah-Hartman ; Alexander Viro > ; Petr Mladek ; Sergey > Senozhatsky ; Steven Rostedt > ; Andrew Morton ; > intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; = linux- > kernel@vger.kernel.org; netdev@vger.kernel.org; > ath10k@lists.infradead.org; linux-wireless@vger.kernel.org; linux- > scsi@vger.kernel.org; linux-fbdev@vger.kernel.org; > devel@driverdev.osuosl.org; linux-fsdevel@vger.kernel.org > Subject: RE: [PATCH v2 4/7] lib/hexdump.c: Replace ascii bool in > hex_dump_to_buffer with flags >=20 > From: Alastair D'Silva > > Sent: 08 May 2019 08:02 > > To: alastair@d-silva.org > ... > > --- a/include/linux/printk.h > > +++ b/include/linux/printk.h > > @@ -480,13 +480,13 @@ enum { > > DUMP_PREFIX_OFFSET > > }; > > > > -extern int hex_dump_to_buffer(const void *buf, size_t len, int = rowsize, > > - int groupsize, char *linebuf, size_t linebuflen, > > - bool ascii); > > - > > #define HEXDUMP_ASCII (1 << 0) > > #define HEXDUMP_SUPPRESS_REPEATED (1 << 1) >=20 > These ought to be BIT(0) and BIT(1) Thanks, I'll address that. >=20 > > +extern int hex_dump_to_buffer(const void *buf, size_t len, int = rowsize, > > + int groupsize, char *linebuf, size_t linebuflen, > > + u64 flags); >=20 > Why 'u64 flags' ? > How many flags do you envisage ?? > Your HEXDUMP_ASCII (etc) flags are currently signed values and might = get > sign extended causing grief. > 'unsigned int flags' is probably sufficient. I was trying to avoid having to change the prototype again in the = future, but it's not a big deal, if enough work goes in to require more = than 32 bits, it can be updated at that point. >=20 > I've not really looked at the code, it seems OTT in places though. I'll wait for more concrete criticisms here, this it a bit too vague to = take any action on. > If someone copies it somewhere where the performance matters (I've = user > space code which is dominated by its tracing!) then you don't want all = the > function calls and conditionals even if you want some of the = functionality. Calling hexdump (even in it's unaltered form) in performance critical = code is always going to suck. As you mentioned before, it's all based = around printf. A performance conscious user would be better off building = their code around hex_asc_hi/lo instead (see lib/vsprintf.c:hex_string). --=20 Alastair D'Silva mob: 0423 762 819 skype: alastair_dsilva msn: alastair@d-silva.org blog: http://alastair.d-silva.org Twitter: @EvilDeece