All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hitoshi Mitake <h.mitake@gmail.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Roland Dreier <rdreier@cisco.com>, Ingo Molnar <mingo@elte.hu>,
	David Miller <davem@davemloft.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	hpa@zytor.com, tglx@linutronix.de, rpjday@crashcourse.ca,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Remove readq()/writeq() on 32-bit
Date: Wed, 13 May 2009 14:32:19 +0900	[thread overview]
Message-ID: <a6b9f31a0905122232s2d23b4e3h6e447c3fa5c29ee6@mail.gmail.com> (raw)
In-Reply-To: <49F8B1A1.4010208@garzik.org>

On Thu, Apr 30, 2009 at 04:59, Jeff Garzik <jeff@garzik.org> wrote:
> Roland Dreier wrote:
>>
>>  > This removal patch is completely pointless, because it moves us
>>  > backwards to the point where we had a bunch of drivers defining it.
>>
>> No, the current kernel still requires drivers to define it anyway,
>> because there are tons of 32-bit architectures that are not x86.
>
> Then let's fix that issue...  by propagating the common definition to other
> platforms that properly implement {read,write}[bwl] in terms of the PCI bus.
>
>
>> And more than that, centralizing the definition makes the API much more
>> dangerous for driver authors.
>
> I think that's really cranking the hyperbole level to 11.
>
> The common definition is... the one found most commonly in the wild. For
> weird drivers, they will do their own thing.
>
> That's pretty much how other drivers handle things.
>
> Apply your logic here to _any_ API in the kernel, for the same result.
>
>
>>  > At least the networking drivers I messed with (until 11/2008) were
>>  > always fine with a non-atomic readq.
>>
>> The commit to niu I keep citing (e23a59e1, "niu: Fix readq
>> implementation when architecture does not provide one.") shows that
>> drivers need to take care.  Now, the x86 implementation would happen to
>
> That commit also shows that, had the driver been using a common definition,
> problems would not have arisen.
>
>
>> work for that hardware, but eg drivers/infiniband/hw/amso1100 defines
>> readq with the opposite order -- whether that's required or just an
>
> 'required' seems unlikely, given that
>
> a) their readq only exists when #ifndef readq, thus implying the
> driver-local readq is far less tested, on their most-tested, highest-volume
> platform.
>
> b) their readq still operates in LE order -- as it should: read,write[bwl]
> were defined in terms of PCI originally, and thus defined to be LE.
>
> c) their __raw_writeq writes in lower-32-bits-first, as one would expect
>
>
>> arbitrary choice, I don't know.  And drivers/infiniband/hw/mthca has
>> some uses of __raw_writeq() that only work if no other CPU accesses to
>> the same page can happen between the two halves, so it adds a per-page
>> spinlock for 32-bit architectures.  etc.
>
> Any use of __raw_xxx implies that You Know What You're Doing And Accept The
> Consequences.  __raw_xxx means _you_ handle endian conversions, barriers,
> and other arch-specific details.  I don't think that a driver intentionally
> using the "raw" APIs is a good source of ideas and generalizations.
>
> So, for your three examples,
>
>        1) niu - common definition is OK
>
>        2) amso1100 - common definition is OK; driver-local definition
>           never used on common PCI platforms
>
>        3) mthca - intentionally uses raw API, an API which ditches
>           arch-specific barriers, endian conversions, and other
>           guarantees.
>
> Given that, I see zero justification for API removal.  I see justification
> for propagating this code to other PCI-capable platforms.
>
> Finally, I think given all this time we've had driver-define writeq and
> readq, and "driver authors were forced to think about this API" -- the
> result was the obvious definition now in place!
>
>        Jeff
>
>
>
>
>

I think it's good time to decide making all architectures
which have readq/writeq provide HAVE_READQ/HAVE_WRITEQ or not.

Adding HAVE_READQ/HAVE_WRITEQ to Kconfig of architectures needs
agreement of all maintainers of these.

