mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Len Brown <lenb@kernel.org>, John Stultz <johnstul@us.ibm.com>,
	Andi Kleen <ak@suse.de>, Roman Zippel <zippel@linux-m68k.org>
Subject: Re: [patch 04/19] Add a framework to manage clock event devices.
Date: Fri, 10 Nov 2006 10:47:51 +0100	[thread overview]
Message-ID: <1163152071.3138.627.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <20061109233034.526217000@cruncher.tec.linutronix.de>

On Thu, 2006-11-09 at 23:38 +0000, Thomas Gleixner wrote:
> + * struct clock_event_device - clock event descriptor
> + *
> + * @name:		ptr to clock event name
> + * @capabilities:	capabilities of the event chip
> + * @max_delta_ns:	maximum delta value in ns
> + * @min_delta_ns:	minimum delta value in ns
> + * @mult:		nanosecond to cycles multiplier
> + * @shift:		nanoseconds to cycles divisor (power of two)
> + * @set_next_event:	set next event
> + * @set_mode:		set mode function
> + * @suspend:		suspend function (optional)
> + * @resume:		resume function (optional)
> + * @evthandler:		Assigned by the framework to be called by the low
> + *			level handler of the event source
> + */

it would be nice if the datastructure was "pure"; eg entirely owned by
the source (and could be made const), however the only way I can see
that done is by having a private duplicate datastructure in each clock
driver... which is way overkill for one single function pointer ;(


well you could do

struct clock_event_device 
{
	const struct clock_ops *ops;
	void *instance;
	evthndlr_t *evthandler;
}

that way if you have, say, 3 hpet channels you can use the same
"ops" (or maybe "props") structure for all three, but still register the
per channel state as well..


you maybe also want to have a "costs" member, so that you can pick the
cheapest available timer..


> +struct clock_event_device {
> +	const char	*name;
> +	unsigned int	capabilities;
> +	unsigned long	max_delta_ns;
> +	unsigned long	min_delta_ns;
> +	unsigned long	mult;
> +	int		shift;
> +	void		(*set_next_event)(unsigned long evt,
> +					  struct clock_event_device *);
> +	void		(*set_mode)(enum clock_event_mode mode,
> +				    struct clock_event_device *);
> +	void		(*event_handler)(struct pt_regs *regs);

is pt_regs really really needed here? We got rid of it in most places
(and made it a per tast struct thing), I wonder if it can be made to go
away here too.


> +/*
> + * Start up an event device
> + */
> +static void startup_event(struct clock_event_device *evt, unsigned int caps)
> +{
> +	int mode;
> +
> +	if (caps == CLOCK_CAP_NEXTEVT)

isn't caps a bitfield ? if so, shouldn't this be a & ?


> + */
> +int clockevents_set_next_event(ktime_t expires, int force)
> +{
> +	struct local_events *devices = &__get_cpu_var(local_eventdevices);
> +	struct clock_event_device *nextevt = devices->nextevt;
> +	int64_t delta = ktime_to_ns(ktime_sub(expires, ktime_get()));
> +
> +	if (delta <= 0 && !force) {
> +		devices->expires_next.tv64 = KTIME_MAX;
> +		return -ETIME;
> +	}

hmmm so if I set a timer 10 nsec in the future, and then I get an
interrupt, I suddenly get an infinite time timer? Sounds more like a
case of "please just run it right away"


> + * Resume the cpu local clock events
> + */
> +static void clockevents_resume_local_events(void *arg)
> +{
> +	struct local_events *devices = &__get_cpu_var(local_eventdevices);
> +	int i;
> +
> +	for (i = 0; i < devices->installed; i++) {
> +		if (devices->events[i].real_caps)
> +			startup_event(devices->events[i].event,
> +				      devices->events[i].real_caps);
> +	}
> +	touch_softlockup_watchdog();
> +}

what is this watchdog touching for?

> +static int clockevents_cpu_notify(struct notifier_block *self,
> +				  unsigned long action, void *hcpu)
> +{
> +	switch(action) {
> +	case CPU_UP_PREPARE:
> +		break;

don't you want to start the per cpu timer in such a case?




-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org


  reply	other threads:[~2006-11-10  9:47 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-09 23:38 [patch 00/21] Highres / dynticks drop in replacement for 2.6.19-rc5-mm1 Thomas Gleixner
2006-11-09 23:38 ` [patch 01/19] hrtimers: state tracking Thomas Gleixner
2006-11-10  9:19   ` Arjan van de Ven
2006-11-10  9:40     ` Andrew Morton
2006-11-10  9:45       ` Thomas Gleixner
2006-11-23 22:26   ` Roman Zippel
2006-11-09 23:38 ` [patch 02/19] hrtimers: clean up callback tracking Thomas Gleixner
2006-11-10  9:20   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 03/19] hrtimers: Move and add documentation Thomas Gleixner
2006-11-09 23:38 ` [patch 04/19] Add a framework to manage clock event devices Thomas Gleixner
2006-11-10  9:47   ` Arjan van de Ven [this message]
2006-11-23 22:36   ` Roman Zippel
2006-11-09 23:38 ` [patch 05/19] ACPI: Include apic.h Thomas Gleixner
2006-11-09 23:38 ` [patch 06/19] ACPI: Keep track of timer broadcast Thomas Gleixner
2006-11-10  9:51   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 07/19] ACPI: Add state propagation for dynamic broadcasting Thomas Gleixner
2006-11-10  9:52   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 08/19] i386: cleanup apic code Thomas Gleixner
2006-11-10 10:04   ` Arjan van de Ven
2006-11-10 10:16     ` Thomas Gleixner
2006-11-10 10:16       ` Arjan van de Ven
2006-11-09 23:38 ` [patch 09/19] i386: Convert to clock event devices Thomas Gleixner
2006-11-10 10:10   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 10/19] PM_timer: allow early access and move externs to a header file Thomas Gleixner
2006-11-10 10:12   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 11/19] i386: Rework local APIC calibration Thomas Gleixner
2006-11-10 10:17   ` Arjan van de Ven
2006-11-10 10:23     ` Thomas Gleixner
2006-11-10 11:10     ` Ingo Molnar
2006-11-09 23:38 ` [patch 12/19] high-res timers: core Thomas Gleixner
2006-11-10 10:26   ` Arjan van de Ven
2006-11-09 23:38 ` [patch 13/19] GTOD: Mark TSC unusable for highres timers Thomas Gleixner
2006-11-10  1:10   ` john stultz
2006-11-10  5:10     ` Andi Kleen
2006-11-10  8:10       ` Thomas Gleixner
2006-11-10  8:50         ` Andrew Morton
2006-11-10  8:57           ` Ingo Molnar
2006-11-10  9:13             ` Andrew Morton
2006-11-10  9:29               ` Andi Kleen
2006-11-11 11:14                 ` Thomas Gleixner
2006-11-11 13:51                   ` Andi Kleen
2006-11-11 13:58                     ` Thomas Gleixner
2006-11-11 13:59                       ` Andi Kleen
2006-11-11 14:08                         ` Thomas Gleixner
2006-11-10 10:35               ` Arjan van de Ven
2006-11-10 10:47                 ` Andi Kleen
2006-11-10 10:55                   ` Arjan van de Ven
2006-11-10 11:13                     ` Ingo Molnar
2006-11-10 11:28                     ` Andi Kleen
2006-11-10  9:27             ` Andi Kleen
2006-11-10 10:14             ` Alan Cox
2006-11-10 11:19               ` Ingo Molnar
2006-11-10 15:43               ` Chris Friesen
2006-11-10 11:12             ` Pavel Machek
2006-11-10 11:48               ` Ingo Molnar
2006-11-10 11:56                 ` Andi Kleen
2006-11-10 13:12                   ` Ingo Molnar
2006-11-10 12:00                 ` Pavel Machek
2006-11-10 13:14                   ` Ingo Molnar
2006-11-10 11:11         ` Pavel Machek
2006-11-10 10:28       ` Arjan van de Ven
2006-11-10 10:30         ` Andi Kleen
2006-11-10 10:37           ` Arjan van de Ven
2006-11-09 23:38 ` [patch 14/19] dynticks: core code Thomas Gleixner
2006-11-09 23:38 ` [patch 15/19] dyntick: add nohz stats to /proc/stat Thomas Gleixner
2006-11-09 23:38 ` [patch 16/19] dynticks: i386 arch code Thomas Gleixner
2006-11-09 23:38 ` [patch 17/19] dynticks: Fix nmi watchdog Thomas Gleixner
2006-11-09 23:38 ` [patch 18/19] high-res timers, dynticks: enable i386 support Thomas Gleixner
2006-11-09 23:38 ` [patch 19/19] debugging feature: timer stats Thomas Gleixner
2006-11-23 22:24 ` [patch 00/21] Highres / dynticks drop in replacement for 2.6.19-rc5-mm1 Roman Zippel

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=1163152071.3138.627.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=johnstul@us.ibm.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=zippel@linux-m68k.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

all inboxes | Powered by JetHome®