All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Ed Swierk <eswierk@aristanetworks.com>
Cc: Jan Kiszka <jan.kiszka@web.de>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] slirp: Read host DNS config on demand
Date: Mon, 3 Aug 2009 14:30:08 +0100	[thread overview]
Message-ID: <20090803133008.GB23062@shareable.org> (raw)
In-Reply-To: <9ae48b020908021908v123aa866g470b78477f369594@mail.gmail.com>

Ed Swierk wrote:
> On Sun, Aug 2, 2009 at 8:03 AM, Jan Kiszka<jan.kiszka@web.de> wrote:
> > IMHO, 10 s is below the user surprise threshold for a dynamically
> > changing network link. Moreover, inotify does not exist on all platforms.
> >
> > Let's keep things simple for the first step, we could still further
> > improve it later on. 10 s are already an improvement over the current
> > infinite timeout.
> 
> Right. The most common situation in which the DNS server address
> changes is after you wake up your laptop and wait for it to connect to
> a new network. DHCP itself can take several seconds to do its thing,
> so you're unlikely to notice the up-to-10-second delay before full
> network connectivity is restored in a VM.

I strongly disagree.  Usual practice is to watch the NetworkManager
icon until it indicates that DHCP is complete with a green light,
finger poised over the clicking button, and then expect web browsing
and SSH to work immediately after the green light appears.  A 10
second delay at that point would be most irritating.

Ideally, that's what RTNETLINK events are for: you can register for
asynchronous events whenever a network interface is reconfigured, and
trigger things like rereading /etc/resolv.conf from that.  Windows has
a similar mechanism for watching interface changes.

But a 1/2 second delay would be fine.

> Of course there's nothing magical about 10 seconds. A shorter timeout
> would be even nicer, and I doubt anyone would really miss the CPU
> cycles lost to re-reading a tiny text file, but I don't think
> instantaneous response is required here.

All you need is to call stat() to confirm that the file hasn't
changed.  Just check the dev/ino/mtime/size.

If that were a periodic 1 second timer, the biggest cost on a laptop
might be power drain due to CPU wakeups.  But since the resolv.conf
check should only should be done in reaction to the VM actively doing
a DNS query (plus 1 second has passed since the last resolve.conf
check), the CPU is already woken up, so it's cheap.

-- Jamie

  reply	other threads:[~2009-08-03 13:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-01  1:10 [Qemu-devel] [PATCH] slirp: Read host DNS config on demand Ed Swierk
2009-08-02  7:43 ` Michael S. Tsirkin
2009-08-02  8:03   ` Jan Kiszka
2009-08-02  8:20     ` Michael S. Tsirkin
2009-08-03  2:08     ` Ed Swierk
2009-08-03 13:30       ` Jamie Lokier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-07-22 17:57 Ed Swierk

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=20090803133008.GB23062@shareable.org \
    --to=jamie@shareable.org \
    --cc=eswierk@aristanetworks.com \
    --cc=jan.kiszka@web.de \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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.