From: Matthew Wilcox <matthew@wil.cx>
To: Grant Grundler <grundler@parisc-linux.org>
Cc: Jan Beulich <jbeulich@novell.com>,
linux-pci@vger.kernel.org, xen-devel@lists.xensource.com
Subject: Re: Is msix_flush_writes() really needed? And multi_msi_*() flawed?
Date: Sat, 8 Nov 2008 19:13:23 -0700 [thread overview]
Message-ID: <20081109021322.GL15439@parisc-linux.org> (raw)
In-Reply-To: <20081108183745.GB28039@colo.lackof.org>
On Sat, Nov 08, 2008 at 11:37:45AM -0700, Grant Grundler wrote:
> On Sat, Nov 08, 2008 at 07:10:22AM -0700, Matthew Wilcox wrote:
> > It's certainly true (I'd noticed it too). What I hadn't decided was
> > whether to take out the readl() or take out the msix_flush_writes().
> > I'm conflicted.
>
> Good, I'm not. :)
> I'd much rather remove msix_flush_writes(). It's clearer to me to have the
> readl() next to the writel() than to bury the readl() a function call later.
That's certainly a respectable opinion. It's one I hold myself. Have
you considered another opinion that if you're trying to disable a
thousand or more interrupts, doing writel/readl() a thousand times is
going to be less efficient than doing writel() a thousand times and
readl() once? We don't really have a need to do that today, but it's a
possible direction we might want to move in the future.
> Thanks - You are right. I expected (1U<<32) to be zero (arithmetic shift left)
> instead of 1 ("Rotate Left" aka "logical shift left"). Code below produced:
Er, rotate left is not logical shift left. Also, shifting by >= the number of
bits in the element is undefined by the C spec. Which is why Jan broke
it into two shifts.
> 5 32 0x1 0x0
>
> when using "1U << k". Here's the test code:
>
> grundler@mb500:~$ cat test_shift.c
> #include <stdio.h>
> main()
> {
> unsigned int i;
> for (i=0;i<6; i++) {
> unsigned int k = 1U << i ;
> unsigned int j = 1ULL << k ;
> printf("%d %d 0x%x 0x%x\n", i, k, j, j - 1);
> }
> return 0;
> }
This will give different results on different processors, and possibly
even with different compilers. It is entitled to emit nasal daemons.
> Using "1ULL" (64-bit constant) is enough to get the result I was
> expecting.... note I didn't declare j as "unsigned long long j"
> because gcc didn't warn about assigning "1ULL < k" (64-bit) to an
> unsigned int (32-bit). gcc bug?
Not a bug. That kind of truncation isn't generally warned about.
Consider:
void foo(char *x, int bar)
{
x[0] = bar >> 24;
x[1] = bar >> 16;
x[2] = bar >> 8;
x[3] = bar;
}
> I think the kernel should declare maskbits as 64-bit and
> use "1ULL" to just keep things obvious.
I suspec that's rather inefficient.
> > unsigned int msi_mask[] = {
> > 1, 3, 7, 15, 0xff, 0xffff, 0xffffffff
> > };
>
> The code, when written correctly, seems compact and simple enough.
I'm not sure I agree.
This is all rather moot since multiple MSI isn't supported, and my
patchset deletes the function in question anyway.
--
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."
next prev parent reply other threads:[~2008-11-09 2:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 8:53 Is msix_flush_writes() really needed? And multi_msi_*() flawed? Jan Beulich
2008-11-08 8:28 ` Grant Grundler
2008-11-08 14:10 ` Matthew Wilcox
2008-11-08 18:37 ` Grant Grundler
2008-11-09 2:13 ` Matthew Wilcox [this message]
2008-11-09 7:52 ` Grant Grundler
2008-11-10 8:38 ` Jan Beulich
2008-11-09 23:07 ` Michael Ellerman
2008-11-10 4:34 ` Grant Grundler
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=20081109021322.GL15439@parisc-linux.org \
--to=matthew@wil.cx \
--cc=grundler@parisc-linux.org \
--cc=jbeulich@novell.com \
--cc=linux-pci@vger.kernel.org \
--cc=xen-devel@lists.xensource.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.