All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Ingo Molnar <mingo@elte.hu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linus Torvalds <torvalds@osdl.org>,
	linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
	linux-pci@vger.kernel.org, yhlu.kernel@gmail.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH] x86, ioremap: use %pR in printk
Date: Mon, 20 Oct 2008 07:04:39 -0600	[thread overview]
Message-ID: <20081020130439.GD26184@parisc-linux.org> (raw)
In-Reply-To: <20081020113602.GA2697@elte.hu>

On Mon, Oct 20, 2008 at 01:36:02PM +0200, Ingo Molnar wrote:
> One open question would be whether to set the width to 8 on 32-bit 
> platforms and 16 on 64-bit platforms - right now it's 8 on both. Since 
> this is specifically a 'physical address' thing it might make sense to 
> extend that on 64-bit systems. (although it's quite a bit of screen real 
> estate so i think the current width of 8 should be fine)

Maybe we should let architectures configure it -- after all, they know
the real size of a physical address.  I'm thinking something like this:

#ifndef PHYS_ADDR_T_SIZE
#ifdef CONFIG_64BIT
#define PHYS_ADDR_T_SIZE 64
#else
#define PHYS_ADDR_T_SIZE 32
#endif
#endif

static char *phys_addr_string(char *buf, char *end, phys_addr_t *val, int field_width, int precision, int flags)
{
	/* room for the actual number, the "0x" and the final zero */
	char sym[2*sizeof(phys_addr_t) + 3];
	char *p = sym, *pend = sym + sizeof(sym);
	int size = DIV_ROUND_UP(PHYS_ADDR_T_SIZE, 4);

	p = number(p, pend, *val, 16, size, -1, SPECIAL | SMALL | ZEROPAD);
	*p = 0;

	return string(buf, end, sym, field_width, precision, flags);
}

Architectures can define PHYS_ADDR_T_SIZE to a variable if they want
to be able to detect it at boot-time.  Or just define it to a number
(eg 36 for PAE).

By the way, the patch I'm replying to has a bug; you mis-sized 'sym'.
It needs three extra bytes, not two.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  parent reply	other threads:[~2008-10-20 13:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20  4:07 [PATCH 2/2] pci: Use new %pR to print resource ranges Benjamin Herrenschmidt
2008-10-20  7:12 ` [PATCH] x86, ioremap: use %pR in printk Ingo Molnar
2008-10-20  8:34   ` Benjamin Herrenschmidt
2008-10-20  9:05     ` Ingo Molnar
2008-10-20 11:00       ` Ingo Molnar
2008-10-20 11:15         ` Benjamin Herrenschmidt
2008-10-20 11:22           ` Benjamin Herrenschmidt
2008-10-20 11:31             ` Ingo Molnar
2008-10-20 11:36               ` Ingo Molnar
2008-10-20 12:58                 ` Johannes Berg
2008-10-20 13:15                   ` Ingo Molnar
2008-10-20 21:35                   ` Benjamin Herrenschmidt
2008-10-21  6:47                     ` Johannes Berg
2008-10-20 13:04                 ` Matthew Wilcox [this message]
2008-10-20 21:33                 ` Benjamin Herrenschmidt
2008-10-20 21:34                 ` Benjamin Herrenschmidt
2008-10-20 11:30           ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081020130439.GD26184@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@osdl.org \
    --cc=yhlu.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.