[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adamyaavst5.fsf@cisco.com>
Date: Tue, 21 Apr 2009 10:07:50 -0700
From: Roland Dreier <rdreier@...co.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Hitoshi Mitake <h.mitake@...il.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"Robert P. J. Day" <rpjday@...shcourse.ca>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: arch/x86/Kconfig selects invalid HAVE_READQ, HAVE_WRITEQ vars
> Okay, I'm going to throw in yet another wrench in the machinery.
> There are devices which really only want to use writeq() if it is an
> inexpensive (no x86 MMX hacks) atomic operation.
Interesting example. It does seem there are several reasonable hardware
design patters where a driver needs to know if writeq() and/or readq()
is atomic.
> One way to deal with that is the <linux/io64*.h> method, another is with
> feature test macros.
A further idea would be to add readq_atomic()/writeq_atomic() that
behave as the current 64-bit versions do: a single instruction,
generates a single bus cycle, etc. Then drivers that really need to
use the full semantics that the 64-bit versions gave can use those,
while drivers that just want a convenient way to read a 64-bit register
can use readq()/writeq().
This only makes sense if we define a 32-bit fallback for
readq()/writeq() for all 32-bit architectures -- in fact it would be
good to do it in asm-generic so that there can be a single
implementation that guarantees that non-atomic versions always do, say,
low 32 bits then high 32 bits. (So eg niu can use the generic version)
And then drivers like drivers/infiniband/hw/mthca can be switched to
"#ifndef writeq_atomic <...hardware specific fallback...>"
However I worry that this just leaves driver authors too much rope.
Choosing readq_atomic() vs. readq() is just one more thing to get wrong.
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists