All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hp.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: linux-arch@vger.kernel.org,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	kvm@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Scott J Norton <scott.norton@hp.com>,
	x86@kernel.org, Paolo Bonzini <paolo.bonzini@gmail.com>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Ingo Molnar <mingo@redhat.com>,
	David Vrabel <david.vrabel@citrix.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	xen-devel@lists.xenproject.org,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Douglas Hatch <doug.hatch@hp.com>
Subject: Re: [PATCH v12 09/11] pvqspinlock, x86: Add para-virtualization support
Date: Tue, 25 Nov 2014 19:33:58 -0500	[thread overview]
Message-ID: <54751FF6.5050808__32100.5312529907$1416962154$gmane$org@hp.com> (raw)
In-Reply-To: <20141027180252.GC12989@laptop.dumpdata.com>

On 10/27/2014 02:02 PM, Konrad Rzeszutek Wilk wrote:
> On Mon, Oct 27, 2014 at 01:38:20PM -0400, Waiman Long wrote:
>>
>> My concern is that spin_unlock() can be called in many places, including
>> loadable kernel modules. Can the paravirt_patch_ident_32() function able to
>> patch all of them in reasonable time? How about a kernel module loaded later
>> at run time?
> It has too. When the modules are loaded the .paravirt symbols are exposed
> and the module loader patches that.
>
> And during bootup time (before modules are loaded) it also patches everything
> - when it only runs on one CPU.
>

I have been changing the patching code to patch the unlock call sites 
and it seems to be working now. However, when I manually inserted a 
kernel module using insmod and run the code in the newly inserted 
module, I got memory access violation as follows:

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<          (null)>]           (null)
PGD 18d62f3067 PUD 18d476f067 PMD 0
Oops: 0010 [#1] SMP
Modules linked in: locktest(OE) ebtable_nat ebtables xt_CHECKSUM 
iptable_mangle bridge autofs4 8021q garp stp llc ipt_REJECT 
nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT 
nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter 
ip6_tables ipv6 vhost_net macvtap macvlan vhost tun uinput ppdev 
parport_pc parport sg microcode pcspkr virtio_balloon 
snd_hda_codec_generic virtio_console snd_hda_intel snd_hda_controller 
snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd 
soundcore virtio_net i2c_piix4 i2c_core ext4(E) jbd2(E) mbcache(E) 
floppy(E) virtio_blk(E) sr_mod(E) cdrom(E) virtio_pci(E) virtio_ring(E) 
virtio(E) pata_acpi(E) ata_generic(E) ata_piix(E) dm_mirror(E) 
dm_region_hash(E) dm_log(E) dm_mod(E) [last unloaded: speedstep_lib]
CPU: 1 PID: 3907 Comm: run-locktest Tainted: G        W  OE  
3.17.0-pvqlock #3
Hardware name: Red Hat KVM, BIOS Bochs 01/01/2011
task: ffff8818cc5baf90 ti: ffff8818b7094000 task.ti: ffff8818b7094000
RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
RSP: 0018:ffff8818b7097db0  EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000004c4b40 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8818d3f052c0
RBP: ffff8818b7097dd8 R08: 0000000080522014 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000001 R12: 0000000000000001
R13: 0000000000000000 R14: 0000000000000001 R15: ffff8818b7097ea0
FS:  00007fb828ece700(0000) GS:ffff88193ec20000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000000 CR3: 00000018cc7e9000 CR4: 00000000000006e0
Stack:
  ffffffffa06ff395 ffff8818d465e000 ffffffff8164bec0 0000000000000001
  0000000000000050 ffff8818b7097e18 ffffffffa06ff785 ffff8818b7097e38
  0000000000000246 0000000054755e3a 0000000039f8ba72 ffff8818c174f000
Call Trace:
  [<ffffffffa06ff395>] ? test_spinlock+0x65/0x90 [locktest]
  [<ffffffffa06ff785>] etime_show+0xd5/0x120 [locktest]
  [<ffffffff812a2dc6>] kobj_attr_show+0x16/0x20
  [<ffffffff8121a7fa>] sysfs_kf_seq_show+0xca/0x1b0
  [<ffffffff81218a13>] kernfs_seq_show+0x23/0x30
  [<ffffffff811c82db>] seq_read+0xbb/0x400
  [<ffffffff812197e5>] kernfs_fop_read+0x35/0x40
  [<ffffffff811a4223>] vfs_read+0xa3/0x110
  [<ffffffff811a47e6>] SyS_read+0x56/0xd0
  [<ffffffff810f3e16>] ? __audit_syscall_exit+0x216/0x2c0
  [<ffffffff815b3ca9>] system_call_fastpath+0x16/0x1b
Code:  Bad RIP value.
  RSP <ffff8818b7097db0>
CR2: 0000000000000000
---[ end trace 69d0e259c9ec632f ]---

It seems like call site patching isn't properly done or the kernel 
module that I built was missing some critical information necessary for 
the proper linking. Anyway, I will include the unlock call patching code 
as a separate patch as it seems there may be problem under certain 
circumstance.

BTW, the kernel panic problem that your team reported had been fixed. 
The fix will be in the next version of the patch.

-Longman

  parent reply	other threads:[~2014-11-26  0:34 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 18:10 [PATCH v12 00/11] qspinlock: a 4-byte queue spinlock with PV support Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 01/11] qspinlock: A simple generic 4-byte queue spinlock Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 02/11] qspinlock, x86: Enable x86-64 to use " Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 03/11] qspinlock: Add pending bit Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 04/11] qspinlock: Extract out code snippets for the next patch Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 05/11] qspinlock: Optimize for smaller NR_CPUS Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 06/11] qspinlock: Use a simple write to grab the lock Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 07/11] qspinlock: Revert to test-and-set on hypervisors Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 08/11] qspinlock, x86: Rename paravirt_ticketlocks_enabled Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10   ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 09/11] pvqspinlock, x86: Add para-virtualization support Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-24  8:47   ` Peter Zijlstra
