From: Chris Metcalf <cmetcalf@tilera.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] arch/tile: new multi-core architecture for Linux
Date: Tue, 25 May 2010 21:57:33 -0400 [thread overview]
Message-ID: <4BFC800D.2090309@tilera.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1005252129441.2948@localhost.localdomain>
Thomas, thanks for your feedback. If I don't comment on something you
said it's because you were obviously right and I applied a suitable fix. :-)
On 5/25/2010 4:12 PM, Thomas Gleixner wrote:
> +/**
> + * tile_request_irq() - Allocate an interrupt handling instance.
> [...]
>
> Why are you implementing your private interrupt handling
> infrastructure ? What's wrong with the generic interrupt handling
> code ? Why is each device driver forced to call tile_request_irq()
> which makes it incompatible to the rest of the kernel and therefor
> unshareable ?
>
Our interrupt management code has evolved as we have developed this
code, so I won't present arguments as to why it's perfect the way it is,
but just why it IS the way it is. :-)
The tile irq.c does not replace the generic Linux IRQ management code,
but instead provides a very limited set of virtual interrupts that are
only used by our para-virtualized device drivers, and delivered to Linux
via a single hypervisor downcall that atomically sets "virtual
interrupt" bits in a bitmask. The PCI root complex driver reserves four
of these bits (i.e. irqs) to map real PCI interrupts; they are then fed
forward into the regular Linux IRQ system to manage all "standard"
devices. The other tile-specific para-virtualized drivers that use this
interface are the PCI endpoint code, xgbe network driver, ATA-over-GPIO
driver, and the IPI layer. None of these para-virtualized drivers are
actually shareable with other Linux architectures in any case.
We have an outstanding enhancement request in our bug tracking system to
switch to using the Linux generic IRQs directly, and plan to implement
it prior to our next major release. But we haven't done it yet, and
this code, though somewhat crufty, is reasonably stable. I'm also not
the primary maintainer of this particular piece of code, so I'd rather
wait until that person frees up and have him do it, instead of trying to
hack it myself.
In any case, I'll add commentary material (probably just an edited
version of the explanatory paragraph above) into irq.c so at least it's
clear what's going on.
> +void tile_free_irq(int index)
> +[...]
>
> That code lacks any kind of protection and serialization.
>
Interesting point. As it happens, these calls are all made during boot,
so they are serialized that way. But in principle we could use the xgbe
driver as a module, at least, so you're right; I'll add a spinlock.
> [...]
>
> You check desc->handler, but you happily call the handler while
> dev_id might be still NULL. See above.
>
Assuming we spinlock the irq request/free routines, I think this is
safe, since the unlock memory fence will guarantee visibility of the
fields prior to any attempt to use them. We always allocate the
interrupt, then tell the hypervisor to start delivering them; on device
unload we tell the hypervisor to stop delivering interrupts, then free
it. The "tell the hypervisor" steps use on_each_cpu() and wait, so are
fully synchronous.
> +/*
> + * Generic, controller-independent functions:
> + */
> +
> +int show_interrupts(struct seq_file *p, void *v)
> +[...]
>
> So that prints which interrupts ? Now you refer to the generic code,
> while above you require that tile specific one. -ENOSENSE.
>
Yes, this is confusing. This routine is required by procfs, and it
shows just the PCI interrupts, not the tile irqs. I'll add a comment,
and try to segregate the file into "generic irqs" and "tile irqs" more
obviously, for now. The routine itself will be more sensible once we
integrate our tile_irqs into the generic system.
> +/* How many cycles per second we are running at. */
> +static cycles_t cycles_per_sec __write_once;
> +static u32 cyc2ns_mult __write_once;
> +#define cyc2ns_shift 30
>
> Please do not use fixed shift values. Use the generic functions to
> calculate the optimal shift/mult pairs instead.
>
Thanks; I wasn't aware of these. I'll switch the code over to use them,
and the other helper functions you pointed out.
> +#if CHIP_HAS_SPLIT_CYCLE()
>
> That should be a CONFIG_TILE_HAS_SPLIT_CYCLE and not a function like
> macro define somewhere in a header file.
>
This is not a configurable option. The <arch/chip.h> header (which is
not a Linux header per-se, but one of our "core architecture" headers
that can be used in any programming context) provides a set of
CHIP_xxx() macros. We use a functional macro style because we saw too
many instances of "#ifdef CHIP_FOO_MISSPELLED" where the misspelling
wasn't noticed until much later.
> +/*
> + * Provide support for effectively turning the timer interrupt on and
> + * off via the interrupt mask. Make sure not to unmask it while we are
> + * running the timer interrupt handler, to avoid recursive timer
> + * interrupts; these may be OK in some cases, but it's generally cleaner
> + * to reset the kernel stack before starting the next timer interrupt.
>
> Which would already be guaranteed by the generic interrupt code ....
> The clockevent callbacks are already called with interrupts
> disabled, so why all this magic ?
>
The code was written so that it would be robust in the face of the timer
interrupt-path code potentially enabling interrupts, since I couldn't
convince myself it didn't. I'll rip out all that code and replace it
with a couple of BUG() checks instead. Thanks, that's a nice cleanup.
And thanks again for the feedback. It's very helpful.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
next prev parent reply other threads:[~2010-05-26 1:57 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 5:43 [PATCH] arch/tile: new multi-core architecture for Linux Chris Metcalf
2010-05-20 8:04 ` Barry Song
2010-05-20 14:32 ` Linus Torvalds
2010-05-20 19:10 ` Chris Metcalf
2010-05-21 4:52 ` Barry Song
2010-05-21 15:13 ` Chris Metcalf
2010-05-20 19:12 ` [PATCH] generic: make lowmem_page_address() use PFN_PHYS() for improved portability Chris Metcalf
2010-05-22 4:05 ` [PATCH] arch/tile: new multi-core architecture for Linux Chris Metcalf
2010-05-23 22:08 ` Arnd Bergmann
2010-05-24 15:29 ` Chris Metcalf
2010-05-24 18:53 ` Arnd Bergmann
2010-05-24 21:29 ` Chris Metcalf
2010-05-25 13:54 ` Chris Metcalf
2010-05-25 15:03 ` Arnd Bergmann
2010-05-25 15:13 ` Chris Metcalf
2010-05-25 15:30 ` Arnd Bergmann
2010-05-26 2:44 ` liqin.chen
2010-05-26 13:45 ` Chris Metcalf
[not found] ` <4BFBE005.2070500@tilera.com>
[not found] ` <201005251721.23782.arnd@arndb.de>
2010-05-26 23:05 ` Chris Metcalf
2010-05-26 5:02 ` Paul Mundt
2010-05-25 21:45 ` Arnd Bergmann
2010-05-27 0:58 ` Chris Metcalf
2010-05-27 8:41 ` Arnd Bergmann
2010-05-27 13:30 ` Chris Metcalf
2010-05-27 13:41 ` Geert Uytterhoeven
2010-05-27 13:48 ` Paul Mundt
2010-05-27 14:11 ` Arnd Bergmann
2010-05-27 14:35 ` Chris Metcalf
2010-05-27 15:02 ` Arnd Bergmann
2010-05-27 15:04 ` Chris Metcalf
2010-05-27 15:20 ` Arnd Bergmann
2010-05-27 14:52 ` Marc Gauthier
2010-05-28 17:58 ` Chris Metcalf
2010-05-27 15:03 ` Chris Metcalf
2010-05-27 20:34 ` Jamie Lokier
2010-05-27 20:53 ` Arnd Bergmann
2010-05-28 16:45 ` Chris Metcalf
2010-05-28 17:16 ` Arnd Bergmann
2010-05-28 17:28 ` Chris Metcalf
2011-05-16 18:23 ` [PATCH] arch/tile: support signal "exception-trace" hook Chris Metcalf
2011-05-18 18:14 ` Chris Metcalf
2011-05-17 20:26 ` [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute Chris Metcalf
2011-05-19 13:41 ` Arnd Bergmann
2011-05-19 15:12 ` Chris Metcalf
2011-05-19 15:22 ` Arnd Bergmann
2011-05-20 14:26 ` Chris Metcalf
2011-05-20 14:37 ` Arnd Bergmann
2011-05-20 15:00 ` Chris Metcalf
2011-05-20 15:13 ` Arnd Bergmann
2011-05-20 19:59 ` Arnd Bergmann
2011-05-25 19:18 ` Chris Metcalf
2011-05-25 20:20 ` Arnd Bergmann
2011-05-25 20:31 ` Chris Metcalf
2011-05-25 20:34 ` Arnd Bergmann
2011-05-24 15:38 ` Arnd Bergmann
2011-05-26 16:40 ` [PATCH v2] arch/tile: more /proc and /sys file support Chris Metcalf
2011-05-27 14:23 ` Arnd Bergmann
2010-05-24 20:22 ` [PATCH] arch/tile: new multi-core architecture for Linux Sam Ravnborg
2010-05-24 21:30 ` Chris Metcalf
2010-05-25 5:02 ` Sam Ravnborg
2010-05-25 20:12 ` Thomas Gleixner
2010-05-26 1:57 ` Chris Metcalf [this message]
2010-05-26 16:22 ` Chris Metcalf
2010-05-26 17:09 ` Arnd Bergmann
2010-05-29 3:01 ` [PATCH 1/8] Fix up the "generic" unistd.h ABI to be more useful Chris Metcalf
2010-05-29 3:09 ` [PATCH 2/8] arch/tile: infrastructure and configuration-related files Chris Metcalf
2010-05-31 7:47 ` Paul Mundt
2010-06-03 17:54 ` Chris Metcalf
2010-05-29 3:10 ` [PATCH 3/8] arch/tile: header files for the Tile architecture Chris Metcalf
2010-05-31 2:58 ` FUJITA Tomonori
2010-06-03 21:32 ` [PATCH] arch/tile: respond to reviews of the second code submission Chris Metcalf
2010-06-04 0:50 ` Paul Mundt
2010-06-04 1:31 ` FUJITA Tomonori
2010-06-07 5:25 ` FUJITA Tomonori
2010-05-29 3:10 ` [PATCH 4/8] arch/tile: core kernel/ code Chris Metcalf
2010-05-31 2:58 ` FUJITA Tomonori
2010-05-29 3:11 ` [PATCH 5/8] arch/tile: the kernel/tile-desc_32.c file Chris Metcalf
2010-05-29 3:13 ` [PATCH 6/8] arch/tile: the mm/ directory Chris Metcalf
2010-05-29 3:16 ` [PATCH 7/8] arch/tile: lib/ directory Chris Metcalf
2010-05-29 3:17 ` [PATCH 8/8] arch/tile: hypervisor console driver Chris Metcalf
2010-05-29 3:20 ` [PATCH 0/8] revised patch for arch/tile/ support Chris Metcalf
2010-05-29 11:29 ` Arnd Bergmann
2010-06-03 20:40 ` Arnd Bergmann
2010-06-03 21:48 ` Chris Metcalf
2010-06-04 21:32 ` Chris Metcalf
2010-06-05 12:56 ` Stephen Rothwell
2010-06-05 13:30 ` Chris Metcalf
2010-06-05 14:10 ` Stephen Rothwell
[not found] ` <dVZMmBu$KHA.5388@exchange1.tad.internal.tilera.com>
2010-05-29 3:20 ` Chris Metcalf
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=4BFC800D.2090309@tilera.com \
--to=cmetcalf@tilera.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox