From: Michal Simek <monstr@monstr.eu>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, john.williams@petalogix.com
Subject: Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code
Date: Thu, 19 Mar 2009 21:28:57 +0100 [thread overview]
Message-ID: <49C2AB09.9040300@monstr.eu> (raw)
In-Reply-To: <alpine.LFD.2.00.0903191639530.29264@localhost.localdomain>
Hi Thomas,
>
>> +static u32 concurrent_irq;
>> +
>> +void do_IRQ(struct pt_regs *regs)
>> +{
>> + unsigned int irq;
>> + struct pt_regs *old_regs = set_irq_regs(regs);
>> +
>> + irq_enter();
>> + irq = get_irq(regs);
>> +next_irq:
>> + BUG_ON(irq == -1U);
>> + __do_IRQ(irq);
>
> You use irq chips now and you set the type handlers (edge/level), but
> you still call __do_IRQ() the all in one fits nothing handler, which
> is going to be deprecated and removed.
I know about.
>
> Please call
> generic_handle_irq(irq);
>
> which will call the correct flow handlers.
I would like to use it but don't work with edge interrupt.
__do_IRQ handle it in right way.
I used this implementation but I did some change edge/level handling and I can't
use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b
Any hints what could be wrong?
First of all I have one question to you about MB timer.c.
It is about this function - microblaze_read.
static cycle_t mb_tick_cnt; /* store counter ticks */
static cycle_t microblaze_read(void)
{
u64 temp = (u64)mb_tick_cnt + (u64)((u32)cpuinfo.freq_div_hz
- (u32)in_be32(TIMER_BASE + TCR0));
return temp;
}
MB has 32bit periodic down counter and I need to use u64 value that's why
I do these operation above. cpuinfo.freq_div_hz store freq/HZ value - number of
ticks for 1/HZ. I subtract current timer value + mb_tick_cnt which store number
of count. The problem I have is that gettimeofday LTP test failed on it ->
announce that time is going backward.
Simple returning only mb_tick_cnt pass this test but of course I am losing
information about time till 1/HZ.
Do I have to add any specific amount of time which take counting of it?
And the second question is about shift and rating values.
I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.
...
And the second part is about shift and rating values. Rating is
describe(linux/clocksource.h) and seems to me that should be
corresponded with CONFIG_HZ value,right?
And I found any explanation of shift value -> max value for equation
(2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit
number, where (2-5s) are because of NTP
The second thing which seems to me weird in comparing with others log I
have seen is .resolution value. Full (proc/timer_lists is below) My
.resolution: 10000000 nsecs which
is 1/HZ in nsec. (On others log I saw 1nsec values). My the lowest
resolution is 1/freq = 8nsec (for 125MHz). Is that OK or not.
...
>
>> +static int microblaze_timer_set_next_event(unsigned long delta,
>> + struct clock_event_device *dev)
>> +{
>> + printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);
>
> This should be pr_debug() or do you want to flood the syslog in
> every timer interrupt ?
This not flood the syslog. I don't know why (maybe because of missing ONESHOT)
but this code is never called in periodic mode. But you are right if this
function is called a lot it is necessary to use pr_debug -> but this is not my
case in this implementation.
>
>> + microblaze_timer_start(delta);
>> + return 0;
>> +}
>> +
>> +static void microblaze_timer_set_mode(enum clock_event_mode mode,
>> + struct clock_event_device *evt)
>> +{
>> + microblaze_timer_stop();
>> +
>> + switch (mode) {
>> + case CLOCK_EVT_MODE_PERIODIC:
>> + printk(KERN_INFO "%s: periodic\n", __func__);
>
> pr_debug as well. That's not very informative
It is only information that timer work in periodic mode.
Part of kernel log which is there - nothing more.
microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic
>
>> +static irqreturn_t timer_interrupt(int irq, void *dev_id)
>> +{
>> + struct clock_event_device *evt = &clockevent_microblaze_timer;
>> +#ifdef CONFIG_HEART_BEAT
>> + heartbeat();
>> +#endif
>> + timer_ack();
>> +
>> + mb_tick_cnt += cpuinfo.freq_div_hz;
>
> Hmm. How does that work with oneshot timers ?
Oneshot is not supported yet - only periodic mode. I had to add it mb_tick_cnt
counting because
I don't know reason but without it ( kernel and timer in periodic mode )not
update system time.
>
>> + evt->event_handler(evt);
>> + return IRQ_HANDLED;
>> +}
>> +
>> +static struct irqaction timer_irqaction = {
>> + .handler = timer_interrupt,
>> + .flags = IRQF_DISABLED,
>
> IRQF_DISABLED | IRQF_TIMER,
OK. I'll add it.
>
>
>> + xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
>> + xtime.tv_nsec = 0;
>> + set_normalized_timespec(&wall_to_monotonic,
>> + -xtime.tv_sec, -xtime.tv_nsec);
>
> Yuck. What's that ? wall_to_monotonic is maintained by the generic
> code.
I take this part of code from arch/blackfin/kernel/time-ts.c:217-219.
arch/x86/xen/time.c use it too. And arch/arm/kernel/time.c use similar
implemetation.
Thanks,
Michal
>
> Thanks,
>
> tglx
>
>
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
next prev parent reply other threads:[~2009-03-19 20:29 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 20:30 Microblaze linux support monstr
2009-03-18 20:30 ` [PATCH 01/57] microblaze_v7: Kconfig patches monstr
2009-03-18 20:30 ` [PATCH 02/57] microblaze_v7: Makefiles for Microblaze cpu monstr
2009-03-18 20:30 ` [PATCH 03/57] microblaze_v7: Cpuinfo handling monstr
2009-03-18 20:30 ` [PATCH 04/57] microblaze_v7: Open firmware files monstr
2009-03-23 18:51 ` Arnd Bergmann
2009-03-23 20:53 ` Anton Vorontsov
2009-03-26 0:01 ` Benjamin Herrenschmidt
2009-03-24 11:17 ` Michal Simek
2009-03-18 20:30 ` [PATCH 05/57] microblaze_v7: Platorm bus registration monstr
2009-03-18 20:30 ` [PATCH 06/57] microblaze_v7: exception handling monstr
2009-03-18 20:30 ` [PATCH 07/57] microblaze_v7: Signal support monstr
2009-03-23 19:35 ` Arnd Bergmann
2009-03-24 11:14 ` Michal Simek
2009-03-18 20:30 ` [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code monstr
2009-03-19 15:49 ` Thomas Gleixner
2009-03-19 20:28 ` Michal Simek [this message]
2009-03-19 21:47 ` Thomas Gleixner
2009-03-20 2:24 ` John Stultz
2009-03-20 7:27 ` Michal Simek
2009-03-20 20:40 ` john stultz
2009-03-21 10:38 ` Michal Simek
2009-03-21 11:14 ` Thomas Gleixner
2009-03-21 11:57 ` Michal Simek
2009-03-21 12:05 ` Thomas Gleixner
2009-03-21 12:07 ` Michal Simek
2009-03-20 6:38 ` Michal Simek
2009-03-20 10:07 ` Thomas Gleixner
2009-03-20 9:26 ` Michal Simek
2009-03-20 9:58 ` Thomas Gleixner
2009-03-20 10:37 ` Michal Simek
2009-03-20 10:49 ` Thomas Gleixner
2009-03-20 11:28 ` Michal Simek
2009-03-20 11:41 ` Thomas Gleixner
2009-03-20 11:59 ` Michal Simek
2009-03-20 14:08 ` Michal Simek
2009-03-20 14:12 ` Thomas Gleixner
2009-03-20 14:27 ` Michal Simek
2009-03-18 20:30 ` [PATCH 09/57] microblaze_v7: cache support monstr
2009-03-18 20:30 ` [PATCH 10/57] microblaze_v7: Generic dts file for platforms monstr
2009-03-18 20:30 ` [PATCH 11/57] microblaze_v7: kernel modules support monstr
2009-03-18 20:30 ` [PATCH 12/57] microblaze_v7: lmb include file monstr
2009-03-18 20:30 ` [PATCH 13/57] microblaze_v7: PVR support, cpuinfo support monstr
2009-03-18 20:30 ` [PATCH 14/57] microblaze_v7: defconfig file monstr
2009-03-18 20:30 ` [PATCH 15/57] microblaze_v7: assembler files head.S, entry-nommu.S, syscall_table.S monstr
2009-03-18 20:30 ` [PATCH 16/57] microblaze_v7: vmlinux.lds.S - linker script monstr
2009-03-18 20:30 ` [PATCH 17/57] microblaze_v7: supported function for memory - kernel/lib monstr
2009-03-18 20:30 ` [PATCH 18/57] microblaze_v7: checksum support monstr
2009-03-18 20:30 ` [PATCH 19/57] microblaze_v7: early_printk support monstr
2009-03-18 20:30 ` [PATCH 20/57] microblaze_v7: uaccess files monstr
2009-03-18 20:30 ` [PATCH 21/57] microblaze_v7: heartbeat file monstr
2009-03-18 20:30 ` [PATCH 22/57] microblaze_v7: setup.c, setup.h - system setting monstr
2009-03-18 20:30 ` [PATCH 23/57] microblaze_v7: asm-offsets monstr
2009-03-18 20:30 ` [PATCH 24/57] microblaze_v7: process and init task function monstr
2009-03-18 20:30 ` [PATCH 25/57] microblaze_v7: delay.h, timex.h monstr
2009-03-18 20:30 ` [PATCH 26/57] microblaze_v7: ptrace support monstr
2009-03-18 20:30 ` [PATCH 27/57] microblaze_v7: IPC support monstr
2009-03-18 20:30 ` [PATCH 28/57] microblaze_v7: traps support monstr
2009-03-18 20:30 ` [PATCH 29/57] microblaze_v7: memory inicialization, MMU, TLB monstr
2009-03-18 20:30 ` [PATCH 30/57] microblaze_v7: page.h, segment.h, unaligned.h monstr
2009-03-18 20:30 ` [PATCH 31/57] microblaze_v7: includes SHM*, msgbuf monstr
2009-03-18 20:30 ` [PATCH 32/57] microblaze_v7: bug headers files monstr
2009-03-18 20:31 ` [PATCH 33/57] microblaze_v7: definitions of types monstr
2009-03-18 20:31 ` [PATCH 34/57] microblaze_v7: ioctl support monstr
2009-03-18 20:31 ` [PATCH 35/57] microblaze_v7: io.h IO operations monstr
2009-03-18 20:31 ` [PATCH 36/57] microblaze_v7: headers for executables format FLAT, ELF monstr
2009-03-18 20:31 ` [PATCH 37/57] microblaze_v7: dma support monstr
2009-03-18 20:31 ` [PATCH 38/57] microblaze_v7: headers for irq monstr
2009-03-18 20:31 ` [PATCH 39/57] microblaze_v7: atomic.h bitops.h swab.h byteorder.h monstr
2009-03-18 20:31 ` [PATCH 40/57] microblaze_v7: headers pgalloc.h pgtable.h monstr
2009-03-18 20:31 ` [PATCH 41/57] microblaze_v7: system.h processor.h monstr
2009-03-18 20:31 ` [PATCH 42/57] microblaze_v7: clinkage.h linkage.h sections.h kmap_types.h monstr
2009-03-18 20:31 ` [PATCH 43/57] microblaze_v7: stats headers monstr
2009-03-18 20:31 ` [PATCH 44/57] microblaze_v7: termbits.h termios.h monstr
2009-03-23 19:37 ` Arnd Bergmann
2009-03-24 11:20 ` Michal Simek
2009-03-24 13:57 ` Arnd Bergmann
2009-03-24 14:06 ` John Williams
2009-03-24 14:44 ` Michal Simek
2009-03-18 20:31 ` [PATCH 45/57] microblaze_v7: sigcontext.h siginfo.h monstr
2009-03-18 20:31 ` [PATCH 46/57] microblaze_v7: headers simple files - empty or redirect to asm-generic monstr
2009-03-18 20:31 ` [PATCH 47/57] microblaze_v7: namei.h monstr
2009-03-18 20:31 ` [PATCH 48/57] microblaze_v7: headers files entry.h current.h mman.h registers.h sembuf.h monstr
2009-03-18 20:31 ` [PATCH 49/57] microblaze_v7: device.h param.h topology.h monstr
2009-03-18 20:31 ` [PATCH 50/57] microblaze_v7: pool.h socket.h monstr
2009-03-18 20:31 ` [PATCH 51/57] microblaze_v7: fcntl.h sockios.h ucontext.h monstr
2009-03-18 20:31 ` [PATCH 52/57] microblaze_v7: unistd.h monstr
2009-03-18 20:31 ` [PATCH 53/57] microblaze_v7: string.h thread_info.h monstr
2009-03-18 20:31 ` [PATCH 54/57] microblaze_v7: Kbuild file monstr
2009-03-18 20:31 ` [PATCH 55/57] microblaze_v7: pci headers monstr
2009-03-18 20:31 ` [PATCH 56/57] microblaze_v7: syscalls.h monstr
2009-03-18 20:31 ` [PATCH 57/57] microblaze_v7: Uartlite for Microblaze monstr
2009-03-24 16:03 ` Michal Simek
2009-03-24 16:22 ` John Williams
2009-03-24 16:47 ` Peter Korsgaard
2009-03-25 15:42 ` [PATCH 01/57] microblaze_v7: Kconfig patches Arnd Bergmann
2009-03-25 16:10 ` Michal Simek
2009-03-19 7:22 ` Microblaze linux support Ingo Molnar
2009-03-19 9:42 ` Michal Simek
2009-03-19 10:21 ` Ingo Molnar
2009-03-19 10:26 ` Michal Simek
2009-03-19 10:47 ` Jaswinder Singh Rajput
2009-03-19 11:10 ` Michal Simek
2009-03-19 10:50 ` Ingo Molnar
2009-03-19 10:52 ` Michal Simek
2009-03-19 11:00 ` Ingo Molnar
2009-03-19 11:04 ` Michal Simek
2009-03-19 20:35 ` Randy Dunlap
2009-03-19 20:41 ` Michal Simek
2009-03-24 15:26 ` Michal Simek
2009-03-24 15:33 ` John Linn
2009-03-24 15:42 ` Michal Simek
2009-03-24 17:46 ` [microblaze-uclinux] " Stephen Neuendorffer
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=49C2AB09.9040300@monstr.eu \
--to=monstr@monstr.eu \
--cc=john.williams@petalogix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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