From: Randy Dunlap <randy.dunlap@oracle.com>
To: James Ketrenos <jketreno@linux.intel.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] Add iwlwifi wireless drivers [part 2/2]
Date: Fri, 18 May 2007 15:13:35 -0700 [thread overview]
Message-ID: <20070518151335.a3a756da.randy.dunlap@oracle.com> (raw)
In-Reply-To: <464E0DB5.5010802@linux.intel.com>
On Fri, 18 May 2007 13:33:57 -0700 James Ketrenos wrote:
> > 2. Use of bitfields: bitfields are not (guaranteed to be) portable
> > across a wire interface to some other CPU architecture.
> > Are all bitfield uses always local to the running driver?
> > They should be.
>
> The bitfields are between the hw/ucode (__le) and the driver. Are you saying the bitfields won't be compatible if the driver is compiled and running on big endian? Shouldn't le16_to_cpu() fix that? I just noticed the types in iwl-4965-hw.h weren't endian specific; I've updated that (u16, u32, u64 -> __le16, __le32, __le64)
I'm just saying that something like
struct bits {
u32 priority :4;
u32 flags :12;
u32 direction :1;
u32 status :15;
};
when built on x86[-64] and then sent over a network connection
to a big-endian machine won't necessarily be looked at correctly
on the receiving machine. There is no guarantee of bitfield order
from one platform to another.
> > 3. What are all of those "volatile" C keywords doing in struct
> > iwl_shared?
> > See http://lwn.net/Articles/232961/ : "The trouble with volatile"
>
> If a reference shared through memory mapped IO with a device that can change the value at any time, doesn't it need to be volatile? 'struct iwl_shared' is allocated with pci_alloc_consistent and the physical address is provided to the hardware for it to update whenever it sees fit.
That's a good question. You probably know as much about it as I do.
Does the driver access those mmIO regions by something direct like
*mmio =
or does the driver use some kind of access routines to read/write
the mmIO regions, such as readb()/writeb()?
If the former, then I expect that those should be changed/fixed,
but I'd prefer to have Jeff G. answer that if he would.
> > 4. Don't list the parameters like this:
>
> Lindent == bad. I've fixed the instances of this munging I've come across.
Indeed. Too bad.
> > 8. Too many BUG_ON()s. Try to recover or return -ERRORs instead.
>
> I pulled out two that shouldn't have been there.
>
> The rest are currently there map to bugs which are easily introduced through code changes but which may not cause an immediately visible bug at run-time. Typically they are placed where an eventual printk() at that location during debugging of a user bug resulted in the critical "ah-ha!" that led to fixing it. I've added comments to the BUG_ON's that didn't have comments already.
>
> I suppose we could try and introduce a new driver recovery mechanism that, upon detection, throws a stack trace and then shuts down the driver (vs. throwing a kernel OOPs) requiring user space to unload and reload the driver. That would still be a sucky situation, but at least it wouldn't cause a system failure requiring a reboot... does such a mechanism already exist?
You can call dump_stack() or use WARN_ON(), but you'll have roll your
own shut-down-the-driver methods AFAIK.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
next prev parent reply other threads:[~2007-05-18 22:10 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-16 21:45 [PATCH] Add iwlwifi wireless drivers James Ketrenos
2007-05-17 1:27 ` Randy Dunlap
2007-05-17 4:28 ` James Ketrenos
2007-05-17 5:57 ` Jeff Garzik
2007-05-22 21:38 ` James Ketrenos
2007-05-18 19:01 ` James Ketrenos
2007-05-18 20:57 ` Jeff Garzik
2007-05-18 20:54 ` James Ketrenos
2007-05-18 21:06 ` Randy Dunlap
2007-05-22 18:39 ` John W. Linville
2007-05-22 18:29 ` James Ketrenos
2007-05-17 1:51 ` Michael Wu
2007-05-17 2:56 ` Jeff Garzik
2007-05-17 3:55 ` Michael Wu
2007-05-17 8:52 ` Christoph Hellwig
2007-05-22 19:16 ` James Ketrenos
2007-05-22 23:00 ` Jeff Garzik
2007-05-22 21:49 ` James Ketrenos
2007-05-22 23:41 ` Jeff Garzik
2007-05-22 22:56 ` James Ketrenos
2007-05-23 0:58 ` Jeff Garzik
2007-05-23 18:17 ` James Ketrenos
2007-05-23 19:59 ` Jeff Garzik
2007-05-23 19:30 ` James Ketrenos
2007-05-23 1:06 ` Michael Wu
2007-05-23 1:46 ` Jeff Garzik
2007-05-17 3:35 ` [PATCH] Add iwlwifi wireless drivers [part 2/2] Randy Dunlap
2007-05-17 15:03 ` Stephen Hemminger
2007-05-17 15:05 ` Stephen Hemminger
2007-05-18 7:04 ` Johannes Berg
2007-05-18 20:33 ` James Ketrenos
2007-05-18 22:05 ` Jeff Garzik
2007-05-18 21:31 ` James Ketrenos
2007-05-18 22:50 ` Jeff Garzik
2007-05-18 23:04 ` Christoph Hellwig
2007-05-21 14:56 ` James Ketrenos
2007-05-21 16:26 ` Christoph Hellwig
2007-05-21 16:48 ` James Ketrenos
2007-05-21 18:15 ` Christoph Hellwig
2007-05-21 20:12 ` Cohen, Guy
2007-05-21 21:02 ` Jeff Garzik
2007-05-21 21:10 ` Randy Dunlap
2007-05-21 21:43 ` Cohen, Guy
2007-05-21 22:15 ` Jeff Garzik
2007-05-21 21:22 ` Joerg Mayer
2007-05-21 21:46 ` Cohen, Guy
2007-05-18 22:13 ` Randy Dunlap [this message]
2007-05-18 23:05 ` [PATCH] Add iwlwifi wireless drivers Christoph Hellwig
2007-05-18 23:22 ` Michael Wu
2007-05-22 21:50 ` [PATCH v3] " James Ketrenos
2007-05-23 1:06 ` Jeff Garzik
2007-05-23 15:16 ` James Ketrenos
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=20070518151335.a3a756da.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=jketreno@linux.intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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.