But, David Miller, maintainer of SPARC architecture, acked Roland's patch
because of the possibility of bugs non-atomicity of readq/writeq of
x86-32 will cause.

And, Jeff Garzik said that he saw zero justification for API removal.

Which way should we choose?
Remove readq/writeq from x86-32?
Or add HAVE... to all architectures with readq/writeq?

  reply	other threads:[~2009-05-13  5:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-19 19:45 arch/x86/Kconfig selects invalid HAVE_READQ, HAVE_WRITEQ vars Robert P. J. Day
2009-04-19 21:12 ` Roland Dreier
2009-04-19 21:46   ` Ingo Molnar
2009-04-19 22:02     ` H. Peter Anvin
2009-04-19 22:35       ` Ingo Molnar
2009-04-20  0:56         ` Roland Dreier
2009-04-20  2:08           ` Robert Hancock
2009-04-20  0:53     ` Roland Dreier
2009-04-20  1:20       ` H. Peter Anvin
2009-04-20 10:53         ` Ingo Molnar
2009-04-20 14:47           ` Hitoshi Mitake
2009-04-20 16:03             ` Ingo Molnar
2009-04-21  8:33               ` Hitoshi Mitake
2009-04-21  8:45                 ` Ingo Molnar
2009-04-21  8:57                   ` Hitoshi Mitake
2009-04-21 15:44                 ` H. Peter Anvin
2009-04-21 17:07                   ` Roland Dreier
2009-04-21 17:19                     ` H. Peter Anvin
2009-04-21 17:23                       ` Roland Dreier
2009-04-21 19:09                         ` H. Peter Anvin
2009-04-21 21:11                           ` Roland Dreier
2009-04-21 21:16                             ` H. Peter Anvin
2009-04-22  0:31                               ` David Miller
2009-04-28 19:05                                 ` [PATCH] x86: Remove readq()/writeq() on 32-bit Roland Dreier
2009-04-29  5:12                                   ` David Miller
2009-04-29 11:56                                     ` Ingo Molnar
2009-04-29 12:10                                       ` Jeff Garzik
2009-04-29 17:25                                         ` Roland Dreier
2009-04-29 19:59                                           ` Jeff Garzik
2009-05-13  5:32                                             ` Hitoshi Mitake [this message]
2009-05-13 20:19                                               ` H. Peter Anvin
2009-05-13 22:39                                                 ` Jeff Garzik
2009-05-13 23:39                                                   ` H. Peter Anvin
2009-05-14  0:49                                                     ` Jeff Garzik
2009-05-14  7:19                                                       ` Hitoshi Mitake
2009-05-15 23:44                                                         ` Jeff Garzik
2009-05-17  7:12                                                           ` Hitoshi Mitake
2009-05-17  8:06                                                             ` Jeff Garzik
2009-05-21 11:35                                                               ` Hitoshi Mitake
2009-05-21 11:49                                                                 ` Hitoshi Mitake
2009-05-13 20:42                                               ` Jeff Garzik
2009-05-13 21:05                                                 ` H. Peter Anvin
2009-05-13 21:30                                                   ` Jeff Garzik
2009-05-13 21:31                                                     ` Jeff Garzik
2009-05-13 21:54                                                     ` H. Peter Anvin
2009-05-13 22:06                                                 ` Roland Dreier
2009-05-13 22:29                                                   ` Jeff Garzik
2009-04-29 17:21                                       ` Roland Dreier
2009-04-22  0:27                           ` arch/x86/Kconfig selects invalid HAVE_READQ, HAVE_WRITEQ vars David Miller
2009-04-22  0:25                     ` David Miller

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=a6b9f31a0905122232s2d23b4e3h6e447c3fa5c29ee6@mail.gmail.com \
    --to=h.mitake@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdreier@cisco.com \
    --cc=rpjday@crashcourse.ca \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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.