mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Con Kolivas <kernel@kolivas.org>
Cc: vatsa@in.ibm.com, linux-kernel@vger.kernel.org,
	arjan@infradead.org, s0348365@sms.ed.ac.uk, tytso@mit.edu,
	cfriesen@nortel.com, rlrevell@joe-job.com, trenn@suse.de,
	george@mvista.com, johnstul@us.ibm.com, akpm@osdl.org
Subject: Re: Updated dynamic tick patches
Date: Thu, 1 Sep 2005 16:07:22 +0300	[thread overview]
Message-ID: <20050901130721.GB10677@atomide.com> (raw)
In-Reply-To: <200509011523.13994.kernel@kolivas.org>

[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]

* Con Kolivas <kernel@kolivas.org> [050901 08:22]:
> On Thu, 1 Sep 2005 02:58 am, Srivatsa Vaddagiri wrote:
> > Following patches related to dynamic tick are posted in separate mails,
> > for convenience of review. The first patch probably applies w/o dynamic
> > tick consideration also.
> >
> > Patch 1/3  -> Fixup lost tick calculation in timer_pm.c
> > Patch 2/3  -> Dyn-tick cleanups
> > Patch 3/3  -> Use lost tick information in dyn-tick time recovery
> >
> > These patches are against 2.6.13-rc6-mm2.
> >
> > Con, would be great if you can upload a consolidated new version of
> > dyn-tick patch on your website!
> 
> Great, thanks. I'll wait till 2.6.13-mm1 is out since that's due shortly and 
> I'll resync everything with that and perhaps tweak along the way.

