From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
David Woodhouse <dwmw2@infradead.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Matthew Wilcox <matthew@wil.cx>,
David Howells <dhowells@redhat.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, Russell King <rmk@arm.linux.org.uk>,
Ian Molton <spyro@f2s.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 4/5] Centralise NO_IRQ definition
Date: Tue, 22 Nov 2005 18:37:56 +0000 [thread overview]
Message-ID: <9497.1132684676@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0511220856470.13959@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> wrote:
> The fact is, 0 _is_ "no interrupt". Always has been.
The fact that it always has been doesn't make it correct; and the fact that
the C particularly likes zeros is only optimisable on some hardware. On RISC
processors where you can't test memory directly, it seems to be the case that
any small positive or negative integer is as good as zero; for instance, in
FRV:
ldi @(gr8,#0),gr4 # doesn't set the condition codes
subicc gr4,#-1,gr0,icc0 # cmp to -1, result to immutable gr0
beq icc0,#0,it_was_unset
I suspect a lot of RISC archs will be like this. It's only certain ones like
M68K and x86 where you can test memory directly:
testl (%eax)
je it_was_unset
that it's usefully optimisable, and in those cases it might be possible to do
this sort of thing:
cmpl $-1,(%eax)
je it_was_unset
though the instruction will be longer.
> In short: NO_IRQ _is_ 0. Always has been.
So what? That hasn't stopped you imposing a blanket change before.
> It's the only sane value.
Has anyone ever accused you of being sane? :-)
> Anybody who does anything else is a bug waiting to happen.
My three main concerns are this:
(1) Changing the no-irq value away from zero is going to cause problems in
certain drivers that assume they can do !dev->irq. I'd like my drivers to
work without me having to do anything to them, but there's a lot of
rubbish drivers out there, even allowing for this. I suspect this is a
tiny part of the problem, and easily fixed in the drivers in the kernel.
(2) 0 is a valid IRQ in lots of places, including x86. IIRC it is permissible
for ISAPNP and PNP-BIOS (and presumably ACPI) to indicate something is
attached to IRQ 0 (usually only the timer is there though, but it can be
possible to reconfigure that).
Fortunately, for the FRV arch IRQ 0 is not used - level 0 in the interrupt
mask register permits all interrupts; and for the AM33 arch, whilst there
is an IRQ 0, that's the NMI interrupt and so has to be handled specially
anyway.
The only reason NO_IRQ on FRV is -1 is that I copied the code from
elsewhere. It could easily be changed to 0.
(3) Having to translate a cookie for a specific IRQ means that the IRQ
handling code will be slower and more complex, or is going to avoid the
issue and be naughty and not deal with irq == NO_IRQ properly:
The x86 PIC reports it as IRQ 0 having happened. In which case, by your
argument, you _have_ to translate it: you're not allowed to pass NO_IRQ to
setup_irq(), and you're not allowed to pass it to the interrupt handler -
in this case timer_interrupt(). Doing otherwise is wrong, insane, etc...
It may even be possible to simplify the x86/x86_64 arch code by making IRQ
0 a normal IRQ instead of something special.
The only argument for not doing so is that it's hidden inside the arch
where it can't be seen... apart from by those looking for examples of good
code to copy (the i386 arch is used as a model for a lot of things).
I'd like to see dev->irq as a pointer to a structure. As you say, the number is
a cookie, but it's also very much dependent on the bus, so why shouldn't it be
associated with the bus in the same way I/O ports and memory ranges are? I'd
also like to see it arranged as a tree: with FRV, I can add extra PIC's into
the tree, thus expanding the IRQ space available dynamically.
However, as far as the current issue goes, I've no concerns for FRV or AM33
should NO_IRQ become 0.
Whatever you decide to do *please* document this in Documentation/ somewhere!
Then you have a "standard" at which to point and say "so it is written". At the
moment it's documented in the code, and that is inconsistent, perhaps
reasonably.
David
next prev parent reply other threads:[~2005-11-22 18:39 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 1:14 [PATCH 4/5] Centralise NO_IRQ definition Matthew Wilcox
2005-11-21 11:12 ` David Howells
2005-11-21 12:14 ` Matthew Wilcox
2005-11-21 18:55 ` Linus Torvalds
2005-11-21 19:06 ` Matthew Wilcox
2005-11-21 19:27 ` Linus Torvalds
2005-11-21 19:43 ` Matthew Wilcox
2005-11-21 19:59 ` Linus Torvalds
2005-11-21 21:15 ` Ingo Molnar
2005-11-21 21:25 ` Paul Mackerras
2005-11-21 21:35 ` Ingo Molnar
2005-11-21 21:51 ` Linus Torvalds
2005-11-21 22:09 ` Benjamin Herrenschmidt
2005-11-21 22:34 ` Linus Torvalds
2005-11-21 23:00 ` Benjamin Herrenschmidt
2005-11-21 21:49 ` Linus Torvalds
2005-11-21 22:06 ` Benjamin Herrenschmidt
2005-11-21 22:28 ` Linus Torvalds
2005-11-21 22:58 ` Benjamin Herrenschmidt
2005-11-21 23:20 ` Paul Mackerras
2005-11-22 1:26 ` Linus Torvalds
2005-11-22 2:45 ` Matthew Wilcox
2005-11-21 21:50 ` Benjamin Herrenschmidt
2005-11-21 22:20 ` Alan Cox
2005-11-22 11:13 ` David Woodhouse
2005-11-22 14:15 ` Alan Cox
2005-11-22 14:04 ` Matthew Wilcox
2005-11-22 17:03 ` Linus Torvalds
2005-11-22 18:20 ` Matthew Wilcox
2005-11-22 18:37 ` David Howells [this message]
2005-11-22 19:03 ` David Woodhouse
2005-11-22 19:21 ` Linus Torvalds
2005-11-22 23:58 ` David Woodhouse
2005-11-22 19:05 ` Linus Torvalds
2005-11-22 19:38 ` David Howells
2005-11-22 19:51 ` Linus Torvalds
2005-11-23 1:45 ` Pavel Machek
2005-11-21 21:16 ` Benjamin Herrenschmidt
2005-11-21 21:38 ` Linus Torvalds
2005-11-21 21:53 ` Benjamin Herrenschmidt
2005-11-21 22:18 ` Linus Torvalds
2005-11-21 22:20 ` Benjamin Herrenschmidt
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=9497.1132684676@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=rmk@arm.linux.org.uk \
--cc=spyro@f2s.com \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox