All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation
@ 2007-07-31 18:05 Jan Kiszka
  2007-07-31 18:17 ` Jan Kiszka
  2007-07-31 18:29 ` Philippe Gerum
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kiszka @ 2007-07-31 18:05 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai-core

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

Oh my dear. The ground may open and swallow me. This crappy piece of
optimisation in xnintr_edge_shirq_handler() I introduced both to 2.4 and
(sadly) the 2.3.x stable series cannot work. It must stay as it used to:

--- ksrc/nucleus/intr.c	(revision 2871)
+++ ksrc/nucleus/intr.c	(working copy)
@@ -296,15 +296,15 @@ static void xnintr_edge_shirq_handler(un
 		s |= ret;

 		if (code == XN_ISR_HANDLED) {
-			if (!(end = (intr->next)))
-				end = shirq->handlers;
+			end = NULL;
 			xnstat_counter_inc(
 				&intr->stat[xnsched_cpu(sched)].hits);
 			xnstat_runtime_lazy_switch(sched,
 				&intr->stat[xnsched_cpu(sched)].account,
 				start);
 			start = xnstat_runtime_now();
-		}
+		} else if (code == XN_ISR_NONE && end == NULL)
+			end = intr;

 		if (counter++ > MAX_EDGEIRQ_COUNTER)
 			break;
