All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] resources: fix call to alignf() in allocate_resource()
Date: Mon, 21 Dec 2009 09:40:31 +0100	[thread overview]
Message-ID: <20091221084031.GB1648@isilmar.linta.de> (raw)
In-Reply-To: <alpine.LFD.2.00.0912201026570.3712@localhost.localdomain>

On Sun, Dec 20, 2009 at 10:33:05AM -0800, Linus Torvalds wrote:
> 
> 
> On Sun, 20 Dec 2009, Dominik Brodowski wrote:
> >
> > The second parameter to alignf() in allocate_resource() must
> > reflect what new resource is attempted to be allocated, else
> > functions like pcibios_align_resource() (at least on x86) or
> > pcmcia_align() can't work correctly.
> > 
> > Commit 1e5ad9679016275d422e36b12a98b0927d76f556 broke this by
> > setting the "new" resource until we're about to return success.
> > To keep the resource untouched when allocate_resource() fails,
> > a "tmp" resource is introduced.
> 
> Ack. That was subtle. 
> 
> That said, maybe a nicer fix to this would be to actually return 'start' 
> from the 'alignf' macro. That "modify the resource inside the alignment 
> function" thing was always pretty ugly.
> 
> And then we'd pass in 'start' instead of 'size' (I have _no_ idea why we 
> pass in 'size' to the alignment function, but whatever).

At least the PCMCIA "align" function makes excessive use of the "size"
parameter, so we'd still need this.

> We'd still need to pass in the 'struct resource', but that would be so 
> that it can figure out 'flags' (and 'size' if it really needs it) from it, 
> but now it would be for reading only. So we could mark it 'const'.

AFAICS, you can't determine the size out of "struct resource" as "start +
size" may be less than "end" (else we couldn't align anything, couldn't we?).

> But Dominik's patch is ok too - the problem is not his patch, it's our 
> longstanding horrible sh*t-for-brains calling convention (for which you 
> can probably blame me - mea culpa).

What about taking my patch for 2.6.33, and deferring the change to the
calling convention to the 2.6.34 merge window? (I'll try to cook something
up and get it into linux-next during the next few weeks).

Best,
	Dominik

  parent reply	other threads:[~2009-12-21  8:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-20  9:50 [PATCH] resources: fix call to alignf() in allocate_resource() Dominik Brodowski
2009-12-20 18:33 ` Linus Torvalds
2009-12-20 22:12   ` Bjorn Helgaas
2009-12-21  8:40   ` Dominik Brodowski [this message]
2009-12-21 16:03     ` Linus Torvalds
2010-01-01 16:38       ` [RFC] improve alignf() calling convention " Dominik Brodowski
2010-01-01 16:40         ` [PATCH 1/2] resource: align functions now return start of resource Dominik Brodowski
2010-01-01 16:40           ` Dominik Brodowski
2010-01-01 22:12           ` Yinghai Lu
2010-01-01 22:12             ` Yinghai Lu
2010-01-03 16:30             ` Dominik Brodowski
2010-01-15 18:23           ` Jesse Barnes
2010-01-15 18:23             ` Jesse Barnes
2010-01-15 18:23             ` Jesse Barnes
2010-01-01 16:40         ` [PATCH 2/2] resource: mark struct resource as const Dominik Brodowski
2010-01-01 16:40           ` Dominik Brodowski
2010-01-14  7:28       ` why can not receive kernel mail anymore? goldenwang1979

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=20091221084031.GB1648@isilmar.linta.de \
    --to=linux@dominikbrodowski.net \
    --cc=bjorn.helgaas@hp.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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.