I tried this quickly on a loaner ThinkPad T30, and needed the following
patch to compile. The patch does work with PIT, but with lapic the
system does not wake to timer interrupts :(

I also hacked together a little timer test utility that should go trough
on a completely idle system with no errors. Also posted it to:

http://www.muru.com/linux/dyntick/tools/dyntick-test.c

Srivatsa, could you try the dyntick-test.c on your system after booting
to init=/bin/sh to make the system as idle as possible?

Unfortunately I cannot debug the APIC issue right now, but I seem to
have an issue on ARM OMAP where the timer test occasionally fails on
some longer values, for example 3 second sleep can take 4 seconds.

I don't know yet if this is the problem George Anzinger mentioned with
next_timer_interrupt(), or if this is OMAP specific. But it only seems
to occur with very low idle HZ values. This may be related to the slow
boot time issue I mentioned yesterday.

Regards,

Tony

[-- Attachment #2: patch-fix-up-compile --]
[-- Type: text/plain, Size: 257 bytes --]

--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -2034,7 +2034,9 @@
 	.disable 	= mask_IO_APIC_irq,
 	.ack 		= ack_edge_ioapic,
 	.end 		= end_edge_ioapic,
+#ifdef CONFIG_SMP
 	.set_affinity 	= set_ioapic_affinity,
+#endif
 };
 #endif
 

[-- Attachment #3: dyntick-test.c --]
[-- Type: text/x-csrc, Size: 2927 bytes --]

/*
 * Tests timers to make sure dynamic tick works properly
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>

#define MAX_SLEEP	(10)		/* seconds */
#define MAX_LATENCY	(100 * 1000)	/* usecs */

int test_sleep(unsigned int msec_len)
{
	sleep(msec_len / 1000);
	return 0;
}

int test_select(unsigned int msec_len)
{
	struct timeval tv_sel;

	tv_sel.tv_sec = msec_len / 1000;
	tv_sel.tv_usec = (msec_len % 1000) * 1000;

	return select(0, NULL, NULL, NULL, &tv_sel);
}

int test_usleep(unsigned int msec_len)
{
	usleep(msec_len * 1000);
}

/* This modified from some GNU exsample _not_ to hose y */
int timeval_subtract(struct timeval *result,
		     const struct timeval *x,
		     const struct timeval *y)
{
	struct timeval tmp;

	tmp.tv_sec = y->tv_sec;
	tmp.tv_usec = y->tv_usec;

	/* Perform the carry for the later subtraction */
	if (x->tv_usec < y->tv_usec) {
		int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
		tmp.tv_usec -= 1000000 * nsec;
		tmp.tv_sec += nsec;
	}
	if (x->tv_usec - y->tv_usec > 1000000) {
		int nsec = (x->tv_usec - y->tv_usec) / 1000000;
		tmp.tv_usec += 1000000 * nsec;
		tmp.tv_sec -= nsec;
	}
     
	/* Compute the time remaining to wait.
	   tv_usec is certainly positive. */
	result->tv_sec = x->tv_sec - tmp.tv_sec;
	result->tv_usec = x->tv_usec - tmp.tv_usec;
     
	/* Return 1 if result is negative. */
	return x->tv_sec < tmp.tv_sec;
}

int do_test(char * name, int (* test)(unsigned int len),
	    unsigned int len, int count)
{
	int i, ret;
	struct timeval tv_in;
	struct timeval tv_beg;
	struct timeval tv_end;
	struct timeval tv_len;
	struct timeval tv_lat;
	struct timezone tz;
	char * status = "OK";
	char * latency_type = "";

	tv_in.tv_sec = len / 1000;
	tv_in.tv_usec = (len % 1000) * 1000;

	gettimeofday(&tv_beg, &tz);
	for (i = 0; i < count; i++) {
		ret = test(len);
	}
	gettimeofday(&tv_end, &tz);

	ret = timeval_subtract(&tv_len, &tv_end, &tv_beg);
	if (ret)
		status = "ERROR";

	ret = timeval_subtract(&tv_lat, &tv_len, &tv_in);
	if (ret) {
		latency_type = "-";
		timeval_subtract(&tv_lat, &tv_in, &tv_len);
	}

	if (tv_lat.tv_sec > 0 || tv_lat.tv_usec > MAX_LATENCY)
		status = "ERROR";

	printf("  Test: %6s %4ums time: %2u.%06us "
	       "latency: %1s%u.%06us status: %s\n",
	       name, 
	       (len * count),
	       (unsigned int)tv_len.tv_sec,
	       (unsigned int)tv_len.tv_usec,
	       latency_type,
	       (unsigned int)tv_lat.tv_sec,
	       (unsigned int)tv_lat.tv_usec,
	       status);

	return ret;
}

int main(void)
{
	unsigned int i;
	int max_secs = MAX_SLEEP;

	printf("Testing sub-second select and usleep\n");
	for (i = 0; i < 1000; i += 100) {
		do_test("select", test_select, i, 1);
		do_test("usleep", test_usleep, i, 1);
	}

	printf("Testing multi-second select and sleep\n");
	for (i = 0; i < max_secs; i++) {
		do_test("select", test_select, i * 1000, 1);
		do_test("sleep", test_sleep, i * 1000, 1);
	}

	return 0;
}

  reply	other threads:[~2005-09-01 13:08 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-31 16:58 Srivatsa Vaddagiri
2005-08-31 17:12 ` [PATCH 1/3] Updated dynamic tick patches - Fix lost tick calculation in timer_pm.c Srivatsa Vaddagiri
2005-08-31 22:36   ` Zachary Amsden
2005-08-31 22:47     ` john stultz
2005-09-02 15:43   ` [PATCH 1/3] dynticks - implement no idle hz for x86 Con Kolivas
2005-09-02 15:45     ` [PATCH 2/3] dyntick - Fix lost tick calculation in timer pm.c Con Kolivas
2005-09-02 15:46       ` [PATCH 3/3] dyntick - Recover walltime upon wakeup Con Kolivas
2005-09-02 17:25       ` [PATCH 2/3] dyntick - Fix lost tick calculation in timer pm.c Srivatsa Vaddagiri
2005-09-02 20:18         ` Thomas Schlichter
2005-09-02 21:21           ` john stultz
2005-09-02 16:56     ` [PATCH 1/3] dynticks - implement no idle hz for x86 Russell King
2005-09-02 17:12       ` Srivatsa Vaddagiri
2005-09-03  6:13       ` Con Kolivas
2005-09-03  7:58         ` Russell King
2005-09-03  8:01           ` Con Kolivas
2005-09-03  8:06             ` Russell King
2005-09-03  8:14               ` Con Kolivas
2005-09-04 20:10                 ` Nishanth Aravamudan
2005-09-04 20:26                   ` Russell King
2005-09-04 20:37                     ` Nishanth Aravamudan
2005-09-04 21:17                       ` Russell King
2005-09-05  3:08                       ` Con Kolivas
2005-09-05 16:28                         ` Nishanth Aravamudan
2005-09-05  6:58                       ` Tony Lindgren
2005-09-05 16:30                         ` Nishanth Aravamudan
2005-09-04 20:41                     ` Nishanth Aravamudan
2005-09-05  5:32                     ` Srivatsa Vaddagiri
2005-09-05  5:48                       ` Nishanth Aravamudan
2005-09-05  6:32                         ` Srivatsa Vaddagiri
2005-09-05  6:44                           ` Nishanth Aravamudan
2005-09-06 20:51                             ` Nishanth Aravamudan
2005-09-07  8:13                               ` Tony Lindgren
2005-09-07 15:00                                 ` Nishanth Aravamudan
2005-09-07 15:53                                 ` Nishanth Aravamudan
2005-09-07 17:07                                   ` Srivatsa Vaddagiri
2005-09-07 17:23                                     ` Nishanth Aravamudan
2005-09-07 18:14                                       ` Srivatsa Vaddagiri
2005-09-07 18:22                                         ` Nishanth Aravamudan
2005-09-07 16:14                           ` Bill Davidsen
2005-09-07 16:42                             ` Nish Aravamudan
2005-09-07 17:17                               ` Srivatsa Vaddagiri
2005-09-07 17:27                                 ` Nish Aravamudan
2005-09-07 18:18                                   ` Srivatsa Vaddagiri
2005-09-07 18:33                                     ` Nish Aravamudan
2005-09-09 16:27                                 ` Bill Davidsen
2005-09-05  7:37                       ` Russell King
2005-09-05  7:49                         ` Srivatsa Vaddagiri
2005-09-05  8:00                           ` Russell King
2005-09-05 16:33                             ` Nishanth Aravamudan
2005-09-05  7:00                   ` Srivatsa Vaddagiri
2005-09-05  7:27                     ` Tony Lindgren
2005-09-05 17:02                       ` Nishanth Aravamudan
2005-09-07  7:37                         ` Tony Lindgren
2005-09-07 15:05                           ` Nishanth Aravamudan
2005-09-08 10:00                             ` Tony Lindgren
2005-09-08 21:22                               ` Nishanth Aravamudan
2005-09-08 22:08                                 ` Nishanth Aravamudan
2005-09-09 22:30                                   ` Nishanth Aravamudan
2005-09-20 11:06                                   ` Srivatsa Vaddagiri
2005-09-20 14:58                                     ` Nishanth Aravamudan
2005-09-22 13:38                                       ` Martin Schwidefsky
2005-09-22 14:52                                         ` Nishanth Aravamudan
2005-09-22 18:32                                           ` Srivatsa Vaddagiri
2005-09-26 15:08                                             ` Srivatsa Vaddagiri
2005-09-23  6:55                                         ` Srivatsa Vaddagiri
2005-09-05  7:44                     ` Russell King
2005-09-05  8:19                       ` Srivatsa Vaddagiri
2005-09-05  8:32                         ` Russell King
2005-09-05  9:24                           ` Srivatsa Vaddagiri
2005-09-05 17:06                           ` Nishanth Aravamudan
2005-09-05 17:04                       ` Nishanth Aravamudan
2005-09-05 17:27                         ` Srivatsa Vaddagiri
2005-09-05 18:06                           ` Nishanth Aravamudan
2005-09-05 13:19                     ` Srivatsa Vaddagiri
2005-09-05 16:57                     ` Nishanth Aravamudan
2005-09-05 17:25                       ` Srivatsa Vaddagiri
2005-09-05 18:11                         ` Nishanth Aravamudan
2005-09-03  4:05   ` [PATCH 1/3] Updated dynamic tick patches - Fix lost tick calculation in timer_pm.c Lee Revell
2005-09-03  4:18     ` Peter Williams
2005-09-03  4:34       ` Lee Revell
2005-09-03  4:48         ` Peter Williams
2005-09-03  5:15     ` Parag Warudkar
2005-09-03  5:30       ` Lee Revell
2005-09-03  5:20     ` Srivatsa Vaddagiri
2005-09-06 10:32     ` Pavel Machek
2005-09-06 10:46       ` Srivatsa Vaddagiri
2005-09-06 18:04     ` john stultz
2005-08-31 17:26 ` [PATCH 2/3] Updated dynamic tick patches - Cleanup Srivatsa Vaddagiri
2005-08-31 17:27 ` [PATCH 3/3] Updated dynamic tick patches - Recover walltime upon wakeup Srivatsa Vaddagiri
2005-09-01  5:23 ` Updated dynamic tick patches Con Kolivas
2005-09-01 13:07   ` Tony Lindgren [this message]
2005-09-01 13:19     ` David Weinehall
2005-09-01 13:46       ` Tony Lindgren
2005-09-01 14:11     ` Srivatsa Vaddagiri
2005-09-02 17:34     ` Srivatsa Vaddagiri
2005-09-03 10:16       ` Tony Lindgren
2005-08-31 18:49 Erik Andrén
2005-09-02  8:52 ` Srivatsa Vaddagiri

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=20050901130721.GB10677@atomide.com \
    --to=tony@atomide.com \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=cfriesen@nortel.com \
    --cc=george@mvista.com \
    --cc=johnstul@us.ibm.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlrevell@joe-job.com \
    --cc=s0348365@sms.ed.ac.uk \
    --cc=trenn@suse.de \
    --cc=tytso@mit.edu \
    --cc=vatsa@in.ibm.com \
    /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

Powered by JetHome