2014-10-24  8:47   ` Peter Zijlstra
2014-10-24  8:47   ` Peter Zijlstra
2014-10-24 20:53     ` Waiman Long
2014-10-24 20:53       ` Waiman Long
2014-10-24 22:04       ` Peter Zijlstra
2014-10-24 22:04         ` Peter Zijlstra
2014-10-25  4:30         ` Mike Galbraith
2014-10-25  4:30         ` Mike Galbraith
2014-10-25  4:30         ` Mike Galbraith
2014-10-27 17:15         ` Waiman Long
2014-10-27 17:15         ` Waiman Long
2014-10-27 17:15           ` Waiman Long
2014-10-27 17:27           ` Peter Zijlstra
2014-10-27 20:50             ` Waiman Long
2014-10-27 20:50             ` Waiman Long
2014-10-27 20:50               ` Waiman Long
2014-10-27 17:27           ` Peter Zijlstra
2014-10-27 17:27           ` Peter Zijlstra
2014-10-24 22:04       ` Peter Zijlstra
2014-10-24 20:53     ` Waiman Long
2014-10-24  8:54   ` Peter Zijlstra
2014-10-24  8:54     ` Peter Zijlstra
2014-10-27 17:38     ` Waiman Long
2014-10-27 17:38       ` Waiman Long
2014-10-27 18:02       ` Konrad Rzeszutek Wilk
2014-10-27 18:02         ` Konrad Rzeszutek Wilk
2014-10-27 20:55         ` Waiman Long
2014-10-27 20:55         ` Waiman Long
2014-10-27 20:55         ` Waiman Long
2014-11-26  0:33         ` Waiman Long [this message]
2014-11-26  0:33         ` Waiman Long
2014-11-26  0:33         ` Waiman Long
2014-12-01 16:51           ` Konrad Rzeszutek Wilk
2014-12-01 16:51           ` Konrad Rzeszutek Wilk
2014-12-01 16:51             ` Konrad Rzeszutek Wilk
2014-10-27 18:02       ` Konrad Rzeszutek Wilk
2014-10-27 18:04       ` Peter Zijlstra
2014-10-27 18:04       ` Peter Zijlstra
2014-10-27 18:04       ` Peter Zijlstra
2014-10-27 21:22         ` Waiman Long
2014-10-27 21:22         ` Waiman Long
2014-10-27 21:22         ` Waiman Long
2014-10-29 19:05           ` Waiman Long
2014-10-29 19:05           ` Waiman Long
2014-10-29 19:05             ` Waiman Long
2014-10-29 20:25             ` Waiman Long
2014-10-29 20:25             ` Waiman Long
2014-10-29 20:25             ` Waiman Long
2014-10-27 17:38     ` Waiman Long
2014-10-24  8:54   ` Peter Zijlstra
2014-10-16 18:10 ` [PATCH v12 10/11] pvqspinlock, x86: Enable PV qspinlock for KVM Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` [PATCH v12 11/11] pvqspinlock, x86: Enable PV qspinlock for XEN Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-16 18:10 ` Waiman Long
2014-10-24  8:57 ` [PATCH v12 00/11] qspinlock: a 4-byte queue spinlock with PV support Peter Zijlstra
2014-10-24  8:57 ` Peter Zijlstra
2014-10-24  8:57   ` Peter Zijlstra
2014-10-27 18:00   ` Waiman Long
2014-10-27 18:00   ` Waiman Long
2014-10-27 18:00     ` Waiman Long

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='54751FF6.5050808__32100.5312529907$1416962154$gmane$org@hp.com' \
    --to=waiman.long@hp.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=doug.hatch@hp.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=paolo.bonzini@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=scott.norton@hp.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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.