qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: Luigi Rizzo <rizzo@iet.unipi.it>
Cc: Juergen Lock <nox@jelal.kn-bremen.de>,
	Avi Kivity <avi@qumranet.com>,
	qemu-devel@nongnu.org, freebsd-current@freebsd.org,
	Jan Kiszka <jan.kiszka@web.de>,
	Mohammed Gamal <m.gamal005@gmail.com>
Subject: Re: FreeBSD timing issues and qemu (was: Re: [Qemu-devel] Re: Breakage with local APIC routing)
Date: Fri, 11 Sep 2009 13:01:54 -0400	[thread overview]
Message-ID: <200909111301.55692.jhb@freebsd.org> (raw)
In-Reply-To: <20090911170317.GA33232@onelab2.iet.unipi.it>

On Friday 11 September 2009 1:03:17 pm Luigi Rizzo wrote:
> On Fri, Sep 11, 2009 at 11:22:59AM -0400, John Baldwin wrote:
> > On Thursday 10 September 2009 3:08:00 pm Luigi Rizzo wrote:
> ...
> > > > Index: sys/kern/kern_timeout.c
> > > > @@ -323,7 +323,7 @@ softclock(void *arg)
> > > >  	steps = 0;
> > > >  	cc = (struct callout_cpu *)arg;
> > > >  	CC_LOCK(cc);
> > > > -	while (cc->cc_softticks != ticks) {
> > > > +	while (cc->cc_softticks-1 != ticks) {
> > > >  		/*
> > > >  		 * cc_softticks may be modified by hard clock, so cache
> > > >  		 * it while we work on a given bucket.
> > > > 
> > > 
> > > as mentioned in the followup message in that thread,
> > > you also need this change in callout_tick()
> > > 
> > >         mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET);
> > >      -  for (; (cc->cc_softticks - ticks) < 0; cc->cc_softticks++) {
> > >      +  for (; (cc->cc_softticks - ticks) <= 0; cc->cc_softticks++) {
> > >                 bucket = cc->cc_softticks & callwheelmask;
> > 
> > I would fix the style in the first hunk (spaces around '-') but I think 
you 
> > should commit this and get it into 8.0.  I think a per-CPU ticks might 
prove 
> > very problematic as 'ticks' is rather widely used (though I would find 
that 
> > cleaner perhaps).
> 
> i will ask permission to re -- i was hoping to get some feedback
> on the thread on -current but no response so far :(
> 
> Note that the per-cpu ticks i was proposing were only visible to the
> timing wheels, which don't use absolute timeouts anyways.
> So i think the mechanism would be quite safe: right now, when you
> request a callout after x ticks, the code first picks a CPU
> (with some criteria), then puts the request in the timer wheel for
> that CPU using (now) the global 'ticks'. Replacing ticks with cc->cc_ticks,
> would completely remove the races in insertion and removal.
> 
> I actually find the per-cpu ticks even less intrusive than this change.

Well, it depends.  If TCP ever started using per-CPU callouts (i.e. 
callout_reset_on()) it would probably need to start using the per-CPU ticks 
instead of the global ticks, etc.  You could have 'ticks' just be == to CPU 
0's ticks perhaps.

-- 
John Baldwin

  reply	other threads:[~2009-09-11 19:14 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 14:28 [Qemu-devel] Breakage with local APIC routing Johannes Schindelin
2008-08-13  8:14 ` [Qemu-devel] " Jan Kiszka
2008-08-13  9:08   ` Jan Kiszka
2008-08-17 15:00     ` Johannes Schindelin
2008-08-17 15:28   ` Johannes Schindelin
2008-08-17 16:52     ` Jan Kiszka
2009-08-13 16:21       ` Johannes Schindelin
2009-08-25  6:56         ` Jan Kiszka
2009-08-25  8:24           ` Mohammed Gamal
2009-08-25  8:59             ` Jan Kiszka
2009-08-25  9:09               ` Mohammed Gamal
2009-08-25  9:33                 ` Jan Kiszka
2009-08-25 10:16                   ` Mohammed Gamal
2009-08-25 10:21                     ` Mohammed Gamal
2009-08-25 10:38                       ` Jan Kiszka
2009-08-26 22:10                         ` Juergen Lock
2009-08-27 17:56                           ` Jan Kiszka
2009-08-29 21:18                             ` Juergen Lock
2009-08-31  7:47                               ` Jan Kiszka
2009-08-31 21:27                                 ` Juergen Lock
2009-09-01 20:12                                   ` Juergen Lock
2009-09-07 20:59                                     ` FreeBSD timing issues and qemu (was: Re: [Qemu-devel] Re: Breakage with local APIC routing) Juergen Lock
2009-09-08  2:17                                       ` Ryan Stone
2009-09-09 20:15                                         ` Juergen Lock
2009-09-09 20:39                                           ` Ryan Stone
2009-09-09 20:46                                       ` Luigi Rizzo
2009-09-10 17:46                                         ` Juergen Lock
2009-09-10 19:08                                           ` Luigi Rizzo
2009-09-10 20:44                                             ` Juergen Lock
2009-09-11 15:22                                             ` John Baldwin
2009-09-11 17:03                                               ` Luigi Rizzo
2009-09-11 17:01                                                 ` John Baldwin [this message]
2009-09-12 15:48                                                   ` Luigi Rizzo
2009-08-25 11:48           ` [Qemu-devel] Re: Breakage with local APIC routing Johannes Schindelin
2009-08-25 12:31             ` Jan Kiszka
2009-08-25 13:36               ` Johannes Schindelin
2009-08-26  7:31                 ` Jan Kiszka
2009-08-26  9:27                   ` Avi Kivity
2009-08-27 18:07                 ` Jan Kiszka
2008-08-17 17:32 ` [Qemu-devel] " Stefan Weil
2008-08-17 18:58   ` [Qemu-devel] " Jan Kiszka
2008-08-17 20:40     ` Stefan Weil
2008-08-17 20:23   ` [Qemu-devel] " Aurelien Jarno
2008-08-17 21:10     ` Stefan Weil
2008-08-18 14:27       ` Anthony Liguori
2008-08-17 21:14     ` [Qemu-devel] " Jan Kiszka

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=200909111301.55692.jhb@freebsd.org \
    --to=jhb@freebsd.org \
    --cc=avi@qumranet.com \
    --cc=freebsd-current@freebsd.org \
    --cc=jan.kiszka@web.de \
    --cc=m.gamal005@gmail.com \
    --cc=nox@jelal.kn-bremen.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rizzo@iet.unipi.it \
    /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;
as well as URLs for NNTP newsgroup(s).