1. 15 6月, 2009 1 次提交
  2. 13 6月, 2009 13 次提交
  3. 12 6月, 2009 15 次提交
    • M
      lguest: add support for indirect ring entries · d1f0132e
      Mark McLoughlin 提交于
      Support the VIRTIO_RING_F_INDIRECT_DESC feature.
      
      This is a simple matter of changing the descriptor walking
      code to operate on a struct vring_desc* and supplying it
      with an indirect table if detected.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      d1f0132e
    • R
      lguest: suppress notifications in example Launcher · b60da13f
      Rusty Russell 提交于
      The Guest only really needs to tell us about activity when we're going
      to listen to the eventfd: normally, we don't want to know.
      
      So if there are no available buffers, turn on notifications, re-check,
      then wait for the Guest to notify us via the eventfd, then turn
      notifications off again.
      
      There's enough else going on that the differences are in the noise.
      
      Before:				Secs	RxKicks	TxKicks
       1G TCP Guest->Host:		3.94	  4686	  32815
       1M normal pings:		104	142862	1000010
       1M 1k pings (-l 120):		57	142026	1000007
      
      After:
       1G TCP Guest->Host:		3.76	  4691	  32811
       1M normal pings:		111	142859	 997467
       1M 1k pings (-l 120):		55	 19648	 501549
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      b60da13f
    • R
      lguest: try to batch interrupts on network receive · 4a8962e2
      Rusty Russell 提交于
      Rather than triggering an interrupt every time, we only trigger an
      interrupt when there are no more incoming packets (or the recv queue
      is full).
      
      However, the overhead of doing the select to figure this out is
      measurable: 1M pings goes from 98 to 104 seconds, and 1G Guest->Host
      TCP goes from 3.69 to 3.94 seconds.  It's close to the noise though.
      
      I tested various timeouts, including reducing it as the number of
      pending packets increased, timing a 1 gigabyte TCP send from Guest ->
      Host and Host -> Guest (GSO disabled, to increase packet rate).
      
      // time tcpblast -o -s 65536 -c 16k 192.168.2.1:9999 > /dev/null
      
      Timeout		Guest->Host	Pkts/irq	Host->Guest	Pkts/irq
      Before		11.3s		1.0		6.3s		1.0
      0		11.7s		1.0		6.6s		23.5
      1		17.1s		8.8		8.6s		26.0
      1/pending	13.4s		1.9		6.6s		23.8
      2/pending	13.6s		2.8		6.6s		24.1
      5/pending	14.1s		5.0		6.6s		24.4
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      4a8962e2
    • R
      lguest: avoid sending interrupts to Guest when no activity occurs. · 95c517c0
      Rusty Russell 提交于
      If we track how many buffers we've used, we can tell whether we really
      need to interrupt the Guest.  This happens as a side effect of
      spurious notifications.
      
      Spurious notifications happen because it can take a while before the
      Host thread wakes up and sets the VRING_USED_F_NO_NOTIFY flag, and
      meanwhile the Guest can more notifications.
      
      A real fix would be to use wake counts, rather than a suppression
      flag, but the practical difference is generally in the noise: the
      interrupt is usually coalesced into a pending one anyway so we just
      save a system call which isn't clearly measurable.
      
      				Secs	Spurious IRQS
      1G TCP Guest->Host:		3.93	58
      1M normal pings:		100	72
      1M 1k pings (-l 120):		57	492904
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      95c517c0
    • R
      lguest: implement deferred interrupts in example Launcher · 38bc2b8c
      Rusty Russell 提交于
      Rather than sending an interrupt on every buffer, we only send an interrupt
      when we're about to wait for the Guest to send us a new one.  The console
      input and network input still send interrupts manually, but the block device,
      network and console output queues can simply rely on this logic to send
      interrupts to the Guest at the right time.
      
      The patch is cluttered by moving trigger_irq() higher in the code.
      
      In practice, two factors make this optimization less interesting:
      (1) we often only get one input at a time, even for networking,
      (2) triggering an interrupt rapidly tends to get coalesced anyway.
      
      Before:				Secs	RxIRQS	TxIRQs
       1G TCP Guest->Host:		3.72	32784	32771
       1M normal pings:		99	1000004	995541
       100,000 1k pings (-l 120):	5	49510	49058
      
      After:
       1G TCP Guest->Host:		3.69	32809	32769
       1M normal pings:		99	1000004	996196
       100,000 1k pings (-l 120):	5	52435	52361
      
      (Note the interrupt count on 100k pings goes *up*: see next patch).
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      38bc2b8c
    • R
      lguest: have example Launcher service all devices in separate threads · 659a0e66
      Rusty Russell 提交于
      Currently lguest has three threads: the main Launcher thread, a Waker
      thread, and a thread for the block device (because synchronous block
      was simply too painful to bear).
      
      The Waker selects() on all the input file descriptors (eg. stdin, net
      devices, pipe to the block thread) and when one becomes readable it calls
      into the kernel to kick the Launcher thread out into userspace, which
      repeats the poll, services the device(s), and then tells the kernel to
      release the Waker before re-entering the kernel to run the Guest.
      
      Also, to make a slightly-decent network transmit routine, the Launcher
      would suppress further network interrupts while it set a timer: that
      signal handler would write to a pipe, which would rouse the Waker
      which would prod the Launcher out of the kernel to check the network
      device again.
      
      Now we can convert all our virtqueues to separate threads: each one has
      a separate eventfd for when the Guest pokes the device, and can trigger
      interrupts in the Guest directly.
      
      The linecount shows how much this simplifies, but to really bring it
      home, here's an strace analysis of single Guest->Host ping before:
      
      * Guest sends packet, notifies xmit vq, return control to Launcher
      * Launcher clears notification flag on xmit ring
      * Launcher writes packet to TUN device
      	writev(4, [{"\0\0\0\0\0\0\0\0\0\0", 10}, {"\366\r\224`\2058\272m\224vf\274\10\0E\0\0T\0\0@\0@\1\265"..., 98}], 2) = 108
      * Launcher sets up interrupt for Guest (xmit ring is empty)
      	write(10, "\2\0\0\0\3\0\0\0", 8) = 0
      * Launcher sets up timer for interrupt mitigation
      	setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 505}}, NULL) = 0
      * Launcher re-runs guest
      	pread64(10, 0xbfa5f4d4, 4, 0) ...
      * Waker notices reply packet in tun device (it was in select)
      	select(12, [0 3 4 6 11], NULL, NULL, NULL) = 1 (in [4])
      * Waker kicks Launcher out of guest:
      	pwrite64(10, "\3\0\0\0\1\0\0\0", 8, 0) = 0
      * Launcher returns from running guest:
      	... = -1 EAGAIN (Resource temporarily unavailable)
      * Launcher looks at input fds:
      	select(7, [0 3 4 6], NULL, NULL, {0, 0}) = 1 (in [4], left {0, 0})
      * Launcher reads pong from tun device:
      	readv(4, [{"\0\0\0\0\0\0\0\0\0\0", 10}, {"\272m\224vf\274\366\r\224`\2058\10\0E\0\0T\364\26\0\0@"..., 1518}], 2) = 108
      * Launcher injects guest notification:
      	write(10, "\2\0\0\0\2\0\0\0", 8) = 0
      * Launcher rechecks fds:
      	select(7, [0 3 4 6], NULL, NULL, {0, 0}) = 0 (Timeout)
      * Launcher clears Waker:
      	pwrite64(10, "\3\0\0\0\0\0\0\0", 8, 0) = 0
      * Launcher reruns Guest:
      	pread64(10, 0xbfa5f4d4, 4, 0) = ? ERESTARTSYS (To be restarted)
      * Signal comes in, uses pipe to wake up Launcher:
      	--- SIGALRM (Alarm clock) @ 0 (0) ---
      	write(8, "\0", 1)       = 1
      	sigreturn()             = ? (mask now [])
      * Waker sees write on pipe:
      	select(12, [0 3 4 6 11], NULL, NULL, NULL) = 1 (in [6])
      * Waker kicks Launcher out of Guest:
      	pwrite64(10, "\3\0\0\0\1\0\0\0", 8, 0) = 0
      * Launcher exits from kernel:
      	pread64(10, 0xbfa5f4d4, 4, 0) = -1 EAGAIN (Resource temporarily unavailable)
      * Launcher looks to see what fd woke it:
      	select(7, [0 3 4 6], NULL, NULL, {0, 0}) = 1 (in [6], left {0, 0})
      * Launcher reads timeout fd, sets notification flag on xmit ring
      	read(6, "\0", 32)       = 1
      * Launcher rechecks fds:
      	select(7, [0 3 4 6], NULL, NULL, {0, 0}) = 0 (Timeout)
      * Launcher clears Waker:
      	pwrite64(10, "\3\0\0\0\0\0\0\0", 8, 0) = 0
      * Launcher resumes Guest:
      	pread64(10, "\0p\0\4", 4, 0) ....
      
      strace analysis of single Guest->Host ping after:
      
      * Guest sends packet, notifies xmit vq, creates event on eventfd.
      * Network xmit thread wakes from read on eventfd:
      	read(7, "\1\0\0\0\0\0\0\0", 8)          = 8
      * Network xmit thread writes packet to TUN device
      	writev(4, [{"\0\0\0\0\0\0\0\0\0\0", 10}, {"J\217\232FI\37j\27\375\276\0\304\10\0E\0\0T\0\0@\0@\1\265"..., 98}], 2) = 108
      * Network recv thread wakes up from read on tunfd:
      	readv(4, [{"\0\0\0\0\0\0\0\0\0\0", 10}, {"j\27\375\276\0\304J\217\232FI\37\10\0E\0\0TiO\0\0@\1\214"..., 1518}], 2) = 108
      * Network recv thread sets up interrupt for the Guest
      	write(6, "\2\0\0\0\2\0\0\0", 8) = 0
      * Network recv thread goes back to reading tunfd
      	13:39:42.460285 readv(4,  <unfinished ...>
      * Network xmit thread sets up interrupt for Guest (xmit ring is empty)
      	write(6, "\2\0\0\0\3\0\0\0", 8) = 0
      * Network xmit thread goes back to reading from eventfd
      	read(7, <unfinished ...>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      659a0e66
    • M
      lguest: PAE support · acdd0b62
      Matias Zabaljauregui 提交于
      This version requires that host and guest have the same PAE status.
      NX cap is not offered to the guest, yet.
      Signed-off-by: NMatias Zabaljauregui <zabaljauregui@gmail.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      acdd0b62
    • R
      lguest: fix writev returning short on console output · 7b5c806c
      Rusty Russell 提交于
      I've never seen it here, but I can't find anywhere that says writev
      will write everything.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      7b5c806c
    • R
      lguest: clean up length-used value in example launcher · e606490c
      Rusty Russell 提交于
      The "len" field in the used ring for virtio indicates the number of
      bytes *written* to the buffer.  This means the guest doesn't have to
      zero the buffers in advance as it always knows the used length.
      
      Erroneously, the console and network example code puts the length
      *read* into that field.  The guest ignores it, but it's wrong.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      e606490c
    • R
      lguest: clean up example launcher compile flags. · 2644f17d
      Rusty Russell 提交于
      18 months ago 5bbf89fc changed to loading
      bzImages directly, and no longer manually ungzipping them, so we no longer
      need libz.
      
      Also, -m32 is useful for those on 64-bit platforms (and harmless on
      32-bit).
      Reported-by: NRon Minnich <rminnich@gmail.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      2644f17d
    • R
      lguest: remove invalid interrupt forcing logic. · ebf9a5a9
      Rusty Russell 提交于
      20887611 (lguest: notify on empty) introduced
      lguest support for the VIRTIO_F_NOTIFY_ON_EMPTY flag, but in fact it turned on
      interrupts all the time.
      
      Because we always process one buffer at a time, the inflight count is always 0
      when call trigger_irq and so we always ignore VRING_AVAIL_F_NO_INTERRUPT from
      the Guest.
      
      It should be looking to see if there are more buffers in the Guest's queue:
      if it's empty, then we force an interrupt.
      
      This makes little difference, since we usually have an empty queue; but
      that's the subject of another patch.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      ebf9a5a9
    • R
      lguest: get more serious about wmb() in example Launcher code · f7027c63
      Rusty Russell 提交于
      Since the Launcher process runs the Guest, it doesn't have to be very
      serious about its barriers: the Guest isn't running while we are (Guest
      is UP).
      
      Before we change to use threads to service devices, we need to fix this.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      f7027c63
    • R
      lguest: cleanup passing of /dev/lguest fd around example launcher. · 56739c80
      Rusty Russell 提交于
      We hand the /dev/lguest fd everywhere; it's far neater to just make it
      a global (it already is, in fact, hidden in the waker_fds struct).
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      56739c80
    • R
      lguest: be paranoid about guest playing with device descriptors. · 713b15b3
      Rusty Russell 提交于
      We can't trust the values in the device descriptor table once the
      guest has booted, so keep local copies.  They could set them to
      strange values then cause us to segv (they're 8 bit values, so they
      can't make our pointers go too wild).
      
      This becomes more important with the following patches which read them.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      713b15b3
    • C
      kmemleak: Add documentation on the memory leak detector · 04f70336
      Catalin Marinas 提交于
      This patch adds the Documentation/kmemleak.txt file with some
      information about how kmemleak works.
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      04f70336
  4. 11 6月, 2009 3 次提交
  5. 10 6月, 2009 2 次提交
  6. 08 6月, 2009 1 次提交
  7. 07 6月, 2009 5 次提交
    • B
      ide: preserve Host Protected Area by default (v2) · 075affcb
      Bartlomiej Zolnierkiewicz 提交于
      From the perspective of most users of recent systems, disabling Host
      Protected Area (HPA) can break vendor RAID formats, GPT partitions and
      risks corrupting firmware or overwriting vendor system recovery tools.
      
      Unfortunately the original (kernels < 2.6.30) behavior (unconditionally
      disabling HPA and using full disk capacity) was introduced at the time
      when the main use of HPA was to make the drive look small enough for the
      BIOS to allow the system to boot with large capacity drives.
      
      Thus to allow the maximum compatibility with the existing setups (using
      HPA and partitioned with HPA disabled) we automically disable HPA if
      any partitions overlapping HPA are detected.  Additionally HPA can also
      be disabled using the "nohpa" module parameter (i.e. "ide_core.nohpa=0.0"
      to disable HPA on /dev/hda).
      
      v2:
      Fix ->resume HPA support.
      
      While at it:
      - remove stale "idebus=" entry from Documentation/kernel-parameters.txt
      
      Cc: Robert Hancock <hancockrwd@gmail.com>
      Cc: Frans Pop <elendil@planet.nl>
      Cc: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      [patch description was based on input from Alan Cox and Frans Pop]
      Emphatically-Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      075affcb
    • I
      perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ · 86470930
      Ingo Molnar 提交于
      Several people have suggested that 'perf' has become a full-fledged
      tool that should be moved out of Documentation/. Move it to the
      (new) tools/ directory.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      86470930
    • I
      perf_counter tools: Add 'perf annotate' feature · 0b73da3f
      Ingo Molnar 提交于
      Add new perf sub-command to display annotated source code:
      
       $ perf annotate decode_tree_entry
      
      ------------------------------------------------
       Percent |	Source code & Disassembly of /home/mingo/git/git
      ------------------------------------------------
               :
               :	/home/mingo/git/git:     file format elf64-x86-64
               :
               :
               :	Disassembly of section .text:
               :
               :	00000000004a0da0 <decode_tree_entry>:
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          3.82 :	  4a0da0:	41 54                	push   %r12
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.17 :	  4a0da2:	48 83 fa 17          	cmp    $0x17,%rdx
               :		*modep = mode;
               :		return str;
               :	}
               :
               :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
               :	{
          0.00 :	  4a0da6:	49 89 fc             	mov    %rdi,%r12
          0.00 :	  4a0da9:	55                   	push   %rbp
          3.37 :	  4a0daa:	53                   	push   %rbx
               :		const char *path;
               :		unsigned int mode, len;
               :
               :		if (size < 24 || buf[size - 21])
          0.08 :	  4a0dab:	76 73                	jbe    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dad:	80 7c 16 eb 00       	cmpb   $0x0,-0x15(%rsi,%rdx,1)
          3.48 :	  4a0db2:	75 6c                	jne    4a0e20 <decode_tree_entry+0x80>
               :	static const char *get_mode(const char *str, unsigned int *modep)
               :	{
               :		unsigned char c;
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
          1.94 :	  4a0db4:	0f b6 06             	movzbl (%rsi),%eax
          0.39 :	  4a0db7:	3c 20                	cmp    $0x20,%al
          0.00 :	  4a0db9:	74 65                	je     4a0e20 <decode_tree_entry+0x80>
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.06 :	  4a0dbb:	89 c2                	mov    %eax,%edx
               :			if (c < '0' || c > '7')
          1.99 :	  4a0dbd:	31 ed                	xor    %ebp,%ebp
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          1.74 :	  4a0dbf:	48 8d 5e 01          	lea    0x1(%rsi),%rbx
               :			if (c < '0' || c > '7')
          0.00 :	  4a0dc3:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.17 :	  4a0dc6:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dc8:	76 0d                	jbe    4a0dd7 <decode_tree_entry+0x37>
          0.00 :	  4a0dca:	eb 54                	jmp    4a0e20 <decode_tree_entry+0x80>
          0.00 :	  4a0dcc:	0f 1f 40 00          	nopl   0x0(%rax)
         16.57 :	  4a0dd0:	8d 42 d0             	lea    -0x30(%rdx),%eax
          0.14 :	  4a0dd3:	3c 07                	cmp    $0x7,%al
          0.00 :	  4a0dd5:	77 49                	ja     4a0e20 <decode_tree_entry+0x80>
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
          3.12 :	  4a0dd7:	0f b6 c2             	movzbl %dl,%eax
               :		unsigned int mode = 0;
               :
               :		if (*str == ' ')
               :			return NULL;
               :
               :		while ((c = *str++) != ' ') {
          0.00 :	  4a0dda:	0f b6 13             	movzbl (%rbx),%edx
         16.74 :	  4a0ddd:	48 83 c3 01          	add    $0x1,%rbx
               :			if (c < '0' || c > '7')
               :				return NULL;
               :			mode = (mode << 3) + (c - '0');
      
      The first column is the percentage of samples that arrived on that
      particular line - relative to the total cost of the function.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0b73da3f
    • I
      perf_counter tools: Prepare for 'perf annotate' · 8035e428
      Ingo Molnar 提交于
      Prepare for the 'perf annotate' implementation by splitting off
      builtin-annotate.c from builtin-report.c.
      
      ( We keep this commit separate to ease the later librarization
        of the facilities that perf-report and perf-annotate shares. )
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8035e428
    • J
      Document the debugfs API · f89d7eaf
      Jonathan Corbet 提交于
      This is an updated document covering the internal API for the debugfs
      filesystem.  Thanks to Shen Feng for suggesting that I put this text here
      and noting that the old LWN version was rather out of date.
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Reported-by: NShen Feng <shen@cn.fujitsu.com>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      f89d7eaf