From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Richard Cochran <richardcochran@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] arm ixp: more trouble with recent xenomai
Date: Sun, 10 Apr 2011 13:22:08 +0200 [thread overview]
Message-ID: <4DA192E0.2090802@domain.hid> (raw)
In-Reply-To: <20110410065250.GA28869@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]
Richard Cochran wrote:
> On Sat, Apr 09, 2011 at 09:50:16PM +0200, Gilles Chanteperdrix wrote:
>>> Just to have an idea where the issue come from, could you try reverting
>>> all the changes which were made on the tsc and timer? i.e. revert to the
>>> original ipipe_mach_get_tsc and ipipe_mach_set_dec?
>>>
>> The exact commit to revert is this one:
>> http://git.xenomai.org/?p=ipipe-gch.git;a=commitdiff;h=cbd591ed5797f105ff45e04cca3bc939388624ea;hp=a2761e92ecd573bc3a3b068d4ebb7cc06313213c
>
> Okay, with cbd591ed57 reverted, it works fine even without IPIPE_DEBUG.
Sorry for the multiple answers to each mail...
To help debugging this, please run the kernel which crashes with I-pipe
enabled, without Xenomai, and the attached test, in order to see if the
tsc behaves correctly.
Also, about the performances, Xenomai 2.4 did not have the Xenomai
preemptible context switches. Maybe with FCSE, it results in reduced
latencies to disable this option in Xenomai 2.5.
--
Gilles.
[-- Attachment #2: test_tsc.c --]
[-- Type: text/x-csrc, Size: 2775 bytes --]
#include <stdio.h>
#if 0
#include <native/timer.h>
#define rdtsc() rt_timer_tsc()
#define init_tsc() do { \
} while(0)
#elif 1
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
/* Change this according to the real tsc type */
#define XNARCH_ARM_TSC_TYPE __XN_TSC_TYPE_FREERUNNING
#include <asm/xenomai/syscall.h>
struct __xn_tscinfo __xn_tscinfo = {
.type = XNARCH_ARM_TSC_TYPE,
/* Change according to real tsc */
.u = {
.fr = {
.counter = 0,
.mask = 0xffffffff,
.tsc = (unsigned long long *)(0xffff0fa0 - 0x80),
},
},
};
#define rdtsc() __xn_rdtsc()
static void init_tsc(void)
{
unsigned long phys_addr;
unsigned page_size;
void *addr;
int fd;
fd = open("/dev/mem", O_RDONLY | O_SYNC);
if (fd == -1) {
perror("Xenomai init: open(/dev/mem)");
exit(EXIT_FAILURE);
}
page_size = sysconf(_SC_PAGESIZE);
/* Counter physical address, depends on hardware */
phys_addr = 0xC8005000UL;
addr = mmap(NULL, page_size, PROT_READ, MAP_SHARED,
fd, phys_addr & ~(page_size - 1));
if (addr == MAP_FAILED) {
perror("Xenomai init: mmap(/dev/mem)");
exit(EXIT_FAILURE);
}
__xn_tscinfo.u.fr.counter =
((volatile unsigned *)
((char *) addr + (phys_addr & (page_size - 1))));
}
#else
/* The newest version */
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static unsigned long cntr_addr;
static unsigned long long (*rdtsc_inner)(unsigned long) =
(void *)(0xffff0fa0 - 0x5c);
#define rdtsc() (*rdtsc_inner)(cntr_addr)
static void init_tsc(void)
{
unsigned long phys_addr;
unsigned page_size;
void *addr;
int fd;
fd = open("/dev/mem", O_RDONLY | O_SYNC);
if (fd == -1) {
perror("Xenomai init: open(/dev/mem)");
exit(EXIT_FAILURE);
}
page_size = sysconf(_SC_PAGESIZE);
/* Counter physical address, depends on hardware */
phys_addr = 0xC8005000UL;
addr = mmap(NULL, page_size, PROT_READ, MAP_SHARED,
fd, phys_addr & ~(page_size - 1));
if (addr == MAP_FAILED) {
perror("Xenomai init: mmap(/dev/mem)");
exit(EXIT_FAILURE);
}
cntr_addr =
(unsigned long)
((char *) addr + (phys_addr & (page_size - 1)));
}
#endif
int main(void)
{
unsigned long long runtime, jump, tsc1, tsc2;
init_tsc();
runtime = tsc2 = rdtsc();
for(;;) {
tsc1 = rdtsc();
if (tsc1 <= tsc2)
break;
tsc2 = rdtsc();
if (tsc2 <= tsc1)
goto err2;
}
runtime = tsc2 - runtime;
jump = tsc2 - tsc1;
goto display;
err2:
runtime = tsc1 - runtime;
jump = tsc1 - tsc2;
display:
fprintf(stderr, "tsc not monotonic after %Lu.%09Lu ticks, ",
runtime / 1000000000ULL, runtime % 1000000000ULL);
fprintf(stderr, "jumped back %Lu tick\n", jump);
return 1;
}
next prev parent reply other threads:[~2011-04-10 11:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-09 18:41 [Xenomai-core] arm ixp: more trouble with recent xenomai Richard Cochran
2011-04-09 18:55 ` Richard Cochran
2011-04-09 19:37 ` Gilles Chanteperdrix
2011-04-09 19:50 ` Gilles Chanteperdrix
2011-04-10 5:22 ` Richard Cochran
2011-04-10 6:52 ` Richard Cochran
2011-04-10 9:34 ` Gilles Chanteperdrix
2011-04-11 17:14 ` Richard Cochran
2011-04-11 21:26 ` Gilles Chanteperdrix
2011-04-12 5:43 ` Richard Cochran
2011-04-12 7:17 ` Gilles Chanteperdrix
2011-04-12 9:42 ` Richard Cochran
2011-04-12 10:00 ` Gilles Chanteperdrix
2011-04-14 16:49 ` Richard Cochran
2011-04-15 13:18 ` Gilles Chanteperdrix
2011-04-10 11:22 ` Gilles Chanteperdrix [this message]
2011-04-11 5:53 ` Richard Cochran
2011-04-11 7:24 ` Gilles Chanteperdrix
2011-04-14 16:42 ` Richard Cochran
2011-04-15 13:24 ` Gilles Chanteperdrix
2011-04-22 5:55 ` Gilles Chanteperdrix
2011-04-22 6:16 ` Gilles Chanteperdrix
2011-04-23 14:21 ` Richard Cochran
2011-04-23 15:22 ` Gilles Chanteperdrix
2011-04-24 20:15 ` Gilles Chanteperdrix
2011-04-25 6:48 ` Richard Cochran
2011-04-25 7:29 ` Gilles Chanteperdrix
2011-04-26 11:25 ` Gilles Chanteperdrix
2011-05-12 0:03 ` Gilles Chanteperdrix
2011-05-12 17:04 ` Richard Cochran
2011-04-09 19:43 ` Gilles Chanteperdrix
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=4DA192E0.2090802@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=richardcochran@domain.hid \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.