Re: [PATCH] RTC: Add mmap method to rtc character driver

Neil Horman
2006-07-25T18:22:39Z

On Tue, Jul 25, 2006 at 07:55:39PM +0200, Arjan van de Ven wrote:
> > @@ -265,6 +269,7 @@ irqreturn_t rtc_interrupt(int irq, void
> >
> > kill_fasync (&rtc_async_queue, SIGIO, POLL_IN);
> >
> > + *count_ptr = (*count_ptr)++;
>
> Hi,
>
> it's a cute idea, however 3 questions:
> 1) you probably want to add a few memory barriers around this, right?
Actually, I was curious about that. I had initially planned on using xchg to
update the counter on the mmaped page, but then it occured to me that an
unsigned long would always be an atomic update (or so I thought). Is there a
case in which userspace will read a munged value the way the code is now?

> 2) why use the rtc and not the regular timer interrupt?
>
Honestly, because it seemed to be a quick way forward. The real time clock
driver was there, and its infrastructure lent itself rather easily toward adding
this functionality. If you can elaborate on a better suggestion, I'll happily
take a crack at it.

> (and
> 3) this will negate the power gain you get for tickless kernels, since
> now they need to start ticking again ;( )
>
That is true, but only in the case where someone opens up /dev/rtc, and if they
open that driver and send it a UIE or PIE ioctl, it will start ticking
regardless of this patch (or that is at least my impression).

Regards
Neil

> Greetings,
> Arjan van de Ven
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
/***************************************************
*Neil Horman
*Software Engineer
*gpg keyid: 1024D / 0x92A74FA1 - http://pgp.mit.edu
***************************************************/