(that's for 2.3.x)

Once "end" is moved forward to the next handler in the chain, the loop
termination condition "intr==end" will trigger on the immediately
following round, even if there are still events pending. Utterly broken.

Philippe, please quickly apply -- and don't tell anyone who did this.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation
  2007-07-31 18:05 [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation Jan Kiszka
@ 2007-07-31 18:17 ` Jan Kiszka
  2007-07-31 18:29   ` Philippe Gerum
  2007-07-31 18:29 ` Philippe Gerum
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2007-07-31 18:17 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai-core

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

Jan Kiszka wrote:
> Oh my dear. The ground may open and swallow me. This crappy piece of
> optimisation in xnintr_edge_shirq_handler() I introduced both to 2.4 and
> (sadly) the 2.3.x stable series cannot work. It must stay as it used to:
> 
> --- ksrc/nucleus/intr.c	(revision 2871)
> +++ ksrc/nucleus/intr.c	(working copy)
> @@ -296,15 +296,15 @@ static void xnintr_edge_shirq_handler(un
>  		s |= ret;
> 
>  		if (code == XN_ISR_HANDLED) {
> -			if (!(end = (intr->next)))
> -				end = shirq->handlers;
> +			end = NULL;
>  			xnstat_counter_inc(
>  				&intr->stat[xnsched_cpu(sched)].hits);
>  			xnstat_runtime_lazy_switch(sched,
>  				&intr->stat[xnsched_cpu(sched)].account,
>  				start);
>  			start = xnstat_runtime_now();
> -		}
> +		} else if (code == XN_ISR_NONE && end == NULL)
> +			end = intr;
> 
>  		if (counter++ > MAX_EDGEIRQ_COUNTER)
>  			break;
> (that's for 2.3.x)

For 2.4, one may consider to assume now that "code != XN_ISR_HANDLE =>
code == XN_ISR_NONE":

--- ksrc/nucleus/intr.c	(revision 2871)
+++ ksrc/nucleus/intr.c	(working copy)
@@ -251,15 +251,15 @@ static void xnintr_edge_shirq_handler(un
 		s |= ret;

 		if (code == XN_ISR_HANDLED) {
-			if (!(end = (intr->next)))
-				end = shirq->handlers;
+			end = NULL;
 			xnstat_counter_inc(
 				&intr->stat[xnsched_cpu(sched)].hits);
 			xnstat_exectime_lazy_switch(sched,
 				&intr->stat[xnsched_cpu(sched)].account,
 				start);
 			start = xnstat_exectime_now();
-		}
+		} else if (end == NULL)
+			end = intr;

 		if (counter++ > MAX_EDGEIRQ_COUNTER)
 			break;

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation
  2007-07-31 18:05 [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation Jan Kiszka
  2007-07-31 18:17 ` Jan Kiszka
@ 2007-07-31 18:29 ` Philippe Gerum
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2007-07-31 18:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

On Tue, 2007-07-31 at 20:05 +0200, Jan Kiszka wrote:
> Oh my dear. The ground may open and swallow me. This crappy piece of
> optimisation in xnintr_edge_shirq_handler() I introduced both to 2.4 and
> (sadly) the 2.3.x stable series cannot work. It must stay as it used to:
> 
> --- ksrc/nucleus/intr.c	(revision 2871)
> +++ ksrc/nucleus/intr.c	(working copy)
> @@ -296,15 +296,15 @@ static void xnintr_edge_shirq_handler(un
>  		s |= ret;
> 
>  		if (code == XN_ISR_HANDLED) {
> -			if (!(end = (intr->next)))
> -				end = shirq->handlers;
> +			end = NULL;
>  			xnstat_counter_inc(
>  				&intr->stat[xnsched_cpu(sched)].hits);
>  			xnstat_runtime_lazy_switch(sched,
>  				&intr->stat[xnsched_cpu(sched)].account,
>  				start);
>  			start = xnstat_runtime_now();
> -		}
> +		} else if (code == XN_ISR_NONE && end == NULL)
> +			end = intr;
> 
>  		if (counter++ > MAX_EDGEIRQ_COUNTER)
>  			break;
> (that's for 2.3.x)
> 
> Once "end" is moved forward to the next handler in the chain, the loop
> termination condition "intr==end" will trigger on the immediately
> following round, even if there are still events pending. Utterly broken.
> 
> Philippe, please quickly apply -- and don't tell anyone who did this.
> 

No problem. Nobody will know, outside of the Internet, that is.

> Jan
> 
-- 
Philippe.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation
  2007-07-31 18:17 ` Jan Kiszka
@ 2007-07-31 18:29   ` Philippe Gerum
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2007-07-31 18:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

On Tue, 2007-07-31 at 20:17 +0200, Jan Kiszka wrote:
> Jan Kiszka wrote:
> > Oh my dear. The ground may open and swallow me. This crappy piece of
> > optimisation in xnintr_edge_shirq_handler() I introduced both to 2.4 and
> > (sadly) the 2.3.x stable series cannot work. It must stay as it used to:
> > 
> > --- ksrc/nucleus/intr.c	(revision 2871)
> > +++ ksrc/nucleus/intr.c	(working copy)
> > @@ -296,15 +296,15 @@ static void xnintr_edge_shirq_handler(un
> >  		s |= ret;
> > 
> >  		if (code == XN_ISR_HANDLED) {
> > -			if (!(end = (intr->next)))
> > -				end = shirq->handlers;
> > +			end = NULL;
> >  			xnstat_counter_inc(
> >  				&intr->stat[xnsched_cpu(sched)].hits);
> >  			xnstat_runtime_lazy_switch(sched,
> >  				&intr->stat[xnsched_cpu(sched)].account,
> >  				start);
> >  			start = xnstat_runtime_now();
> > -		}
> > +		} else if (code == XN_ISR_NONE && end == NULL)
> > +			end = intr;
> > 
> >  		if (counter++ > MAX_EDGEIRQ_COUNTER)
> >  			break;
> > (that's for 2.3.x)
> 
> For 2.4, one may consider to assume now that "code != XN_ISR_HANDLE =>
> code == XN_ISR_NONE":
> 

Merged, thanks.

> --- ksrc/nucleus/intr.c	(revision 2871)
> +++ ksrc/nucleus/intr.c	(working copy)
> @@ -251,15 +251,15 @@ static void xnintr_edge_shirq_handler(un
>  		s |= ret;
> 
>  		if (code == XN_ISR_HANDLED) {
> -			if (!(end = (intr->next)))
> -				end = shirq->handlers;
> +			end = NULL;
>  			xnstat_counter_inc(
>  				&intr->stat[xnsched_cpu(sched)].hits);
>  			xnstat_exectime_lazy_switch(sched,
>  				&intr->stat[xnsched_cpu(sched)].account,
>  				start);
>  			start = xnstat_exectime_now();
> -		}
> +		} else if (end == NULL)
> +			end = intr;
> 
>  		if (counter++ > MAX_EDGEIRQ_COUNTER)
>  			break;
> 
> Jan
> 
-- 
Philippe.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-31 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 18:05 [Xenomai-core] [PATCH] Revert broken edge_shirq optimisation Jan Kiszka
2007-07-31 18:17 ` Jan Kiszka
2007-07-31 18:29   ` Philippe Gerum
2007-07-31 18:29 ` Philippe Gerum

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.