public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Zdenek Kabelac" <zdenek.kabelac@gmail.com>
To: "Avi Kivity" <avi@qumranet.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: loop in copy_user_generic_string
Date: Tue, 4 Mar 2008 17:39:21 +0100	[thread overview]
Message-ID: <c4e36d110803040839o7a8036e5xec7c22b89405f51b@mail.gmail.com> (raw)
In-Reply-To: <47CD73DF.6070502@qumranet.com>

2008/3/4, Avi Kivity <avi@qumranet.com>:
> Zdenek Kabelac wrote:
>  > Hello
>  >
>  >
>  > I'm having weird problem and being a bit puzzled about where to look
>  > for this bug.
>  >
>  > I'm using T61 - C2D  2GB
>  >
>  > So I'll describe symptoms:
>  >
>  > When I run inside my 0.5G smp  qemu-kvm guest with Debian these two
>  > loops in parallel:
>  >
>  > 'while : ; do dmsetup status  ; done'
>  >
>  > and
>  >
>  > 'while : ; do cat /dev/zero >/dev/mapper/any_free_to_use_lvm_partition ; done'
>  >
>  > after a while dmsetup start to loop in this place:
>  >
>
> > [  356.257323]  [<ffffffff8117c017>] ? copy_user_generic_string+0x17/0x40
>  >
>  >
>
> > I'm using preemptible kernel and the code will stay in the
>  > copy_user_generic_string call forever eating 100%cpu - without
>  > preemption the kernel gets dead.
>  >
>  > With preemption when I run at this moment second dmsetup status in
>  > paralllel the busy-looped dmsetup gets finished and while loop starts
>  > to continue agains until next dmsetup busy-loop.
>  >
>  > I've noticed that if I change inside  drivers/md/dm-ioctl.c
>  > copy_params  the parameter tmp.data_size in the copy_from_user call to
>  > just page size (4kB) - or when I replace vmalloc to kmalloc - the busy
>  > loop will not happen.
>  >
>  > So it seems to be related to page jump somehow
>  >
>  > Anyway might have any idea - what is going on here ?
>  >
>
>
> Most likely movs emulation is broken for long counts.  Please post a
>  disassembly of copy_user_generic_string to make sure we're looking at
>  the same code.
>

Is it emulated ? I've thought it's running natively with vmx?

Anyway here is  objdump of copy_user_64.o
(loops on 0x1d7)

00000000000001c0 <copy_user_generic_string>:
 1c0:	41 89 c8             	mov    %ecx,%r8d
 1c3:	89 d1                	mov    %edx,%ecx
 1c5:	c1 e9 03             	shr    $0x3,%ecx
 1c8:	83 e2 07             	and    $0x7,%edx
 1cb:	74 0a                	je     1d7 <copy_user_generic_string+0x17>
 1cd:	f3 48 a5             	rep movsq %ds:(%rsi),%es:(%rdi)
 1d0:	89 d1                	mov    %edx,%ecx
 1d2:	f3 a4                	rep movsb %ds:(%rsi),%es:(%rdi)
 1d4:	89 c8                	mov    %ecx,%eax
 1d6:	c3                   	retq
 1d7:	f3 48 a5             	rep movsq %ds:(%rsi),%es:(%rdi)
 1da:	31 c0                	xor    %eax,%eax
 1dc:	c3                   	retq
 1dd:	48 8d 04 ca          	lea    (%rdx,%rcx,8),%rax
 1e1:	eb 02                	jmp    1e5 <copy_user_generic_string+0x25>
 1e3:	89 c8                	mov    %ecx,%eax
 1e5:	45 85 c0             	test   %r8d,%r8d
 1e8:	74 08                	je     1f2 <copy_user_generic_string+0x32>
 1ea:	89 c1                	mov    %eax,%ecx
 1ec:	50                   	push   %rax
 1ed:	31 c0                	xor    %eax,%eax
 1ef:	f3 aa                	rep stos %al,%es:(%rdi)
 1f1:	58                   	pop    %rax
 1f2:	c3                   	retq

Zdenek

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2008-03-04 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 16:02 loop in copy_user_generic_string Zdenek Kabelac
2008-03-04 16:07 ` Avi Kivity
2008-03-04 16:39   ` Zdenek Kabelac [this message]
2008-03-04 17:10     ` Avi Kivity
2008-03-04 17:44   ` Andi Kleen
2008-03-05  6:50     ` Avi Kivity
2008-03-05  8:52       ` Zdenek Kabelac
2008-03-07 19:32         ` Zdenek Kabelac
2008-03-09 22:13           ` Zdenek Kabelac
2008-03-11 22:19             ` Zdenek Kabelac
2008-03-12 12:50               ` Zdenek Kabelac
2008-03-12 14:40                 ` Andi Kleen
2008-03-12 15:49                   ` Zdenek Kabelac
2008-03-12 16:08                     ` Zdenek Kabelac

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=c4e36d110803040839o7a8036e5xec7c22b89405f51b@mail.gmail.com \
    --to=zdenek.kabelac@gmail.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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