From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap Date: Mon, 25 Jan 2016 12:44:27 -0800 Message-ID: <1453754667.2363.67.camel@HansenPartnership.com> References: <1453560913-134672-1-git-send-email-andriy.shevchenko@linux.intel.com> <1453560913-134672-4-git-send-email-andriy.shevchenko@linux.intel.com> <1453567445.2470.24.camel@HansenPartnership.com> <94D0CD8314A33A4D9D801C0FE68B40295BF3B840@G9W0745.americas.hpqcorp.net> <1453748172.2363.36.camel@HansenPartnership.com> <1453751131.2363.54.camel@HansenPartnership.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andy Shevchenko Cc: "Elliott, Robert (Persistent Memory)" , Andy Shevchenko , Matt Fleming , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Rasmus Villemoes , Andrew Morton , "linux-kernel @ vger . kernel . org" List-Id: linux-efi@vger.kernel.org On Mon, 2016-01-25 at 22:01 +0200, Andy Shevchenko wrote: > On Mon, Jan 25, 2016 at 9:45 PM, James Bottomley > wrote: > > On Mon, 2016-01-25 at 21:28 +0200, Andy Shevchenko wrote: > > > Also, in one version I tried to convert couple of other users > > > which > > > are using only KM (in general whatever range it would be) units. > > > Any > > > ideas how to modify to support them? > >=20 > > You mean units in odd increments of 6 digits (so K, M, T ...)? no.=20 > > The logarithmic reduction is done to the base of the unit=20 > > increment (1000 or 1024) so it doesn't really fit this case and it=20 > > would be hard to adjust because we don't have enough precision in=20 > > the remainder. However, unless there's a huge need to keep it, I'd= =20 > > just fit to the closest 3 digit increment and then everything would > > work. >=20 > KM case: > K) if 1 MiB > value >=3D 0 =E2=80=94 prints in KiB > M) if =E2=88=9E > value >=3D 1 MiB =E2=80=94 prints in MiB. Actually there is a way to do this: add a fixed precision argument that would stop the logarithmic reduction when the desired precision were reached. You'd still have to do the precision discrimination in the call, so something like num > 1Mib ? call for precision of 6 : call for precision of 3 James From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933844AbcAYUoc (ORCPT ); Mon, 25 Jan 2016 15:44:32 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:55952 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933558AbcAYUo3 (ORCPT ); Mon, 25 Jan 2016 15:44:29 -0500 Message-ID: <1453754667.2363.67.camel@HansenPartnership.com> Subject: Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap From: James Bottomley To: Andy Shevchenko Cc: "Elliott, Robert (Persistent Memory)" , Andy Shevchenko , Matt Fleming , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , "linux-efi@vger.kernel.org" , Rasmus Villemoes , Andrew Morton , "linux-kernel @ vger . kernel . org" Date: Mon, 25 Jan 2016 12:44:27 -0800 In-Reply-To: References: <1453560913-134672-1-git-send-email-andriy.shevchenko@linux.intel.com> <1453560913-134672-4-git-send-email-andriy.shevchenko@linux.intel.com> <1453567445.2470.24.camel@HansenPartnership.com> <94D0CD8314A33A4D9D801C0FE68B40295BF3B840@G9W0745.americas.hpqcorp.net> <1453748172.2363.36.camel@HansenPartnership.com> <1453751131.2363.54.camel@HansenPartnership.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-01-25 at 22:01 +0200, Andy Shevchenko wrote: > On Mon, Jan 25, 2016 at 9:45 PM, James Bottomley > wrote: > > On Mon, 2016-01-25 at 21:28 +0200, Andy Shevchenko wrote: > > > Also, in one version I tried to convert couple of other users > > > which > > > are using only KM (in general whatever range it would be) units. > > > Any > > > ideas how to modify to support them? > > > > You mean units in odd increments of 6 digits (so K, M, T ...)? no. > > The logarithmic reduction is done to the base of the unit > > increment (1000 or 1024) so it doesn't really fit this case and it > > would be hard to adjust because we don't have enough precision in > > the remainder. However, unless there's a huge need to keep it, I'd > > just fit to the closest 3 digit increment and then everything would > > work. > > KM case: > K) if 1 MiB > value >= 0 — prints in KiB > M) if ∞ > value >= 1 MiB — prints in MiB. Actually there is a way to do this: add a fixed precision argument that would stop the logarithmic reduction when the desired precision were reached. You'd still have to do the precision discrimination in the call, so something like num > 1Mib ? call for precision of 6 : call for precision of 3 James