* Re: Bug inkvm_set_irq
From: Jean-Philippe Menil @ 2011-02-28 10:40 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, kvm, virtualization
In-Reply-To: <20110228101139.GD28006@redhat.com>
Le 28/02/2011 11:11, Michael S. Tsirkin a écrit :
> On Mon, Feb 28, 2011 at 09:56:46AM +0100, Jean-Philippe Menil wrote:
>> Le 27/02/2011 18:00, Michael S. Tsirkin a écrit :
>>> On Fri, Feb 25, 2011 at 10:07:22AM +0100, Jean-Philippe Menil wrote:
>>>> Hi,
>>>>
>>>> Each time i try tou use vhost_net, i'm facing a kernel bug.
>>>> I do a "modprobe vhost_net", and start guest whith vhost=on.
>>>>
>>>> Following is a trace with a kernel 2.6.37, but i had the same
>>>> problem with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
>>> 2.6.36 had a theorectical race that could explain this,
>>> but it should be ok in 2.6.37.
>>>
>>>> The bug only occurs whith vhost_net charged, so i don't know if this
>>>> is a bug in kvm module code or in the vhost_net code.
>>> It could be a bug in eventfd which is the interface
>>> used by both kvm and vhost_net.
>>> Just for fun, you can try 3.6.38 - eventfd code has been changed
>>> a lot in 2.6.38 and if it does not trigger there
>>> it's a hint that irqfd is the reason.
>>>
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243100] BUG: unable to handle kernel paging request at
>>>> 0000000000002458
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243250] IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
>>> Could you run markup_oops/ ksymoops on this please?
>>> As far as I can see kvm_set_irq can only get a wrong
>>> kvm pointer. Unless there's some general memory corruption,
>>> I'd guess
>>>
>>> You can also try comparing the irqfd->kvm pointer in
>>> kvm_irqfd_assign irqfd_wakeup and kvm_set_irq in
>>> virt/kvm/eventfd.c.
>>>
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243378] PGD 45d363067 PUD 45e77a067 PMD 0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243556] Oops: 0000 [#1] SMP
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243692] last sysfs file:
>>>> /sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.243820] Modules linked in: vhost_net macvtap macvlan tun
>>>> powernow_k8 mperf cpufreq_userspace cpufreq_stats cpufreq_powersave
>>>> cpufreq_ondemand fre
>>>> q_table cpufreq_conservative fuse xt_physdev ip6t_LOG
>>>> ip6table_filter ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp
>>>> xt_state iptable_filter ip_tables x_tables nf_conntrack_tftp
>>>> nf_conntrack_ftp nf_connt
>>>> rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache
>>>> dm_round_robin dm_multipath nf_conntrack_ipv6 nf_conntrack
>>>> nf_defrag_ipv6 kvm_amd kvm ipv6 snd_pcm snd_timer snd soundcore
>>>> snd_page_alloc tpm_tis tpm ps
>>>> mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes
>>>> serio_raw joydev evdev pci_hotplug i2c_core hed button thermal_sys
>>>> xfs exportfs dm_mod sg sr_mod cdrom usbhid hid usb_storage ses
>>>> sd_mod enclosu
>>>> re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2
>>>> scsi_mod ehci_hcd [last unloaded: scsi_wait_scan]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] Pid: 10, comm: kworker/0:1 Not tainted
>>>> 2.6.37-dsiun-110105 #17 0K543T/PowerEdge M605
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
>>>> kvm_set_irq+0x2a/0x130 [kvm]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RAX: 0000000000000000 RBX: 000000000000001a RCX:
>>>> 0000000000000001
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
>>>> 0000000000000000
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RBP: 0000000000000000 R08: 0000000000000001 R09:
>>>> ffff880856a91e48
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] R10: 0000000000000000 R11: 00000000ffffffff R12:
>>>> 0000000000000000
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] R13: 0000000000000001 R14: 0000000000000000 R15:
>>>> 0000000000000000
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] FS: 00007f617986c710(0000) GS:ffff88007f800000(0000)
>>>> knlGS:0000000000000000
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] CR2: 0000000000002458 CR3: 000000045d197000 CR4:
>>>> 00000000000006f0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
>>>> 0000000000000000
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
>>>> 0000000000000400
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] Process kworker/0:1 (pid: 10, threadinfo
>>>> ffff88045fc88000, task ffff88085fc53c30)
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] ffff88045fc89fd8 00000000000119c0 ffff88045fc88010
>>>> ffff88085fc53ee8
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30
>>>> 00000000000119c0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] 00000000000119c0 ffffffff8137f7ce ffff88007f80df40
>>>> 00000000ffffffff
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] Call Trace:
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106be25>] ? worker_thread+0x145/0x410
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106f786>] ? kthread+0x96/0xa0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff8106f6f0>] ? kthread+0x0/0xa0
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] [<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89
>>>> fc 55 53 89 d3 48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4
>>>> 00 00 00<4
>>>> 9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] RSP<ffff88045fc89d30>
>>>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>>>> 685.246123] CR2: 0000000000002458
>>>>
>>>>
>>>> If someone can help me, on how to solve this.
>>>>
>>>> Regards.
>>>> _______________________________________________
>>>> Virtualization mailing list
>>>> Virtualization@lists.linux-foundation.org
>>>> https://lists.linux-foundation.org/mailman/listinfo/virtualization
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Hi,
>>
>> thanks for your response.
>>
>> This is what markup_oops.pl return me:
>> "No matching code found"
> Well, let's try to understand what's there.
>
> Do objdumop -ldS kvm.ko
> look for<kvm_set_irq>
>
> and paste the content from start of that function
> to offset 0x2a and a bit beyond.
>
> You can also upload your kvm.ko somewhere, I'll try to take a look.
>
>
>> So this is not a vhost_net bug, or my oops is incomplete and
>> markup_oops can't find the good vma offset.
>>
>> I will try to compare the pointers you indicate me, even it could be
>> a little difficult for me.
> Hmm you know how to add printk to code and rebuild, right?
>
>> Maybe i will try a 2.6.38, will wait a response from the kvm team.
>>
>> Regards.
>>
>> --
>> Jean-Philippe Menil - Pôle réseau Service IRTS
>> DSI Université de Nantes
>> jean-philippe.menil@univ-nantes.fr
>> Tel : 02.53.48.49.27 - Fax : 02.53.48.49.09
So, here is the result for the objdump against the kvm.ko (the
kvm_set_irq part) :
0000000000006a60 <kvm_set_irq>:
kvm_set_irq():
6a60: 41 57 push %r15
6a62: 41 89 f7 mov %esi,%r15d
6a65: 41 56 push %r14
6a67: 41 55 push %r13
6a69: 41 89 cd mov %ecx,%r13d
6a6c: 41 54 push %r12
6a6e: 49 89 fc mov %rdi,%r12
6a71: 55 push %rbp
6a72: 53 push %rbx
6a73: 89 d3 mov %edx,%ebx
6a75: 48 81 ec 98 00 00 00 sub $0x98,%rsp
6a7c: 8b 15 00 00 00 00 mov 0x0(%rip),%edx #
6a82 <kvm_set_irq+0x22>
6a82: 85 d2 test %edx,%edx
6a84: 0f 85 c4 00 00 00 jne 6b4e <kvm_set_irq+0xee>
6a8a: 49 8b 84 24 58 24 00 mov 0x2458(%r12),%rax
6a91: 00
6a92: 3b 98 28 01 00 00 cmp 0x128(%rax),%ebx
6a98: 73 5e jae 6af8 <kvm_set_irq+0x98>
6a9a: 89 db mov %ebx,%ebx
6a9c: 48 8b 84 d8 30 01 00 mov 0x130(%rax,%rbx,8),%rax
6aa3: 00
6aa4: 48 85 c0 test %rax,%rax
6aa7: 74 4f je 6af8 <kvm_set_irq+0x98>
6aa9: 48 89 e2 mov %rsp,%rdx
6aac: 31 db xor %ebx,%ebx
6aae: 48 8b 08 mov (%rax),%rcx
6ab1: 83 c3 01 add $0x1,%ebx
6ab4: 0f 18 09 prefetcht0 (%rcx)
6ab7: 48 8b 48 e0 mov -0x20(%rax),%rcx
6abb: 48 89 0a mov %rcx,(%rdx)
6abe: 48 8b 48 e8 mov -0x18(%rax),%rcx
6ac2: 48 89 4a 08 mov %rcx,0x8(%rdx)
6ac6: 48 8b 48 f0 mov -0x10(%rax),%rcx
6aca: 48 89 4a 10 mov %rcx,0x10(%rdx)
6ace: 48 8b 48 f8 mov -0x8(%rax),%rcx
6ad2: 48 89 4a 18 mov %rcx,0x18(%rdx)
6ad6: 48 8b 08 mov (%rax),%rcx
6ad9: 48 89 4a 20 mov %rcx,0x20(%rdx)
6add: 48 8b 48 08 mov 0x8(%rax),%rcx
6ae1: 48 89 4a 28 mov %rcx,0x28(%rdx)
6ae5: 48 8b 00 mov (%rax),%rax
6ae8: 48 83 c2 30 add $0x30,%rdx
6aec: 48 85 c0 test %rax,%rax
6aef: 75 bd jne 6aae <kvm_set_irq+0x4e>
6af1: eb 07 jmp 6afa <kvm_set_irq+0x9a>
6af3: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
6af8: 31 db xor %ebx,%ebx
6afa: bd ff ff ff ff mov $0xffffffff,%ebp
6aff: 49 89 e6 mov %rsp,%r14
6b02: 85 db test %ebx,%ebx
6b04: 74 34 je 6b3a <kvm_set_irq+0xda>
6b06: 83 eb 01 sub $0x1,%ebx
6b09: 44 89 e9 mov %r13d,%ecx
6b0c: 44 89 fa mov %r15d,%edx
6b0f: 48 63 c3 movslq %ebx,%rax
6b12: 4c 89 e6 mov %r12,%rsi
6b15: 48 8d 04 40 lea (%rax,%rax,2),%rax
6b19: 48 c1 e0 04 shl $0x4,%rax
6b1d: 49 8d 3c 06 lea (%r14,%rax,1),%rdi
6b21: ff 54 04 08 callq *0x8(%rsp,%rax,1)
6b25: 85 c0 test %eax,%eax
6b27: 78 d9 js 6b02 <kvm_set_irq+0xa2>
6b29: 85 ed test %ebp,%ebp
6b2b: ba 00 00 00 00 mov $0x0,%edx
6b30: 0f 48 ea cmovs %edx,%ebp
6b33: 85 db test %ebx,%ebx
6b35: 8d 2c 28 lea (%rax,%rbp,1),%ebp
6b38: 75 cc jne 6b06 <kvm_set_irq+0xa6>
6b3a: 48 81 c4 98 00 00 00 add $0x98,%rsp
6b41: 89 e8 mov %ebp,%eax
6b43: 5b pop %rbx
6b44: 5d pop %rbp
6b45: 41 5c pop %r12
6b47: 41 5d pop %r13
6b49: 41 5e pop %r14
6b4b: 41 5f pop %r15
6b4d: c3 retq
6b4e: 48 8b 2d 00 00 00 00 mov 0x0(%rip),%rbp #
6b55 <kvm_set_irq+0xf5>
6b55: 48 85 ed test %rbp,%rbp
6b58: 0f 84 2c ff ff ff je 6a8a <kvm_set_irq+0x2a>
6b5e: 48 8b 45 00 mov 0x0(%rbp),%rax
6b62: 48 8b 7d 08 mov 0x8(%rbp),%rdi
6b66: 48 83 c5 10 add $0x10,%rbp
6b6a: 44 89 f9 mov %r15d,%ecx
6b6d: 44 89 ea mov %r13d,%edx
6b70: 89 de mov %ebx,%esi
6b72: ff d0 callq *%rax
6b74: 48 8b 45 00 mov 0x0(%rbp),%rax
6b78: 48 85 c0 test %rax,%rax
6b7b: 75 e5 jne 6b62 <kvm_set_irq+0x102>
6b7d: e9 08 ff ff ff jmpq 6a8a <kvm_set_irq+0x2a>
6b82: 66 66 66 66 66 2e 0f nopw %cs:0x0(%rax,%rax,1)
6b89: 1f 84 00 00 00 00 00
I admit that this analysis is too complicated for me.
I, effectively, can rebuild a kernel with more printk, and program a reboot.
The kvm.ko is available through the following address:
http://filex.univ-nantes.fr/get?k=k1jKhQghdcHLz12Z50H
Regards.
--
Jean-Philippe Menil - Pôle réseau Service IRTS
DSI Université de Nantes
jean-philippe.menil@univ-nantes.fr
Tel : 02.53.48.49.27 - Fax : 02.53.48.49.09
^ permalink raw reply
* Re: Bug inkvm_set_irq
From: Michael S. Tsirkin @ 2011-02-28 10:11 UTC (permalink / raw)
To: Jean-Philippe Menil; +Cc: netdev, kvm, virtualization
In-Reply-To: <4D6B634E.9090801@univ-nantes.fr>
On Mon, Feb 28, 2011 at 09:56:46AM +0100, Jean-Philippe Menil wrote:
> Le 27/02/2011 18:00, Michael S. Tsirkin a écrit :
> >On Fri, Feb 25, 2011 at 10:07:22AM +0100, Jean-Philippe Menil wrote:
> >>Hi,
> >>
> >>Each time i try tou use vhost_net, i'm facing a kernel bug.
> >>I do a "modprobe vhost_net", and start guest whith vhost=on.
> >>
> >>Following is a trace with a kernel 2.6.37, but i had the same
> >>problem with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
> >2.6.36 had a theorectical race that could explain this,
> >but it should be ok in 2.6.37.
> >
> >>The bug only occurs whith vhost_net charged, so i don't know if this
> >>is a bug in kvm module code or in the vhost_net code.
> >It could be a bug in eventfd which is the interface
> >used by both kvm and vhost_net.
> >Just for fun, you can try 3.6.38 - eventfd code has been changed
> >a lot in 2.6.38 and if it does not trigger there
> >it's a hint that irqfd is the reason.
> >
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243100] BUG: unable to handle kernel paging request at
> >>0000000000002458
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243250] IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
> >
> >Could you run markup_oops/ ksymoops on this please?
> >As far as I can see kvm_set_irq can only get a wrong
> >kvm pointer. Unless there's some general memory corruption,
> >I'd guess
> >
> >You can also try comparing the irqfd->kvm pointer in
> >kvm_irqfd_assign irqfd_wakeup and kvm_set_irq in
> >virt/kvm/eventfd.c.
> >
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243378] PGD 45d363067 PUD 45e77a067 PMD 0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243556] Oops: 0000 [#1] SMP
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243692] last sysfs file:
> >>/sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.243820] Modules linked in: vhost_net macvtap macvlan tun
> >>powernow_k8 mperf cpufreq_userspace cpufreq_stats cpufreq_powersave
> >>cpufreq_ondemand fre
> >>q_table cpufreq_conservative fuse xt_physdev ip6t_LOG
> >>ip6table_filter ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp
> >>xt_state iptable_filter ip_tables x_tables nf_conntrack_tftp
> >>nf_conntrack_ftp nf_connt
> >>rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache
> >>dm_round_robin dm_multipath nf_conntrack_ipv6 nf_conntrack
> >>nf_defrag_ipv6 kvm_amd kvm ipv6 snd_pcm snd_timer snd soundcore
> >>snd_page_alloc tpm_tis tpm ps
> >>mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes
> >>serio_raw joydev evdev pci_hotplug i2c_core hed button thermal_sys
> >>xfs exportfs dm_mod sg sr_mod cdrom usbhid hid usb_storage ses
> >>sd_mod enclosu
> >>re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2
> >>scsi_mod ehci_hcd [last unloaded: scsi_wait_scan]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] Pid: 10, comm: kworker/0:1 Not tainted
> >>2.6.37-dsiun-110105 #17 0K543T/PowerEdge M605
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
> >>kvm_set_irq+0x2a/0x130 [kvm]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RAX: 0000000000000000 RBX: 000000000000001a RCX:
> >>0000000000000001
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
> >>0000000000000000
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RBP: 0000000000000000 R08: 0000000000000001 R09:
> >>ffff880856a91e48
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] R10: 0000000000000000 R11: 00000000ffffffff R12:
> >>0000000000000000
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] R13: 0000000000000001 R14: 0000000000000000 R15:
> >>0000000000000000
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] FS: 00007f617986c710(0000) GS:ffff88007f800000(0000)
> >>knlGS:0000000000000000
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] CR2: 0000000000002458 CR3: 000000045d197000 CR4:
> >>00000000000006f0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
> >>0000000000000000
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
> >>0000000000000400
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] Process kworker/0:1 (pid: 10, threadinfo
> >>ffff88045fc88000, task ffff88085fc53c30)
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] ffff88045fc89fd8 00000000000119c0 ffff88045fc88010
> >>ffff88085fc53ee8
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30
> >>00000000000119c0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] 00000000000119c0 ffffffff8137f7ce ffff88007f80df40
> >>00000000ffffffff
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] Call Trace:
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106be25>] ? worker_thread+0x145/0x410
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106f786>] ? kthread+0x96/0xa0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff8106f6f0>] ? kthread+0x0/0xa0
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] [<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89
> >>fc 55 53 89 d3 48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4
> >>00 00 00<4
> >>9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] RSP<ffff88045fc89d30>
> >>Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> >>685.246123] CR2: 0000000000002458
> >>
> >>
> >>If someone can help me, on how to solve this.
> >>
> >>Regards.
> >>_______________________________________________
> >>Virtualization mailing list
> >>Virtualization@lists.linux-foundation.org
> >>https://lists.linux-foundation.org/mailman/listinfo/virtualization
> >--
> >To unsubscribe from this list: send the line "unsubscribe netdev" in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> Hi,
>
> thanks for your response.
>
> This is what markup_oops.pl return me:
> "No matching code found "
Well, let's try to understand what's there.
Do objdumop -ldS kvm.ko
look for <kvm_set_irq>
and paste the content from start of that function
to offset 0x2a and a bit beyond.
You can also upload your kvm.ko somewhere, I'll try to take a look.
> So this is not a vhost_net bug, or my oops is incomplete and
> markup_oops can't find the good vma offset.
>
> I will try to compare the pointers you indicate me, even it could be
> a little difficult for me.
Hmm you know how to add printk to code and rebuild, right?
>
> Maybe i will try a 2.6.38, will wait a response from the kvm team.
>
> Regards.
>
> --
> Jean-Philippe Menil - Pôle réseau Service IRTS
> DSI Université de Nantes
> jean-philippe.menil@univ-nantes.fr
> Tel : 02.53.48.49.27 - Fax : 02.53.48.49.09
^ permalink raw reply
* Re: Bug inkvm_set_irq
From: Jean-Philippe Menil @ 2011-02-28 8:56 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, kvm, virtualization
In-Reply-To: <20110227170031.GC17973@redhat.com>
Le 27/02/2011 18:00, Michael S. Tsirkin a écrit :
> On Fri, Feb 25, 2011 at 10:07:22AM +0100, Jean-Philippe Menil wrote:
>> Hi,
>>
>> Each time i try tou use vhost_net, i'm facing a kernel bug.
>> I do a "modprobe vhost_net", and start guest whith vhost=on.
>>
>> Following is a trace with a kernel 2.6.37, but i had the same
>> problem with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
> 2.6.36 had a theorectical race that could explain this,
> but it should be ok in 2.6.37.
>
>> The bug only occurs whith vhost_net charged, so i don't know if this
>> is a bug in kvm module code or in the vhost_net code.
> It could be a bug in eventfd which is the interface
> used by both kvm and vhost_net.
> Just for fun, you can try 3.6.38 - eventfd code has been changed
> a lot in 2.6.38 and if it does not trigger there
> it's a hint that irqfd is the reason.
>
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243100] BUG: unable to handle kernel paging request at
>> 0000000000002458
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243250] IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
>
> Could you run markup_oops/ ksymoops on this please?
> As far as I can see kvm_set_irq can only get a wrong
> kvm pointer. Unless there's some general memory corruption,
> I'd guess
>
> You can also try comparing the irqfd->kvm pointer in
> kvm_irqfd_assign irqfd_wakeup and kvm_set_irq in
> virt/kvm/eventfd.c.
>
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243378] PGD 45d363067 PUD 45e77a067 PMD 0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243556] Oops: 0000 [#1] SMP
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243692] last sysfs file:
>> /sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.243820] Modules linked in: vhost_net macvtap macvlan tun
>> powernow_k8 mperf cpufreq_userspace cpufreq_stats cpufreq_powersave
>> cpufreq_ondemand fre
>> q_table cpufreq_conservative fuse xt_physdev ip6t_LOG
>> ip6table_filter ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp
>> xt_state iptable_filter ip_tables x_tables nf_conntrack_tftp
>> nf_conntrack_ftp nf_connt
>> rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache
>> dm_round_robin dm_multipath nf_conntrack_ipv6 nf_conntrack
>> nf_defrag_ipv6 kvm_amd kvm ipv6 snd_pcm snd_timer snd soundcore
>> snd_page_alloc tpm_tis tpm ps
>> mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes
>> serio_raw joydev evdev pci_hotplug i2c_core hed button thermal_sys
>> xfs exportfs dm_mod sg sr_mod cdrom usbhid hid usb_storage ses
>> sd_mod enclosu
>> re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2
>> scsi_mod ehci_hcd [last unloaded: scsi_wait_scan]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] Pid: 10, comm: kworker/0:1 Not tainted
>> 2.6.37-dsiun-110105 #17 0K543T/PowerEdge M605
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
>> kvm_set_irq+0x2a/0x130 [kvm]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RAX: 0000000000000000 RBX: 000000000000001a RCX:
>> 0000000000000001
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
>> 0000000000000000
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RBP: 0000000000000000 R08: 0000000000000001 R09:
>> ffff880856a91e48
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] R10: 0000000000000000 R11: 00000000ffffffff R12:
>> 0000000000000000
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] R13: 0000000000000001 R14: 0000000000000000 R15:
>> 0000000000000000
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] FS: 00007f617986c710(0000) GS:ffff88007f800000(0000)
>> knlGS:0000000000000000
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] CR2: 0000000000002458 CR3: 000000045d197000 CR4:
>> 00000000000006f0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
>> 0000000000000000
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
>> 0000000000000400
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] Process kworker/0:1 (pid: 10, threadinfo
>> ffff88045fc88000, task ffff88085fc53c30)
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] ffff88045fc89fd8 00000000000119c0 ffff88045fc88010
>> ffff88085fc53ee8
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30
>> 00000000000119c0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] 00000000000119c0 ffffffff8137f7ce ffff88007f80df40
>> 00000000ffffffff
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] Call Trace:
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106be25>] ? worker_thread+0x145/0x410
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106f786>] ? kthread+0x96/0xa0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff8106f6f0>] ? kthread+0x0/0xa0
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] [<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89
>> fc 55 53 89 d3 48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4
>> 00 00 00<4
>> 9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] RSP<ffff88045fc89d30>
>> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
>> 685.246123] CR2: 0000000000002458
>>
>>
>> If someone can help me, on how to solve this.
>>
>> Regards.
>> _______________________________________________
>> Virtualization mailing list
>> Virtualization@lists.linux-foundation.org
>> https://lists.linux-foundation.org/mailman/listinfo/virtualization
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
thanks for your response.
This is what markup_oops.pl return me:
"No matching code found "
So this is not a vhost_net bug, or my oops is incomplete and markup_oops
can't find the good vma offset.
I will try to compare the pointers you indicate me, even it could be a
little difficult for me.
Maybe i will try a 2.6.38, will wait a response from the kvm team.
Regards.
--
Jean-Philippe Menil - Pôle réseau Service IRTS
DSI Université de Nantes
jean-philippe.menil@univ-nantes.fr
Tel : 02.53.48.49.27 - Fax : 02.53.48.49.09
^ permalink raw reply
* Re: Can't build in the virtio console driver on x86_64 when the other virtio drivers are modular
From: Amit Shah @ 2011-02-28 5:04 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: linux-kernel, virtualization
In-Reply-To: <20110225121320.2f540f12@katamari>
On (Fri) 25 Feb 2011 [12:13:20], Chuck Ebbert wrote:
> On Fri, 25 Feb 2011 11:38:15 +0530
> Amit Shah <amit.shah@redhat.com> wrote:
>
> > On (Thu) 24 Feb 2011 [11:28:19], Chuck Ebbert wrote:
> > > The virtio configuration options are inconsistent. According to this,
> > > every options that needs virtio will select it:
> > >
> > > # Virtio always gets selected by whoever wants it.
> > > config VIRTIO
> > > tristate
> > >
> > > Note that it's not user-selectable, so any config file that tries to
> > > set it will be ignored when kconfig loads those options. And yet we
> > > have a whole set of options that depend on VIRTIO, like VIRTIO_CONSOLE
> > > for example. This makes it impossible to have VIRTIO_PCI modular and
> > > VIRTIO_CONSOLE built-in on x86_64, because:
> >
> > Any reason to have VIRTIO_PCI modular instead of built in (on x86-64,
> > virtio-console won't work without virtio-pci anyway)?
> >
>
> None that I know of offhand, other than not building in things unless
> absolutely necessary. There's no dependency of any kind there, so it's
> even possible to build a kernel with VIRTIO_CONSOLE enabled and
> VIRTIO_PCI completely disabled.
Yes, that's that way because not all architectures need virtio-pci to
have virtio-console functional (eg. s390, which doesn't have a PCI
bus).
So if you're only interested in the x86-64 arch, you could compile in
virtio-pci and virtio-console and this should happily work.
Amit
^ permalink raw reply
* Re: Bug inkvm_set_irq
From: Michael S. Tsirkin @ 2011-02-27 17:00 UTC (permalink / raw)
To: Jean-Philippe Menil; +Cc: netdev, kvm, virtualization
In-Reply-To: <4D67714A.2050100@univ-nantes.fr>
On Fri, Feb 25, 2011 at 10:07:22AM +0100, Jean-Philippe Menil wrote:
> Hi,
>
> Each time i try tou use vhost_net, i'm facing a kernel bug.
> I do a "modprobe vhost_net", and start guest whith vhost=on.
>
> Following is a trace with a kernel 2.6.37, but i had the same
> problem with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
2.6.36 had a theorectical race that could explain this,
but it should be ok in 2.6.37.
>
> The bug only occurs whith vhost_net charged, so i don't know if this
> is a bug in kvm module code or in the vhost_net code.
It could be a bug in eventfd which is the interface
used by both kvm and vhost_net.
Just for fun, you can try 3.6.38 - eventfd code has been changed
a lot in 2.6.38 and if it does not trigger there
it's a hint that irqfd is the reason.
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243100] BUG: unable to handle kernel paging request at
> 0000000000002458
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243250] IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
Could you run markup_oops/ ksymoops on this please?
As far as I can see kvm_set_irq can only get a wrong
kvm pointer. Unless there's some general memory corruption,
I'd guess
You can also try comparing the irqfd->kvm pointer in
kvm_irqfd_assign irqfd_wakeup and kvm_set_irq in
virt/kvm/eventfd.c.
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243378] PGD 45d363067 PUD 45e77a067 PMD 0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243556] Oops: 0000 [#1] SMP
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243692] last sysfs file:
> /sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243820] Modules linked in: vhost_net macvtap macvlan tun
> powernow_k8 mperf cpufreq_userspace cpufreq_stats cpufreq_powersave
> cpufreq_ondemand fre
> q_table cpufreq_conservative fuse xt_physdev ip6t_LOG
> ip6table_filter ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp
> xt_state iptable_filter ip_tables x_tables nf_conntrack_tftp
> nf_conntrack_ftp nf_connt
> rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache
> dm_round_robin dm_multipath nf_conntrack_ipv6 nf_conntrack
> nf_defrag_ipv6 kvm_amd kvm ipv6 snd_pcm snd_timer snd soundcore
> snd_page_alloc tpm_tis tpm ps
> mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes
> serio_raw joydev evdev pci_hotplug i2c_core hed button thermal_sys
> xfs exportfs dm_mod sg sr_mod cdrom usbhid hid usb_storage ses
> sd_mod enclosu
> re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2
> scsi_mod ehci_hcd [last unloaded: scsi_wait_scan]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Pid: 10, comm: kworker/0:1 Not tainted
> 2.6.37-dsiun-110105 #17 0K543T/PowerEdge M605
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
> kvm_set_irq+0x2a/0x130 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RAX: 0000000000000000 RBX: 000000000000001a RCX:
> 0000000000000001
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RBP: 0000000000000000 R08: 0000000000000001 R09:
> ffff880856a91e48
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] R10: 0000000000000000 R11: 00000000ffffffff R12:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] R13: 0000000000000001 R14: 0000000000000000 R15:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] FS: 00007f617986c710(0000) GS:ffff88007f800000(0000)
> knlGS:0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CR2: 0000000000002458 CR3: 000000045d197000 CR4:
> 00000000000006f0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
> 0000000000000400
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Process kworker/0:1 (pid: 10, threadinfo
> ffff88045fc88000, task ffff88085fc53c30)
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] ffff88045fc89fd8 00000000000119c0 ffff88045fc88010
> ffff88085fc53ee8
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30
> 00000000000119c0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] 00000000000119c0 ffffffff8137f7ce ffff88007f80df40
> 00000000ffffffff
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Call Trace:
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106be25>] ? worker_thread+0x145/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106f786>] ? kthread+0x96/0xa0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106f6f0>] ? kthread+0x0/0xa0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89
> fc 55 53 89 d3 48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4
> 00 00 00 <4
> 9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RSP <ffff88045fc89d30>
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CR2: 0000000000002458
>
>
> If someone can help me, on how to solve this.
>
> Regards.
> begin:vcard
> fn:Jean-Philippe Menil
> n:Menil;Jean-Philippe
> org;quoted-printable:Universit=C3=A9 de Nantes;IRTS
> adr;dom:;;;Nantes
> email;internet:jean-philippe.menil@univ-nantes.fr
> title:Reseau
> tel;work:02.53.48.49.27
> tel;fax:02.53.48.49.97
> x-mozilla-html:FALSE
> version:2.1
> end:vcard
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* RE: [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
From: KY Srinivasan @ 2011-02-26 17:13 UTC (permalink / raw)
To: Steven Rostedt, r@home.goodmis.org
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Hank Janssen
In-Reply-To: <20110226032122.GA25737@home.goodmis.org>
> -----Original Message-----
> From: Steven Rostedt [mailto:rostedt@goodmis.org]
> Sent: Friday, February 25, 2011 10:21 PM
> To: KY Srinivasan; r@home.goodmis.org
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang; Hank
> Janssen
> Subject: Re: [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
>
> Hi!
>
> Just an FYI,
>
> When sending out patch series, could you send out a [PATCH 0/6] first,
> and have all other patches a reply to that patch. Both git and quilt
> have ways to do this.
My mistake; I numbered the patches 1 through 6 as opposed to 0 through 5.
Sorry for the confusion.
Regards,
K. Y
^ permalink raw reply
* RE: [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names
From: KY Srinivasan @ 2011-02-26 17:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org
In-Reply-To: <20110226033323.GD18043@bicker>
> -----Original Message-----
> From: Dan Carpenter [mailto:error27@gmail.com]
> Sent: Friday, February 25, 2011 10:33 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org
> Subject: Re: [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names
>
> On Fri, Feb 25, 2011 at 06:06:32PM -0800, K. Y. Srinivasan wrote:
> > Cleanup the names of variables that refer to the
> > hyperv_device abstraction.
> >
>
> I have a script I run on rename patches. For this patch the
> command would be:
>
> rename_rev.pl -nc -e 's/device_ctx/device_obj/g' -e 's/\bdev_ctx/dev/g'
>
> It show one variable was missed in storvsc_probe().
>
> > memset(host_device_ctx, 0, sizeof(struct host_device_context));
> >
> > host_device_ctx->port = host->host_no;
> > - host_device_ctx->device_ctx = device_obj;
> > + host_device_ctx->device_obj = device_obj;
> >
> > host_device_ctx->request_pool =
> > kmem_cache_create(dev_name(&device_obj-
> >device),
> > @@ -271,7 +271,7 @@ static int storvsc_probe(struct device *device)
> > return -1;
> > }
> >
> > - /* host_device_ctx->port = device_info.PortNumber; */
> > + /* host_hyperv_dev->port = device_info.PortNumber; */
> > host_device_ctx->path = device_info.path_id;
> > host_device_ctx->target = device_info.target_id;
> >
>
> All the other host_device_ctx variables were renamed to host_device_obj.
host_device_ctx is a scsi abstraction built on top of the hyperv_device
abstraction. My goal was not to change the names of higher level scsi
abstractions.
Regards,
K. Y
>
> regards,
> dan carpenter
^ permalink raw reply
* RE: [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
From: KY Srinivasan @ 2011-02-26 17:13 UTC (permalink / raw)
To: Steven Rostedt, r@home.goodmis.org
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Hank Janssen
In-Reply-To: <20110226032122.GA25737@home.goodmis.org>
> -----Original Message-----
> From: Steven Rostedt [mailto:rostedt@goodmis.org]
> Sent: Friday, February 25, 2011 10:21 PM
> To: KY Srinivasan; r@home.goodmis.org
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang; Hank
> Janssen
> Subject: Re: [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
>
> Hi!
>
> Just an FYI,
>
> When sending out patch series, could you send out a [PATCH 0/6] first,
> and have all other patches a reply to that patch. Both git and quilt
> have ways to do this.
My mistake; I numbered them 1 through 6 instead of 0 through 5.
Sorry for the confusion.
Regards,
K. Y
^ permalink raw reply
* RE: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names
From: KY Srinivasan @ 2011-02-26 17:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org
In-Reply-To: <20110226034039.GE18043@bicker>
> -----Original Message-----
> From: Dan Carpenter [mailto:error27@gmail.com]
> Sent: Friday, February 25, 2011 10:41 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org
> Subject: Re: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names
>
> On Fri, Feb 25, 2011 at 06:07:58PM -0800, K. Y. Srinivasan wrote:
> > The title says it all.
> >
>
> For this patch the rename_rev.pl command is:
>
> rename_rev.pl -nc -e 's/(drv|driver)_ctx/drv/g'
>
> > --- a/drivers/staging/hv/vmbus_drv.c
> > +++ b/drivers/staging/hv/vmbus_drv.c
> > @@ -46,7 +46,7 @@ struct vmbus_hyperv_driver {
> > /* FIXME, this is a bug */
> > /* The driver field is not used in here. Instead, the bus field is */
> > /* used to represent the driver */
> ^^
> This comment out of date now that we're using container_of().
This requirement is for a different reason. We had patch out last Wednesday
To address this but was rejected by Greg for other reasons.
What is happening here is that in the vmbus_match function we
need to get at a certain field in a driver agnostic way. This hack solves
the problem. It will be removed once this series goes in.
>
> > - struct hyperv_driver drv_ctx;
> > + struct hyperv_driver dummy;
> ^^^^^
> Delete.
This is the hack I talked about earlier. This will go away
once this series goes in.
>
> > @@ -849,18 +849,18 @@ static int vmbus_uevent(struct device *device, struct
> kobj_uevent_env *env)
> > static int vmbus_match(struct device *device, struct device_driver *driver)
> > {
> > int match = 0;
> > - struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);
> > + struct hyperv_driver *drv = driver_to_hyperv_driver(driver);
> > struct hyperv_device *device_obj = device_to_hyperv_device(device);
> >
> > /* We found our driver ? */
> > - if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
> > + if (memcmp(&device_obj->class_id, &drv->class_id,
> > sizeof(struct hv_guid)) == 0) {
> > /*
> > - * !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
> > + * !! NOTE: The drv is not a vmbus_drv_ctx. We typecast
> ^^^^
> Out of date.
This hack is still required. We will get rid of this shortly.
Regards,
K. Y
>
> regards,
> dan carpenter
^ permalink raw reply
* Re: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names
From: Dan Carpenter @ 2011-02-26 3:40 UTC (permalink / raw)
To: K. Y. Srinivasan; +Cc: gregkh, linux-kernel, devel, virtualization
In-Reply-To: <1298686078-30945-1-git-send-email-kys@microsoft.com>
On Fri, Feb 25, 2011 at 06:07:58PM -0800, K. Y. Srinivasan wrote:
> The title says it all.
>
For this patch the rename_rev.pl command is:
rename_rev.pl -nc -e 's/(drv|driver)_ctx/drv/g'
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -46,7 +46,7 @@ struct vmbus_hyperv_driver {
> /* FIXME, this is a bug */
> /* The driver field is not used in here. Instead, the bus field is */
> /* used to represent the driver */
^^
This comment out of date now that we're using container_of().
> - struct hyperv_driver drv_ctx;
> + struct hyperv_driver dummy;
^^^^^
Delete.
> @@ -849,18 +849,18 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
> static int vmbus_match(struct device *device, struct device_driver *driver)
> {
> int match = 0;
> - struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);
> + struct hyperv_driver *drv = driver_to_hyperv_driver(driver);
> struct hyperv_device *device_obj = device_to_hyperv_device(device);
>
> /* We found our driver ? */
> - if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
> + if (memcmp(&device_obj->class_id, &drv->class_id,
> sizeof(struct hv_guid)) == 0) {
> /*
> - * !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
> + * !! NOTE: The drv is not a vmbus_drv_ctx. We typecast
^^^^
Out of date.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names
From: Dan Carpenter @ 2011-02-26 3:33 UTC (permalink / raw)
To: K. Y. Srinivasan; +Cc: devel, gregkh, linux-kernel, virtualization
In-Reply-To: <1298685992-30864-1-git-send-email-kys@microsoft.com>
On Fri, Feb 25, 2011 at 06:06:32PM -0800, K. Y. Srinivasan wrote:
> Cleanup the names of variables that refer to the
> hyperv_device abstraction.
>
I have a script I run on rename patches. For this patch the
command would be:
rename_rev.pl -nc -e 's/device_ctx/device_obj/g' -e 's/\bdev_ctx/dev/g'
It show one variable was missed in storvsc_probe().
> memset(host_device_ctx, 0, sizeof(struct host_device_context));
>
> host_device_ctx->port = host->host_no;
> - host_device_ctx->device_ctx = device_obj;
> + host_device_ctx->device_obj = device_obj;
>
> host_device_ctx->request_pool =
> kmem_cache_create(dev_name(&device_obj->device),
> @@ -271,7 +271,7 @@ static int storvsc_probe(struct device *device)
> return -1;
> }
>
> - /* host_device_ctx->port = device_info.PortNumber; */
> + /* host_hyperv_dev->port = device_info.PortNumber; */
> host_device_ctx->path = device_info.path_id;
> host_device_ctx->target = device_info.target_id;
>
All the other host_device_ctx variables were renamed to host_device_obj.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
From: Steven Rostedt @ 2011-02-26 3:21 UTC (permalink / raw)
To: K. Y. Srinivasan, r
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Hank Janssen
In-Reply-To: <1298685930-30806-1-git-send-email-kys@microsoft.com>
Hi!
Just an FYI,
When sending out patch series, could you send out a [PATCH 0/6] first,
and have all other patches a reply to that patch. Both git and quilt
have ways to do this.
The reason is that the linux kernel mailing list gets over 600 emails a
day, and for those of us that skim through, we like to hit [make thread
as read] when we are not interested in the thread or patch set. When
people send out a set of patches that are all individual, this means I
need to hit this command for every patch.
Also do not think I'm just picking on you. I've complained to several
people about doing this. One just recently sent out 21 patches.
Thanks,
-- Steve
^ permalink raw reply
* [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names
From: K. Y. Srinivasan @ 2011-02-26 2:07 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
The title says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 46 +++++++++++++++---------------
drivers/staging/hv/netvsc_drv.c | 44 +++++++++++++++---------------
drivers/staging/hv/storvsc_drv.c | 36 ++++++++++++------------
drivers/staging/hv/vmbus.h | 4 +-
drivers/staging/hv/vmbus_drv.c | 56 +++++++++++++++++++-------------------
5 files changed, 93 insertions(+), 93 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index ceba20c..c924920 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -119,7 +119,7 @@ struct block_device_context {
struct blkvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* FIXME this is a bug! */
- struct hyperv_driver drv_ctx;
+ struct hyperv_driver drv;
struct storvsc_driver_object drv_obj;
};
@@ -174,7 +174,7 @@ static const struct block_device_operations block_ops = {
static int blkvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_blkvsc_drv.drv;
int ret;
storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
@@ -182,16 +182,16 @@ static int blkvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
/* Callback to client driver to complete the initialization */
drv_init(&storvsc_drv_obj->base);
- drv_ctx->driver.name = storvsc_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.class_id,
+ drv->driver.name = storvsc_drv_obj->base.name;
+ memcpy(&drv->class_id, &storvsc_drv_obj->base.class_id,
sizeof(struct hv_guid));
- drv_ctx->probe = blkvsc_probe;
- drv_ctx->remove = blkvsc_remove;
- drv_ctx->shutdown = blkvsc_shutdown;
+ drv->probe = blkvsc_probe;
+ drv->remove = blkvsc_remove;
+ drv->shutdown = blkvsc_shutdown;
/* The driver belongs to vmbus */
- ret = vmbus_child_driver_register(drv_ctx);
+ ret = vmbus_child_driver_register(drv);
return ret;
}
@@ -206,7 +206,7 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)
static void blkvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_blkvsc_drv.drv;
struct device *current_dev;
int ret;
@@ -214,7 +214,7 @@ static void blkvsc_drv_exit(void)
current_dev = NULL;
/* Get the device */
- ret = driver_for_each_device(&drv_ctx->driver, NULL,
+ ret = driver_for_each_device(&drv->driver, NULL,
(void *) ¤t_dev,
blkvsc_drv_exit_cb);
@@ -233,7 +233,7 @@ static void blkvsc_drv_exit(void)
if (storvsc_drv_obj->base.cleanup)
storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
- vmbus_child_driver_unregister(drv_ctx);
+ vmbus_child_driver_unregister(drv);
return;
}
@@ -243,12 +243,12 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct device *device)
{
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
- struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
- (struct blkvsc_hyperv_driver *)driver_ctx;
+ struct blkvsc_hyperv_driver *blkvsc_drv =
+ (struct blkvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
- &blkvsc_drv_ctx->drv_obj;
+ &blkvsc_drv->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct block_device_context *blkdev = NULL;
@@ -727,12 +727,12 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
*/
static int blkvsc_remove(struct device *device)
{
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
- struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
- (struct blkvsc_hyperv_driver *)driver_ctx;
+ struct blkvsc_hyperv_driver *blkvsc_drv =
+ (struct blkvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
- &blkvsc_drv_ctx->drv_obj;
+ &blkvsc_drv->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
@@ -849,12 +849,12 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct hyperv_device *device_obj = blkdev->device_obj;
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device_obj->device.driver);
- struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
- (struct blkvsc_hyperv_driver *)driver_ctx;
+ struct blkvsc_hyperv_driver *blkvsc_drv =
+ (struct blkvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
- &blkvsc_drv_ctx->drv_obj;
+ &blkvsc_drv->drv_obj;
struct hv_storvsc_request *storvsc_req;
int ret;
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 359d596..af1f9eb 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -51,7 +51,7 @@ struct net_device_context {
struct netvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* Which is a bug FIXME! */
- struct hyperv_driver drv_ctx;
+ struct hyperv_driver drv;
struct netvsc_driver drv_obj;
};
@@ -135,11 +135,11 @@ static void netvsc_xmit_completion(void *context)
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{
struct net_device_context *net_device_obj = netdev_priv(net);
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(net_device_obj->device_obj->device.driver);
- struct netvsc_hyperv_driver *net_drv_ctx =
- (struct netvsc_hyperv_driver *)driver_ctx;
- struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
+ struct netvsc_hyperv_driver *net_drv =
+ (struct netvsc_hyperv_driver *)drv;
+ struct netvsc_driver *net_drv_obj = &net_drv->drv_obj;
struct hv_netvsc_packet *packet;
int ret;
unsigned int i, num_pages;
@@ -338,11 +338,11 @@ static const struct net_device_ops device_ops = {
static int netvsc_probe(struct device *device)
{
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
- struct netvsc_hyperv_driver *net_drv_ctx =
- (struct netvsc_hyperv_driver *)driver_ctx;
- struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
+ struct netvsc_hyperv_driver *net_drv =
+ (struct netvsc_hyperv_driver *)drv;
+ struct netvsc_driver *net_drv_obj = &net_drv->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = NULL;
struct net_device_context *net_device_obj;
@@ -409,11 +409,11 @@ static int netvsc_probe(struct device *device)
static int netvsc_remove(struct device *device)
{
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
- struct netvsc_hyperv_driver *net_drv_ctx =
- (struct netvsc_hyperv_driver *)driver_ctx;
- struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
+ struct netvsc_hyperv_driver *net_drv =
+ (struct netvsc_hyperv_driver *)drv;
+ struct netvsc_driver *net_drv_obj = &net_drv->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret;
@@ -458,7 +458,7 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)
static void netvsc_drv_exit(void)
{
struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_netvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_netvsc_drv.drv;
struct device *current_dev;
int ret;
@@ -466,7 +466,7 @@ static void netvsc_drv_exit(void)
current_dev = NULL;
/* Get the device */
- ret = driver_for_each_device(&drv_ctx->driver, NULL,
+ ret = driver_for_each_device(&drv->driver, NULL,
¤t_dev, netvsc_drv_exit_cb);
if (ret)
DPRINT_WARN(NETVSC_DRV,
@@ -485,7 +485,7 @@ static void netvsc_drv_exit(void)
if (netvsc_drv_obj->base.cleanup)
netvsc_drv_obj->base.cleanup(&netvsc_drv_obj->base);
- vmbus_child_driver_unregister(drv_ctx);
+ vmbus_child_driver_unregister(drv);
return;
}
@@ -493,7 +493,7 @@ static void netvsc_drv_exit(void)
static int netvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
struct netvsc_driver *net_drv_obj = &g_netvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_netvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_netvsc_drv.drv;
int ret;
net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
@@ -503,15 +503,15 @@ static int netvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
/* Callback to client driver to complete the initialization */
drv_init(&net_drv_obj->base);
- drv_ctx->driver.name = net_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &net_drv_obj->base.class_id,
+ drv->driver.name = net_drv_obj->base.name;
+ memcpy(&drv->class_id, &net_drv_obj->base.class_id,
sizeof(struct hv_guid));
- drv_ctx->probe = netvsc_probe;
- drv_ctx->remove = netvsc_remove;
+ drv->probe = netvsc_probe;
+ drv->remove = netvsc_remove;
/* The driver belongs to vmbus */
- ret = vmbus_child_driver_register(drv_ctx);
+ ret = vmbus_child_driver_register(drv);
return ret;
}
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 659d385..28f6568 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -67,7 +67,7 @@ struct storvsc_cmd_request {
struct storvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* FIXME this is a bug... */
- struct hyperv_driver drv_ctx;
+ struct hyperv_driver drv;
struct storvsc_driver_object drv_obj;
};
@@ -139,7 +139,7 @@ static int storvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_storvsc_drv.drv;
storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
@@ -161,15 +161,15 @@ static int storvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
return -1;
}
- drv_ctx->driver.name = storvsc_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.class_id,
+ drv->driver.name = storvsc_drv_obj->base.name;
+ memcpy(&drv->class_id, &storvsc_drv_obj->base.class_id,
sizeof(struct hv_guid));
- drv_ctx->probe = storvsc_probe;
- drv_ctx->remove = storvsc_remove;
+ drv->probe = storvsc_probe;
+ drv->remove = storvsc_remove;
/* The driver belongs to vmbus */
- ret = vmbus_child_driver_register(drv_ctx);
+ ret = vmbus_child_driver_register(drv);
return ret;
}
@@ -184,7 +184,7 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)
static void storvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hyperv_driver *drv = &g_storvsc_drv.drv;
struct device *current_dev = NULL;
int ret;
@@ -192,7 +192,7 @@ static void storvsc_drv_exit(void)
current_dev = NULL;
/* Get the device */
- ret = driver_for_each_device(&drv_ctx->driver, NULL,
+ ret = driver_for_each_device(&drv->driver, NULL,
(void *) ¤t_dev,
storvsc_drv_exit_cb);
@@ -210,7 +210,7 @@ static void storvsc_drv_exit(void)
if (storvsc_drv_obj->base.cleanup)
storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
- vmbus_child_driver_unregister(drv_ctx);
+ vmbus_child_driver_unregister(drv);
return;
}
@@ -220,12 +220,12 @@ static void storvsc_drv_exit(void)
static int storvsc_probe(struct device *device)
{
int ret;
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
- struct storvsc_hyperv_driver *storvsc_drv_ctx =
- (struct storvsc_hyperv_driver *)driver_ctx;
+ struct storvsc_hyperv_driver *storvsc_drv =
+ (struct storvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
- &storvsc_drv_ctx->drv_obj;
+ &storvsc_drv->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
@@ -304,10 +304,10 @@ static int storvsc_probe(struct device *device)
static int storvsc_remove(struct device *device)
{
int ret;
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device->driver);
struct storvsc_hyperv_driver *storvsc_drv_ctx =
- (struct storvsc_hyperv_driver *)driver_ctx;
+ (struct storvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -601,10 +601,10 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
struct host_device_context *host_device_obj =
(struct host_device_context *)scmnd->device->host->hostdata;
struct hyperv_device *device_obj = host_device_obj->device_obj;
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(device_obj->device.driver);
struct storvsc_hyperv_driver *storvsc_drv_ctx =
- (struct storvsc_hyperv_driver *)driver_ctx;
+ (struct storvsc_hyperv_driver *)drv;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hv_storvsc_request *request;
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index 617c3ed..65efb49 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -77,8 +77,8 @@ driver_to_hyperv_driver(struct device_driver *d)
/* Vmbus interface */
-int vmbus_child_driver_register(struct hyperv_driver *driver_ctx);
-void vmbus_child_driver_unregister(struct hyperv_driver *driver_ctx);
+int vmbus_child_driver_register(struct hyperv_driver *drv);
+void vmbus_child_driver_unregister(struct hyperv_driver *drv);
extern struct completion hv_channel_ready;
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index c7e8a36..40c641f 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -46,7 +46,7 @@ struct vmbus_hyperv_driver {
/* FIXME, this is a bug */
/* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */
- struct hyperv_driver drv_ctx;
+ struct hyperv_driver dummy;
struct hyperv_driver drv_obj;
struct bus_type bus;
@@ -613,9 +613,9 @@ static void vmbus_bus_exit(void)
/**
* vmbus_child_driver_register() - Register a vmbus's child driver
- * @driver_ctx: Pointer to driver structure you want to register
+ * @drv: Pointer to driver structure you want to register
*
- * @driver_ctx is of type &struct hyperv_driver
+ * @drv is of type &struct hyperv_driver
*
* Registers the given driver with Linux through the 'driver_register()' call
* And sets up the hyper-v vmbus handling for this driver.
@@ -623,17 +623,17 @@ static void vmbus_bus_exit(void)
*
* Mainly used by Hyper-V drivers.
*/
-int vmbus_child_driver_register(struct hyperv_driver *driver_ctx)
+int vmbus_child_driver_register(struct hyperv_driver *drv)
{
int ret;
DPRINT_INFO(VMBUS_DRV, "child driver (%p) registering - name %s",
- driver_ctx, driver_ctx->driver.name);
+ drv, drv->driver.name);
/* The child driver on this vmbus */
- driver_ctx->driver.bus = &vmbus_drv.bus;
+ drv->driver.bus = &vmbus_drv.bus;
- ret = driver_register(&driver_ctx->driver);
+ ret = driver_register(&drv->driver);
vmbus_request_offers();
@@ -643,23 +643,23 @@ EXPORT_SYMBOL(vmbus_child_driver_register);
/**
* vmbus_child_driver_unregister() - Unregister a vmbus's child driver
- * @driver_ctx: Pointer to driver structure you want to un-register
+ * @drv: Pointer to driver structure you want to un-register
*
- * @driver_ctx is of type &struct hyperv_driver
+ * @drv is of type &struct hyperv_driver
*
* Un-register the given driver with Linux through the 'driver_unregister()'
* call. And ungegisters the driver from the Hyper-V vmbus handler.
*
* Mainly used by Hyper-V drivers.
*/
-void vmbus_child_driver_unregister(struct hyperv_driver *driver_ctx)
+void vmbus_child_driver_unregister(struct hyperv_driver *drv)
{
DPRINT_INFO(VMBUS_DRV, "child driver (%p) unregistering - name %s",
- driver_ctx, driver_ctx->driver.name);
+ drv, drv->driver.name);
- driver_unregister(&driver_ctx->driver);
+ driver_unregister(&drv->driver);
- driver_ctx->driver.bus = NULL;
+ drv->driver.bus = NULL;
}
EXPORT_SYMBOL(vmbus_child_driver_unregister);
@@ -849,18 +849,18 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
static int vmbus_match(struct device *device, struct device_driver *driver)
{
int match = 0;
- struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);
+ struct hyperv_driver *drv = driver_to_hyperv_driver(driver);
struct hyperv_device *device_obj = device_to_hyperv_device(device);
/* We found our driver ? */
- if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
+ if (memcmp(&device_obj->class_id, &drv->class_id,
sizeof(struct hv_guid)) == 0) {
/*
- * !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
+ * !! NOTE: The drv is not a vmbus_drv_ctx. We typecast
* it here to access the struct hyperv_driver field
*/
struct vmbus_hyperv_driver *vmbus_drv_ctx =
- (struct vmbus_hyperv_driver *)driver_ctx;
+ (struct vmbus_hyperv_driver *)drv;
device_obj->drv = &vmbus_drv_ctx->drv_obj;
DPRINT_INFO(VMBUS_DRV,
@@ -899,14 +899,14 @@ static void vmbus_probe_failed_cb(struct work_struct *context)
static int vmbus_probe(struct device *child_device)
{
int ret = 0;
- struct hyperv_driver *driver_ctx =
+ struct hyperv_driver *drv =
driver_to_hyperv_driver(child_device->driver);
struct hyperv_device *device_obj =
device_to_hyperv_device(child_device);
/* Let the specific open-source driver handles the probe if it can */
- if (driver_ctx->probe) {
- ret = device_obj->probe_error = driver_ctx->probe(child_device);
+ if (drv->probe) {
+ ret = device_obj->probe_error = drv->probe(child_device);
if (ret != 0) {
DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s "
"(%p) on driver %s (%d)...",
@@ -931,7 +931,7 @@ static int vmbus_probe(struct device *child_device)
static int vmbus_remove(struct device *child_device)
{
int ret;
- struct hyperv_driver *driver_ctx;
+ struct hyperv_driver *drv;
/* Special case root bus device */
if (child_device->parent == NULL) {
@@ -943,14 +943,14 @@ static int vmbus_remove(struct device *child_device)
}
if (child_device->driver) {
- driver_ctx = driver_to_hyperv_driver(child_device->driver);
+ drv = driver_to_hyperv_driver(child_device->driver);
/*
* Let the specific open-source driver handles the removal if
* it can
*/
- if (driver_ctx->remove) {
- ret = driver_ctx->remove(child_device);
+ if (drv->remove) {
+ ret = drv->remove(child_device);
} else {
DPRINT_ERR(VMBUS_DRV,
"remove() method not set for driver - %s",
@@ -967,7 +967,7 @@ static int vmbus_remove(struct device *child_device)
*/
static void vmbus_shutdown(struct device *child_device)
{
- struct hyperv_driver *driver_ctx;
+ struct hyperv_driver *drv;
/* Special case root bus device */
if (child_device->parent == NULL) {
@@ -982,11 +982,11 @@ static void vmbus_shutdown(struct device *child_device)
if (!child_device->driver)
return;
- driver_ctx = driver_to_hyperv_driver(child_device->driver);
+ drv = driver_to_hyperv_driver(child_device->driver);
/* Let the specific open-source driver handles the removal if it can */
- if (driver_ctx->shutdown)
- driver_ctx->shutdown(child_device);
+ if (drv->shutdown)
+ drv->shutdown(child_device);
return;
}
--
1.5.5.6
^ permalink raw reply related
* [PATCH 5/6] Staging: hv: Rename driver_context to hyperv_driver
From: K. Y. Srinivasan @ 2011-02-26 2:07 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
The title says it all.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc.c | 2 +-
drivers/staging/hv/blkvsc_drv.c | 36 ++++++++++++------------
drivers/staging/hv/netvsc.c | 6 ++--
drivers/staging/hv/netvsc_api.h | 4 +-
drivers/staging/hv/netvsc_drv.c | 36 ++++++++++++------------
drivers/staging/hv/rndis_filter.c | 4 +-
drivers/staging/hv/storvsc.c | 4 +-
drivers/staging/hv/storvsc_api.h | 6 ++--
drivers/staging/hv/storvsc_drv.c | 36 ++++++++++++------------
drivers/staging/hv/vmbus.h | 15 +++++-----
drivers/staging/hv/vmbus_api.h | 2 +-
drivers/staging/hv/vmbus_drv.c | 54 ++++++++++++++++++------------------
12 files changed, 103 insertions(+), 102 deletions(-)
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index d29af4b..51d4dfa 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -63,7 +63,7 @@ blk_vsc_on_device_add(struct hyperv_device *device, void *additional_info)
return ret;
}
-int blk_vsc_initialize(struct driver_context *driver)
+int blk_vsc_initialize(struct hyperv_driver *driver)
{
struct storvsc_driver_object *stor_driver;
int ret = 0;
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index a280f83..ceba20c 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -116,10 +116,10 @@ struct block_device_context {
};
/* Per driver */
-struct blkvsc_driver_context {
+struct blkvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* FIXME this is a bug! */
- struct driver_context drv_ctx;
+ struct hyperv_driver drv_ctx;
struct storvsc_driver_object drv_obj;
};
@@ -156,7 +156,7 @@ module_param(blkvsc_ringbuffer_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (in bytes)");
/* The one and only one */
-static struct blkvsc_driver_context g_blkvsc_drv;
+static struct blkvsc_hyperv_driver g_blkvsc_drv;
static const struct block_device_operations block_ops = {
.owner = THIS_MODULE,
@@ -171,10 +171,10 @@ static const struct block_device_operations block_ops = {
/*
* blkvsc_drv_init - BlkVsc driver initialization.
*/
-static int blkvsc_drv_init(int (*drv_init)(struct driver_context *drv))
+static int blkvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
int ret;
storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
@@ -206,7 +206,7 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)
static void blkvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
struct device *current_dev;
int ret;
@@ -243,10 +243,10 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct device *device)
{
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct blkvsc_driver_context *blkvsc_drv_ctx =
- (struct blkvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
+ (struct blkvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -727,10 +727,10 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
*/
static int blkvsc_remove(struct device *device)
{
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct blkvsc_driver_context *blkvsc_drv_ctx =
- (struct blkvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
+ (struct blkvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -849,10 +849,10 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct hyperv_device *device_obj = blkdev->device_obj;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device_obj->device.driver);
- struct blkvsc_driver_context *blkvsc_drv_ctx =
- (struct blkvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device_obj->device.driver);
+ struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
+ (struct blkvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct hv_storvsc_request *storvsc_req;
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 6d8d0a3..5d41bdf 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -49,7 +49,7 @@ netvsc_device_add(struct hyperv_device *device, void *additional_info);
static int netvsc_device_remove(struct hyperv_device *device);
-static void netvsc_cleanup(struct driver_context *driver);
+static void netvsc_cleanup(struct hyperv_driver *driver);
static void netvsc_channel_cb(void *context);
@@ -178,7 +178,7 @@ static struct netvsc_device *release_inbound_net_device(
/*
* netvsc_initialize - Main entry point
*/
-int netvsc_initialize(struct driver_context *drv)
+int netvsc_initialize(struct hyperv_driver *drv)
{
struct netvsc_driver *driver = (struct netvsc_driver *)drv;
@@ -837,7 +837,7 @@ static int netvsc_device_remove(struct hyperv_device *device)
/*
* netvsc_cleanup - Perform any cleanup when the driver is removed
*/
-static void netvsc_cleanup(struct driver_context *drv)
+static void netvsc_cleanup(struct hyperv_driver *drv)
{
}
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index 842f542..a96cce4 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -84,7 +84,7 @@ struct hv_netvsc_packet {
struct netvsc_driver {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct driver_context base;
+ struct hyperv_driver base;
u32 ring_buf_size;
u32 req_ext_size;
@@ -109,7 +109,7 @@ struct netvsc_device_info {
};
/* Interface */
-int netvsc_initialize(struct driver_context *drv);
+int netvsc_initialize(struct hyperv_driver *drv);
int rndis_filter_open(struct hyperv_device *dev);
int rndis_filter_close(struct hyperv_device *dev);
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index fbb32f7..359d596 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -48,10 +48,10 @@ struct net_device_context {
unsigned long avail;
};
-struct netvsc_driver_context {
+struct netvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* Which is a bug FIXME! */
- struct driver_context drv_ctx;
+ struct hyperv_driver drv_ctx;
struct netvsc_driver drv_obj;
};
@@ -64,7 +64,7 @@ module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
/* The one and only one */
-static struct netvsc_driver_context g_netvsc_drv;
+static struct netvsc_hyperv_driver g_netvsc_drv;
/* no-op so the netdev core doesn't return -EINVAL when modifying the the
* multicast address list in SIOCADDMULTI. hv is setup to get all multicast
@@ -135,10 +135,10 @@ static void netvsc_xmit_completion(void *context)
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{
struct net_device_context *net_device_obj = netdev_priv(net);
- struct driver_context *driver_ctx =
- driver_to_driver_context(net_device_obj->device_obj->device.driver);
- struct netvsc_driver_context *net_drv_ctx =
- (struct netvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(net_device_obj->device_obj->device.driver);
+ struct netvsc_hyperv_driver *net_drv_ctx =
+ (struct netvsc_hyperv_driver *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hv_netvsc_packet *packet;
int ret;
@@ -338,10 +338,10 @@ static const struct net_device_ops device_ops = {
static int netvsc_probe(struct device *device)
{
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct netvsc_driver_context *net_drv_ctx =
- (struct netvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct netvsc_hyperv_driver *net_drv_ctx =
+ (struct netvsc_hyperv_driver *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = NULL;
@@ -409,10 +409,10 @@ static int netvsc_probe(struct device *device)
static int netvsc_remove(struct device *device)
{
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct netvsc_driver_context *net_drv_ctx =
- (struct netvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct netvsc_hyperv_driver *net_drv_ctx =
+ (struct netvsc_hyperv_driver *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
@@ -458,7 +458,7 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)
static void netvsc_drv_exit(void)
{
struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_netvsc_drv.drv_ctx;
struct device *current_dev;
int ret;
@@ -490,10 +490,10 @@ static void netvsc_drv_exit(void)
return;
}
-static int netvsc_drv_init(int (*drv_init)(struct driver_context *drv))
+static int netvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
struct netvsc_driver *net_drv_obj = &g_netvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_netvsc_drv.drv_ctx;
int ret;
net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index a2b5f4d..a8f7927 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -90,7 +90,7 @@ static int rndis_filte_device_add(struct hyperv_device *dev,
static int rndis_filter_device_remove(struct hyperv_device *dev);
-static void rndis_filter_cleanup(struct driver_context *drv);
+static void rndis_filter_cleanup(struct hyperv_driver *drv);
static int rndis_filter_send(struct hyperv_device *dev,
struct hv_netvsc_packet *pkt);
@@ -834,7 +834,7 @@ static int rndis_filter_device_remove(struct hyperv_device *dev)
return 0;
}
-static void rndis_filter_cleanup(struct driver_context *drv)
+static void rndis_filter_cleanup(struct hyperv_driver *drv)
{
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index c86bc68..d17df6a 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -781,14 +781,14 @@ static int stor_vsc_on_io_request(struct hyperv_device *device,
/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-static void stor_vsc_on_cleanup(struct driver_context *driver)
+static void stor_vsc_on_cleanup(struct hyperv_driver *driver)
{
}
/*
* stor_vsc_initialize - Main entry point
*/
-int stor_vsc_initialize(struct driver_context *driver)
+int stor_vsc_initialize(struct hyperv_driver *driver)
{
struct storvsc_driver_object *stor_driver;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index b488d75..e105929 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -80,7 +80,7 @@ struct hv_storvsc_request {
struct storvsc_driver_object {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct driver_context base;
+ struct hyperv_driver base;
/* Set by caller (in bytes) */
u32 ring_buffer_size;
@@ -103,8 +103,8 @@ struct storvsc_device_info {
};
/* Interface */
-int stor_vsc_initialize(struct driver_context *driver);
+int stor_vsc_initialize(struct hyperv_driver *driver);
int stor_vsc_on_host_reset(struct hyperv_device *device);
-int blk_vsc_initialize(struct driver_context *driver);
+int blk_vsc_initialize(struct hyperv_driver *driver);
#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 282bd66..659d385 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -64,10 +64,10 @@ struct storvsc_cmd_request {
* Which sounds like a very bad design... */
};
-struct storvsc_driver_context {
+struct storvsc_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* FIXME this is a bug... */
- struct driver_context drv_ctx;
+ struct hyperv_driver drv_ctx;
struct storvsc_driver_object drv_obj;
};
@@ -101,7 +101,7 @@ module_param(storvsc_ringbuffer_size, int, S_IRUGO);
MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
/* The one and only one */
-static struct storvsc_driver_context g_storvsc_drv;
+static struct storvsc_hyperv_driver g_storvsc_drv;
/* Scsi driver */
static struct scsi_host_template scsi_driver = {
@@ -135,11 +135,11 @@ static struct scsi_host_template scsi_driver = {
/*
* storvsc_drv_init - StorVsc driver initialization.
*/
-static int storvsc_drv_init(int (*drv_init)(struct driver_context *drv))
+static int storvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
@@ -184,7 +184,7 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)
static void storvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
struct device *current_dev = NULL;
int ret;
@@ -220,10 +220,10 @@ static void storvsc_drv_exit(void)
static int storvsc_probe(struct device *device)
{
int ret;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct storvsc_hyperv_driver *storvsc_drv_ctx =
+ (struct storvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -304,10 +304,10 @@ static int storvsc_probe(struct device *device)
static int storvsc_remove(struct device *device)
{
int ret;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
- struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device->driver);
+ struct storvsc_hyperv_driver *storvsc_drv_ctx =
+ (struct storvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -601,10 +601,10 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
struct host_device_context *host_device_obj =
(struct host_device_context *)scmnd->device->host->hostdata;
struct hyperv_device *device_obj = host_device_obj->device_obj;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device_obj->device.driver);
- struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(device_obj->device.driver);
+ struct storvsc_hyperv_driver *storvsc_drv_ctx =
+ (struct storvsc_hyperv_driver *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hv_storvsc_request *request;
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index cad8b4c..617c3ed 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -28,7 +28,7 @@
#include <linux/device.h>
#include "vmbus_api.h"
-struct driver_context {
+struct hyperv_driver {
const char *name;
struct hv_guid class_id;
@@ -37,7 +37,7 @@ struct driver_context {
int (*dev_rm)(struct hyperv_device *device);
- void (*cleanup)(struct driver_context *driver);
+ void (*cleanup)(struct hyperv_driver *driver);
struct device_driver driver;
@@ -56,7 +56,7 @@ struct hyperv_device {
struct work_struct probe_failed_work_item;
struct hv_guid class_id; /* device type id */
struct hv_guid device_id; /* device instance id */
- struct driver_context *drv;
+ struct hyperv_driver *drv;
int probe_error;
struct vmbus_channel *channel; /* associated channel to host*/
void *ext;
@@ -69,15 +69,16 @@ static inline struct hyperv_device *device_to_hyperv_device(struct device *d)
return container_of(d, struct hyperv_device, device);
}
-static inline struct driver_context *driver_to_driver_context(struct device_driver *d)
+static inline struct hyperv_driver *
+driver_to_hyperv_driver(struct device_driver *d)
{
- return container_of(d, struct driver_context, driver);
+ return container_of(d, struct hyperv_driver, driver);
}
/* Vmbus interface */
-int vmbus_child_driver_register(struct driver_context *driver_ctx);
-void vmbus_child_driver_unregister(struct driver_context *driver_ctx);
+int vmbus_child_driver_register(struct hyperv_driver *driver_ctx);
+void vmbus_child_driver_unregister(struct hyperv_driver *driver_ctx);
extern struct completion hv_channel_ready;
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 0d8232e..6e3e1a8 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -55,7 +55,7 @@ struct hv_multipage_buffer {
#pragma pack(pop)
-struct driver_context;
+struct hyperv_driver;
struct hyperv_device;
struct hv_dev_port_info {
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 3922a07..c7e8a36 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -41,13 +41,13 @@
#define VMBUS_IRQ_VECTOR IRQ5_VECTOR
/* Main vmbus driver data structure */
-struct vmbus_driver_context {
+struct vmbus_hyperv_driver {
/* !! These must be the first 2 fields !! */
/* FIXME, this is a bug */
/* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */
- struct driver_context drv_ctx;
- struct driver_context drv_obj;
+ struct hyperv_driver drv_ctx;
+ struct hyperv_driver drv_obj;
struct bus_type bus;
struct tasklet_struct msg_dpc;
@@ -113,7 +113,7 @@ static struct device_attribute vmbus_device_attrs[] = {
};
/* The one and only one */
-static struct vmbus_driver_context vmbus_drv = {
+static struct vmbus_hyperv_driver vmbus_drv = {
.bus.name = "vmbus",
.bus.match = vmbus_match,
.bus.shutdown = vmbus_shutdown,
@@ -196,7 +196,7 @@ static int vmbus_dev_rm(struct hyperv_device *dev)
/*
* vmbus_cleanup - Perform any cleanup when the driver is removed
*/
-static void vmbus_cleanup(struct driver_context *drv)
+static void vmbus_cleanup(struct hyperv_driver *drv)
{
/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
@@ -221,7 +221,7 @@ static void vmbus_onmessage_work(struct work_struct *work)
/*
* vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
*/
-static void vmbus_on_msg_dpc(struct driver_context *drv)
+static void vmbus_on_msg_dpc(struct hyperv_driver *drv)
{
int cpu = smp_processor_id();
void *page_addr = hv_context.synic_message_page[cpu];
@@ -267,7 +267,7 @@ static void vmbus_on_msg_dpc(struct driver_context *drv)
/*
* vmbus_on_isr - ISR routine
*/
-static int vmbus_on_isr(struct driver_context *drv)
+static int vmbus_on_isr(struct hyperv_driver *drv)
{
int ret = 0;
int cpu = smp_processor_id();
@@ -462,8 +462,8 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
*/
static int vmbus_bus_init(void)
{
- struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
- struct driver_context *driver = &vmbus_drv.drv_obj;
+ struct vmbus_hyperv_driver *vmbus_drv_ctx = &vmbus_drv;
+ struct hyperv_driver *driver = &vmbus_drv.drv_obj;
struct hyperv_device *dev = &vmbus_drv.device_obj;
int ret;
unsigned int vector;
@@ -587,8 +587,8 @@ cleanup:
*/
static void vmbus_bus_exit(void)
{
- struct driver_context *driver = &vmbus_drv.drv_obj;
- struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
+ struct hyperv_driver *driver = &vmbus_drv.drv_obj;
+ struct vmbus_hyperv_driver *vmbus_drv_ctx = &vmbus_drv;
struct hyperv_device *dev = &vmbus_drv.device_obj;
@@ -615,7 +615,7 @@ static void vmbus_bus_exit(void)
* vmbus_child_driver_register() - Register a vmbus's child driver
* @driver_ctx: Pointer to driver structure you want to register
*
- * @driver_ctx is of type &struct driver_context
+ * @driver_ctx is of type &struct hyperv_driver
*
* Registers the given driver with Linux through the 'driver_register()' call
* And sets up the hyper-v vmbus handling for this driver.
@@ -623,7 +623,7 @@ static void vmbus_bus_exit(void)
*
* Mainly used by Hyper-V drivers.
*/
-int vmbus_child_driver_register(struct driver_context *driver_ctx)
+int vmbus_child_driver_register(struct hyperv_driver *driver_ctx)
{
int ret;
@@ -645,14 +645,14 @@ EXPORT_SYMBOL(vmbus_child_driver_register);
* vmbus_child_driver_unregister() - Unregister a vmbus's child driver
* @driver_ctx: Pointer to driver structure you want to un-register
*
- * @driver_ctx is of type &struct driver_context
+ * @driver_ctx is of type &struct hyperv_driver
*
* Un-register the given driver with Linux through the 'driver_unregister()'
* call. And ungegisters the driver from the Hyper-V vmbus handler.
*
* Mainly used by Hyper-V drivers.
*/
-void vmbus_child_driver_unregister(struct driver_context *driver_ctx)
+void vmbus_child_driver_unregister(struct hyperv_driver *driver_ctx)
{
DPRINT_INFO(VMBUS_DRV, "child driver (%p) unregistering - name %s",
driver_ctx, driver_ctx->driver.name);
@@ -849,7 +849,7 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
static int vmbus_match(struct device *device, struct device_driver *driver)
{
int match = 0;
- struct driver_context *driver_ctx = driver_to_driver_context(driver);
+ struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);
struct hyperv_device *device_obj = device_to_hyperv_device(device);
/* We found our driver ? */
@@ -857,10 +857,10 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
sizeof(struct hv_guid)) == 0) {
/*
* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
- * it here to access the struct driver_context field
+ * it here to access the struct hyperv_driver field
*/
- struct vmbus_driver_context *vmbus_drv_ctx =
- (struct vmbus_driver_context *)driver_ctx;
+ struct vmbus_hyperv_driver *vmbus_drv_ctx =
+ (struct vmbus_hyperv_driver *)driver_ctx;
device_obj->drv = &vmbus_drv_ctx->drv_obj;
DPRINT_INFO(VMBUS_DRV,
@@ -899,8 +899,8 @@ static void vmbus_probe_failed_cb(struct work_struct *context)
static int vmbus_probe(struct device *child_device)
{
int ret = 0;
- struct driver_context *driver_ctx =
- driver_to_driver_context(child_device->driver);
+ struct hyperv_driver *driver_ctx =
+ driver_to_hyperv_driver(child_device->driver);
struct hyperv_device *device_obj =
device_to_hyperv_device(child_device);
@@ -931,7 +931,7 @@ static int vmbus_probe(struct device *child_device)
static int vmbus_remove(struct device *child_device)
{
int ret;
- struct driver_context *driver_ctx;
+ struct hyperv_driver *driver_ctx;
/* Special case root bus device */
if (child_device->parent == NULL) {
@@ -943,7 +943,7 @@ static int vmbus_remove(struct device *child_device)
}
if (child_device->driver) {
- driver_ctx = driver_to_driver_context(child_device->driver);
+ driver_ctx = driver_to_hyperv_driver(child_device->driver);
/*
* Let the specific open-source driver handles the removal if
@@ -967,7 +967,7 @@ static int vmbus_remove(struct device *child_device)
*/
static void vmbus_shutdown(struct device *child_device)
{
- struct driver_context *driver_ctx;
+ struct hyperv_driver *driver_ctx;
/* Special case root bus device */
if (child_device->parent == NULL) {
@@ -982,7 +982,7 @@ static void vmbus_shutdown(struct device *child_device)
if (!child_device->driver)
return;
- driver_ctx = driver_to_driver_context(child_device->driver);
+ driver_ctx = driver_to_hyperv_driver(child_device->driver);
/* Let the specific open-source driver handles the removal if it can */
if (driver_ctx->shutdown)
@@ -1020,7 +1020,7 @@ static void vmbus_device_release(struct device *device)
*/
static void vmbus_msg_dpc(unsigned long data)
{
- struct driver_context *driver = (struct driver_context *)data;
+ struct hyperv_driver *driver = (struct hyperv_driver *)data;
/* Call to bus driver to handle interrupt */
vmbus_on_msg_dpc(driver);
@@ -1037,7 +1037,7 @@ static void vmbus_event_dpc(unsigned long data)
static irqreturn_t vmbus_isr(int irq, void *dev_id)
{
- struct driver_context *driver = &vmbus_drv.drv_obj;
+ struct hyperv_driver *driver = &vmbus_drv.drv_obj;
int ret;
/* Call to bus driver to handle interrupt */
--
1.5.5.6
^ permalink raw reply related
* [PATCH 4/6] Staging: hv: Unify the hyperv driver abstractions
From: K. Y. Srinivasan @ 2011-02-26 2:07 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
This patch combines the two driver abstractions into
a single driver abstraction.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc.c | 2 +-
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/netvsc.c | 6 +++---
drivers/staging/hv/netvsc_api.h | 4 ++--
drivers/staging/hv/netvsc_drv.c | 2 +-
drivers/staging/hv/rndis_filter.c | 4 ++--
drivers/staging/hv/storvsc.c | 4 ++--
drivers/staging/hv/storvsc_api.h | 6 +++---
drivers/staging/hv/storvsc_drv.c | 2 +-
drivers/staging/hv/vmbus.h | 10 +++++++++-
drivers/staging/hv/vmbus_api.h | 14 +-------------
drivers/staging/hv/vmbus_drv.c | 18 +++++++++---------
12 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 47ccec2..d29af4b 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -63,7 +63,7 @@ blk_vsc_on_device_add(struct hyperv_device *device, void *additional_info)
return ret;
}
-int blk_vsc_initialize(struct hv_driver *driver)
+int blk_vsc_initialize(struct driver_context *driver)
{
struct storvsc_driver_object *stor_driver;
int ret = 0;
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 305a665..a280f83 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -171,7 +171,7 @@ static const struct block_device_operations block_ops = {
/*
* blkvsc_drv_init - BlkVsc driver initialization.
*/
-static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
+static int blkvsc_drv_init(int (*drv_init)(struct driver_context *drv))
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 7cf6999..6d8d0a3 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -49,7 +49,7 @@ netvsc_device_add(struct hyperv_device *device, void *additional_info);
static int netvsc_device_remove(struct hyperv_device *device);
-static void netvsc_cleanup(struct hv_driver *driver);
+static void netvsc_cleanup(struct driver_context *driver);
static void netvsc_channel_cb(void *context);
@@ -178,7 +178,7 @@ static struct netvsc_device *release_inbound_net_device(
/*
* netvsc_initialize - Main entry point
*/
-int netvsc_initialize(struct hv_driver *drv)
+int netvsc_initialize(struct driver_context *drv)
{
struct netvsc_driver *driver = (struct netvsc_driver *)drv;
@@ -837,7 +837,7 @@ static int netvsc_device_remove(struct hyperv_device *device)
/*
* netvsc_cleanup - Perform any cleanup when the driver is removed
*/
-static void netvsc_cleanup(struct hv_driver *drv)
+static void netvsc_cleanup(struct driver_context *drv)
{
}
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index e43ff7b..842f542 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -84,7 +84,7 @@ struct hv_netvsc_packet {
struct netvsc_driver {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct hv_driver base;
+ struct driver_context base;
u32 ring_buf_size;
u32 req_ext_size;
@@ -109,7 +109,7 @@ struct netvsc_device_info {
};
/* Interface */
-int netvsc_initialize(struct hv_driver *drv);
+int netvsc_initialize(struct driver_context *drv);
int rndis_filter_open(struct hyperv_device *dev);
int rndis_filter_close(struct hyperv_device *dev);
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index fc4eb9b..fbb32f7 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -490,7 +490,7 @@ static void netvsc_drv_exit(void)
return;
}
-static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
+static int netvsc_drv_init(int (*drv_init)(struct driver_context *drv))
{
struct netvsc_driver *net_drv_obj = &g_netvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index b718fa9..a2b5f4d 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -90,7 +90,7 @@ static int rndis_filte_device_add(struct hyperv_device *dev,
static int rndis_filter_device_remove(struct hyperv_device *dev);
-static void rndis_filter_cleanup(struct hv_driver *drv);
+static void rndis_filter_cleanup(struct driver_context *drv);
static int rndis_filter_send(struct hyperv_device *dev,
struct hv_netvsc_packet *pkt);
@@ -834,7 +834,7 @@ static int rndis_filter_device_remove(struct hyperv_device *dev)
return 0;
}
-static void rndis_filter_cleanup(struct hv_driver *drv)
+static void rndis_filter_cleanup(struct driver_context *drv)
{
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 6000b0d..c86bc68 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -781,14 +781,14 @@ static int stor_vsc_on_io_request(struct hyperv_device *device,
/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-static void stor_vsc_on_cleanup(struct hv_driver *driver)
+static void stor_vsc_on_cleanup(struct driver_context *driver)
{
}
/*
* stor_vsc_initialize - Main entry point
*/
-int stor_vsc_initialize(struct hv_driver *driver)
+int stor_vsc_initialize(struct driver_context *driver)
{
struct storvsc_driver_object *stor_driver;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index c2915b4..b488d75 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -80,7 +80,7 @@ struct hv_storvsc_request {
struct storvsc_driver_object {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct hv_driver base;
+ struct driver_context base;
/* Set by caller (in bytes) */
u32 ring_buffer_size;
@@ -103,8 +103,8 @@ struct storvsc_device_info {
};
/* Interface */
-int stor_vsc_initialize(struct hv_driver *driver);
+int stor_vsc_initialize(struct driver_context *driver);
int stor_vsc_on_host_reset(struct hyperv_device *device);
-int blk_vsc_initialize(struct hv_driver *driver);
+int blk_vsc_initialize(struct driver_context *driver);
#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c094578..282bd66 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -135,7 +135,7 @@ static struct scsi_host_template scsi_driver = {
/*
* storvsc_drv_init - StorVsc driver initialization.
*/
-static int storvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
+static int storvsc_drv_init(int (*drv_init)(struct driver_context *drv))
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index 1ac7e56..cad8b4c 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -29,8 +29,16 @@
#include "vmbus_api.h"
struct driver_context {
+ const char *name;
+
struct hv_guid class_id;
+ int (*dev_add)(struct hyperv_device *device, void *data);
+
+ int (*dev_rm)(struct hyperv_device *device);
+
+ void (*cleanup)(struct driver_context *driver);
+
struct device_driver driver;
/*
@@ -48,7 +56,7 @@ struct hyperv_device {
struct work_struct probe_failed_work_item;
struct hv_guid class_id; /* device type id */
struct hv_guid device_id; /* device instance id */
- struct hv_driver *drv;
+ struct driver_context *drv;
int probe_error;
struct vmbus_channel *channel; /* associated channel to host*/
void *ext;
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 260086f..0d8232e 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -55,7 +55,7 @@ struct hv_multipage_buffer {
#pragma pack(pop)
-struct hv_driver;
+struct driver_context;
struct hyperv_device;
struct hv_dev_port_info {
@@ -84,16 +84,4 @@ struct hyperv_device_info {
struct hv_dev_port_info outbound;
};
-/* Base driver object */
-struct hv_driver {
- const char *name;
-
- /* the device type supported by this driver */
- struct hv_guid class_id;
-
- int (*dev_add)(struct hyperv_device *device, void *data);
- int (*dev_rm)(struct hyperv_device *device);
- void (*cleanup)(struct hv_driver *driver);
-};
-
#endif /* _VMBUS_API_H_ */
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index a385bd2..3922a07 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -47,7 +47,7 @@ struct vmbus_driver_context {
/* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */
struct driver_context drv_ctx;
- struct hv_driver drv_obj;
+ struct driver_context drv_obj;
struct bus_type bus;
struct tasklet_struct msg_dpc;
@@ -196,7 +196,7 @@ static int vmbus_dev_rm(struct hyperv_device *dev)
/*
* vmbus_cleanup - Perform any cleanup when the driver is removed
*/
-static void vmbus_cleanup(struct hv_driver *drv)
+static void vmbus_cleanup(struct driver_context *drv)
{
/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
@@ -221,7 +221,7 @@ static void vmbus_onmessage_work(struct work_struct *work)
/*
* vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
*/
-static void vmbus_on_msg_dpc(struct hv_driver *drv)
+static void vmbus_on_msg_dpc(struct driver_context *drv)
{
int cpu = smp_processor_id();
void *page_addr = hv_context.synic_message_page[cpu];
@@ -267,7 +267,7 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
/*
* vmbus_on_isr - ISR routine
*/
-static int vmbus_on_isr(struct hv_driver *drv)
+static int vmbus_on_isr(struct driver_context *drv)
{
int ret = 0;
int cpu = smp_processor_id();
@@ -463,7 +463,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
static int vmbus_bus_init(void)
{
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
- struct hv_driver *driver = &vmbus_drv.drv_obj;
+ struct driver_context *driver = &vmbus_drv.drv_obj;
struct hyperv_device *dev = &vmbus_drv.device_obj;
int ret;
unsigned int vector;
@@ -587,7 +587,7 @@ cleanup:
*/
static void vmbus_bus_exit(void)
{
- struct hv_driver *driver = &vmbus_drv.drv_obj;
+ struct driver_context *driver = &vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
struct hyperv_device *dev = &vmbus_drv.device_obj;
@@ -857,7 +857,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
sizeof(struct hv_guid)) == 0) {
/*
* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
- * it here to access the struct hv_driver field
+ * it here to access the struct driver_context field
*/
struct vmbus_driver_context *vmbus_drv_ctx =
(struct vmbus_driver_context *)driver_ctx;
@@ -1020,7 +1020,7 @@ static void vmbus_device_release(struct device *device)
*/
static void vmbus_msg_dpc(unsigned long data)
{
- struct hv_driver *driver = (struct hv_driver *)data;
+ struct driver_context *driver = (struct driver_context *)data;
/* Call to bus driver to handle interrupt */
vmbus_on_msg_dpc(driver);
@@ -1037,7 +1037,7 @@ static void vmbus_event_dpc(unsigned long data)
static irqreturn_t vmbus_isr(int irq, void *dev_id)
{
- struct hv_driver *driver = &vmbus_drv.drv_obj;
+ struct driver_context *driver = &vmbus_drv.drv_obj;
int ret;
/* Call to bus driver to handle interrupt */
--
1.5.5.6
^ permalink raw reply related
* [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names
From: K. Y. Srinivasan @ 2011-02-26 2:06 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cleanup the names of variables that refer to the
hyperv_device abstraction.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 12 ++--
drivers/staging/hv/netvsc.c | 4 +-
drivers/staging/hv/netvsc_drv.c | 36 ++++----
drivers/staging/hv/storvsc_drv.c | 44 +++++-----
drivers/staging/hv/vmbus_drv.c | 164 +++++++++++++++++++-------------------
5 files changed, 130 insertions(+), 130 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 58ab0e8..305a665 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -95,7 +95,7 @@ struct blkvsc_request {
/* Per device structure */
struct block_device_context {
/* point back to our device context */
- struct hyperv_device *device_ctx;
+ struct hyperv_device *device_obj;
struct kmem_cache *request_pool;
spinlock_t lock;
struct gendisk *gd;
@@ -298,7 +298,7 @@ static int blkvsc_probe(struct device *device)
goto Cleanup;
}
- blkdev->device_ctx = device_obj;
+ blkdev->device_obj = device_obj;
/* this identified the device 0 or 1 */
blkdev->target = device_info.target_id;
/* this identified the ide ctrl 0 or 1 */
@@ -367,7 +367,7 @@ static int blkvsc_probe(struct device *device)
blkdev->gd->first_minor = 0;
blkdev->gd->fops = &block_ops;
blkdev->gd->private_data = blkdev;
- blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
+ blkdev->gd->driverfs_dev = &(blkdev->device_obj->device);
sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
blkvsc_do_inquiry(blkdev);
@@ -848,9 +848,9 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
void (*request_completion)(struct hv_storvsc_request *))
{
struct block_device_context *blkdev = blkvsc_req->dev;
- struct hyperv_device *device_ctx = blkdev->device_ctx;
+ struct hyperv_device *device_obj = blkdev->device_obj;
struct driver_context *driver_ctx =
- driver_to_driver_context(device_ctx->device.driver);
+ driver_to_driver_context(device_obj->device.driver);
struct blkvsc_driver_context *blkvsc_drv_ctx =
(struct blkvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
@@ -895,7 +895,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
- ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
+ ret = storvsc_drv_obj->on_io_request(blkdev->device_obj,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 7841cae..7cf6999 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -44,8 +44,8 @@ static const struct hv_guid netvsc_device_type = {
}
};
-static int netvsc_device_add(struct hyperv_device *device,
- void *additional_info);
+static int
+netvsc_device_add(struct hyperv_device *device, void *additional_info);
static int netvsc_device_remove(struct hyperv_device *device);
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 31cbbab..fc4eb9b 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -44,7 +44,7 @@
struct net_device_context {
/* point back to our device context */
- struct hyperv_device *device_ctx;
+ struct hyperv_device *device_obj;
unsigned long avail;
};
@@ -75,8 +75,8 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net)
{
- struct net_device_context *net_device_ctx = netdev_priv(net);
- struct hyperv_device *device_obj = net_device_ctx->device_ctx;
+ struct net_device_context *net_device_obj = netdev_priv(net);
+ struct hyperv_device *device_obj = net_device_obj->device_obj;
int ret = 0;
if (netif_carrier_ok(net)) {
@@ -98,8 +98,8 @@ static int netvsc_open(struct net_device *net)
static int netvsc_close(struct net_device *net)
{
- struct net_device_context *net_device_ctx = netdev_priv(net);
- struct hyperv_device *device_obj = net_device_ctx->device_ctx;
+ struct net_device_context *net_device_obj = netdev_priv(net);
+ struct hyperv_device *device_obj = net_device_obj->device_obj;
int ret;
netif_stop_queue(net);
@@ -121,22 +121,22 @@ static void netvsc_xmit_completion(void *context)
if (skb) {
struct net_device *net = skb->dev;
- struct net_device_context *net_device_ctx = netdev_priv(net);
+ struct net_device_context *net_device_obj = netdev_priv(net);
unsigned int num_pages = skb_shinfo(skb)->nr_frags + 2;
dev_kfree_skb_any(skb);
- net_device_ctx->avail += num_pages;
- if (net_device_ctx->avail >= PACKET_PAGES_HIWATER)
+ net_device_obj->avail += num_pages;
+ if (net_device_obj->avail >= PACKET_PAGES_HIWATER)
netif_wake_queue(net);
}
}
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{
- struct net_device_context *net_device_ctx = netdev_priv(net);
+ struct net_device_context *net_device_obj = netdev_priv(net);
struct driver_context *driver_ctx =
- driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
+ driver_to_driver_context(net_device_obj->device_obj->device.driver);
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
@@ -149,7 +149,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
/* Add 1 for skb->data and additional one for RNDIS */
num_pages = skb_shinfo(skb)->nr_frags + 1 + 1;
- if (num_pages > net_device_ctx->avail)
+ if (num_pages > net_device_obj->avail)
return NETDEV_TX_BUSY;
/* Allocate a netvsc packet based on # of frags. */
@@ -198,7 +198,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
packet->completion.send.send_completion_ctx = packet;
packet->completion.send.send_completion_tid = (unsigned long)skb;
- ret = net_drv_obj->send(net_device_ctx->device_ctx,
+ ret = net_drv_obj->send(net_device_obj->device_obj,
packet);
if (ret == 0) {
net->stats.tx_bytes += skb->len;
@@ -208,8 +208,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
net->stats.tx_packets,
net->stats.tx_bytes);
- net_device_ctx->avail -= num_pages;
- if (net_device_ctx->avail < PACKET_PAGES_LOWATER)
+ net_device_obj->avail -= num_pages;
+ if (net_device_obj->avail < PACKET_PAGES_LOWATER)
netif_stop_queue(net);
} else {
/* we are shutting down or bus overloaded, just drop packet */
@@ -345,7 +345,7 @@ static int netvsc_probe(struct device *device)
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = NULL;
- struct net_device_context *net_device_ctx;
+ struct net_device_context *net_device_obj;
struct netvsc_device_info device_info;
int ret;
@@ -359,9 +359,9 @@ static int netvsc_probe(struct device *device)
/* Set initial state */
netif_carrier_off(net);
- net_device_ctx = netdev_priv(net);
- net_device_ctx->device_ctx = device_obj;
- net_device_ctx->avail = ring_size;
+ net_device_obj = netdev_priv(net);
+ net_device_obj->device_obj = device_obj;
+ net_device_obj->avail = ring_size;
dev_set_drvdata(device, net);
/* Notify the netvsc driver of the new device */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2b9a097..c094578 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -43,7 +43,7 @@ struct host_device_context {
/* must be 1st field
* FIXME this is a bug */
/* point back to our device context */
- struct hyperv_device *device_ctx;
+ struct hyperv_device *device_obj;
struct kmem_cache *request_pool;
unsigned int port;
unsigned char path;
@@ -247,7 +247,7 @@ static int storvsc_probe(struct device *device)
memset(host_device_ctx, 0, sizeof(struct host_device_context));
host_device_ctx->port = host->host_no;
- host_device_ctx->device_ctx = device_obj;
+ host_device_ctx->device_obj = device_obj;
host_device_ctx->request_pool =
kmem_cache_create(dev_name(&device_obj->device),
@@ -271,7 +271,7 @@ static int storvsc_probe(struct device *device)
return -1;
}
- /* host_device_ctx->port = device_info.PortNumber; */
+ /* host_hyperv_dev->port = device_info.PortNumber; */
host_device_ctx->path = device_info.path_id;
host_device_ctx->target = device_info.target_id;
@@ -312,7 +312,7 @@ static int storvsc_remove(struct device *device)
&storvsc_drv_ctx->drv_obj;
struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct Scsi_Host *host = dev_get_drvdata(device);
- struct host_device_context *host_device_ctx =
+ struct host_device_context *host_device_obj =
(struct host_device_context *)host->hostdata;
@@ -330,9 +330,9 @@ static int storvsc_remove(struct device *device)
ret);
}
- if (host_device_ctx->request_pool) {
- kmem_cache_destroy(host_device_ctx->request_pool);
- host_device_ctx->request_pool = NULL;
+ if (host_device_obj->request_pool) {
+ kmem_cache_destroy(host_device_obj->request_pool);
+ host_device_obj->request_pool = NULL;
}
DPRINT_INFO(STORVSC, "removing host adapter (%p)...", host);
@@ -351,7 +351,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
struct storvsc_cmd_request *cmd_request =
(struct storvsc_cmd_request *)request->context;
struct scsi_cmnd *scmnd = cmd_request->cmd;
- struct host_device_context *host_device_ctx =
+ struct host_device_context *host_device_obj =
(struct host_device_context *)scmnd->device->host->hostdata;
void (*scsi_done_fn)(struct scsi_cmnd *);
struct scsi_sense_hdr sense_hdr;
@@ -394,7 +394,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
/* !!DO NOT MODIFY the scmnd after this call */
scsi_done_fn(scmnd);
- kmem_cache_free(host_device_ctx->request_pool, cmd_request);
+ kmem_cache_free(host_device_obj->request_pool, cmd_request);
}
static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
@@ -598,11 +598,11 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
void (*done)(struct scsi_cmnd *))
{
int ret;
- struct host_device_context *host_device_ctx =
+ struct host_device_context *host_device_obj =
(struct host_device_context *)scmnd->device->host->hostdata;
- struct hyperv_device *device_ctx = host_device_ctx->device_ctx;
+ struct hyperv_device *device_obj = host_device_obj->device_obj;
struct driver_context *driver_ctx =
- driver_to_driver_context(device_ctx->device.driver);
+ driver_to_driver_context(device_obj->device.driver);
struct storvsc_driver_context *storvsc_drv_ctx =
(struct storvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
@@ -639,7 +639,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request_size = sizeof(struct storvsc_cmd_request);
- cmd_request = kmem_cache_alloc(host_device_ctx->request_pool,
+ cmd_request = kmem_cache_alloc(host_device_obj->request_pool,
GFP_ATOMIC);
if (!cmd_request) {
DPRINT_ERR(STORVSC_DRV, "scmnd (%p) - unable to allocate "
@@ -679,7 +679,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request->context = cmd_request;/* scmnd; */
/* request->PortId = scmnd->device->channel; */
- request->host = host_device_ctx->port;
+ request->host = host_device_obj->port;
request->bus = scmnd->device->channel;
request->target_id = scmnd->device->id;
request->lun_id = scmnd->device->lun;
@@ -712,7 +712,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
scmnd->scsi_done = NULL;
scmnd->host_scribble = NULL;
- kmem_cache_free(host_device_ctx->request_pool,
+ kmem_cache_free(host_device_obj->request_pool,
cmd_request);
return SCSI_MLQUEUE_HOST_BUSY;
@@ -751,7 +751,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
retry_request:
/* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->on_io_request(device_ctx,
+ ret = storvsc_drv_obj->on_io_request(device_obj,
&cmd_request->request);
if (ret == -1) {
/* no more space */
@@ -771,7 +771,7 @@ retry_request:
cmd_request->bounce_sgl_count);
}
- kmem_cache_free(host_device_ctx->request_pool, cmd_request);
+ kmem_cache_free(host_device_obj->request_pool, cmd_request);
scmnd->scsi_done = NULL;
scmnd->host_scribble = NULL;
@@ -836,20 +836,20 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
{
int ret;
- struct host_device_context *host_device_ctx =
+ struct host_device_context *host_device_obj =
(struct host_device_context *)scmnd->device->host->hostdata;
- struct hyperv_device *device_ctx = host_device_ctx->device_ctx;
+ struct hyperv_device *device_obj = host_device_obj->device_obj;
DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
- scmnd->device, device_ctx);
+ scmnd->device, device_obj);
/* Invokes the vsc to reset the host/bus */
- ret = stor_vsc_on_host_reset(device_ctx);
+ ret = stor_vsc_on_host_reset(device_obj);
if (ret != 0)
return ret;
DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
- scmnd->device, device_ctx);
+ scmnd->device, device_obj);
return ret;
}
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 38152df..a385bd2 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -54,7 +54,7 @@ struct vmbus_driver_context {
struct tasklet_struct event_dpc;
/* The bus root device */
- struct hyperv_device device_ctx;
+ struct hyperv_device device_obj;
};
static int vmbus_match(struct device *device, struct device_driver *driver);
@@ -354,12 +354,12 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
struct device_attribute *dev_attr,
char *buf)
{
- struct hyperv_device *device_ctx = device_to_hyperv_device(dev);
+ struct hyperv_device *device_obj = device_to_hyperv_device(dev);
struct hyperv_device_info device_info;
memset(&device_info, 0, sizeof(struct hyperv_device_info));
- get_channel_info(device_ctx, &device_info);
+ get_channel_info(device_obj, &device_info);
if (!strcmp(dev_attr->attr.name, "class_id")) {
return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
@@ -464,7 +464,7 @@ static int vmbus_bus_init(void)
{
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
struct hv_driver *driver = &vmbus_drv.drv_obj;
- struct hyperv_device *dev_ctx = &vmbus_drv.device_ctx;
+ struct hyperv_device *dev = &vmbus_drv.device_obj;
int ret;
unsigned int vector;
@@ -535,9 +535,9 @@ static int vmbus_bus_init(void)
DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
/* Call to bus driver to add the root device */
- memset(dev_ctx, 0, sizeof(struct hyperv_device));
+ memset(dev, 0, sizeof(struct hyperv_device));
- ret = driver->dev_add(dev_ctx, &vector);
+ ret = driver->dev_add(dev, &vector);
if (ret != 0) {
DPRINT_ERR(VMBUS_DRV,
"ERROR - Unable to add vmbus root device");
@@ -549,19 +549,19 @@ static int vmbus_bus_init(void)
ret = -1;
goto cleanup;
}
- /* strcpy(dev_ctx->device.bus_id, dev_ctx->device_obj.name); */
- dev_set_name(&dev_ctx->device, "vmbus_0_0");
+ /* strcpy(dev->device.bus_id, dev->device_obj.name); */
+ dev_set_name(&dev->device, "vmbus_0_0");
/* No need to bind a driver to the root device. */
- dev_ctx->device.parent = NULL;
+ dev->device.parent = NULL;
/* NULL; vmbus_remove() does not get invoked */
- dev_ctx->device.bus = &vmbus_drv_ctx->bus;
+ dev->device.bus = &vmbus_drv_ctx->bus;
/* Setup the device dispatch table */
- dev_ctx->device.release = vmbus_bus_release;
+ dev->device.release = vmbus_bus_release;
/* Setup the bus as root device */
- ret = device_register(&dev_ctx->device);
+ ret = device_register(&dev->device);
if (ret) {
DPRINT_ERR(VMBUS_DRV,
"ERROR - Unable to register vmbus root device");
@@ -590,17 +590,17 @@ static void vmbus_bus_exit(void)
struct hv_driver *driver = &vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
- struct hyperv_device *dev_ctx = &vmbus_drv.device_ctx;
+ struct hyperv_device *dev = &vmbus_drv.device_obj;
/* Remove the root device */
if (driver->dev_rm)
- driver->dev_rm(dev_ctx);
+ driver->dev_rm(dev);
if (driver->cleanup)
driver->cleanup(driver);
/* Unregister the root bus device */
- device_unregister(&dev_ctx->device);
+ device_unregister(&dev->device);
bus_unregister(&vmbus_drv_ctx->bus);
@@ -671,11 +671,11 @@ struct hyperv_device *vmbus_child_device_create(struct hv_guid *type,
struct hv_guid *instance,
struct vmbus_channel *channel)
{
- struct hyperv_device *child_device_ctx;
+ struct hyperv_device *child_device_obj;
/* Allocate the new child device */
- child_device_ctx = kzalloc(sizeof(struct hyperv_device), GFP_KERNEL);
- if (!child_device_ctx) {
+ child_device_obj = kzalloc(sizeof(struct hyperv_device), GFP_KERNEL);
+ if (!child_device_obj) {
DPRINT_ERR(VMBUS_DRV,
"unable to allocate device_context for child device");
return NULL;
@@ -686,7 +686,7 @@ struct hyperv_device *vmbus_child_device_create(struct hv_guid *type,
"%02x%02x%02x%02x%02x%02x%02x%02x},"
"id {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}",
- &child_device_ctx->device,
+ &child_device_obj->device,
type->data[3], type->data[2], type->data[1], type->data[0],
type->data[5], type->data[4], type->data[7], type->data[6],
type->data[8], type->data[9], type->data[10], type->data[11],
@@ -700,12 +700,12 @@ struct hyperv_device *vmbus_child_device_create(struct hv_guid *type,
instance->data[12], instance->data[13],
instance->data[14], instance->data[15]);
- child_device_ctx->channel = channel;
+ child_device_obj->channel = channel;
- memcpy(&child_device_ctx->class_id, type, sizeof(struct hv_guid));
- memcpy(&child_device_ctx->device_id, instance, sizeof(struct hv_guid));
+ memcpy(&child_device_obj->class_id, type, sizeof(struct hv_guid));
+ memcpy(&child_device_obj->device_id, instance, sizeof(struct hv_guid));
- return child_device_ctx;
+ return child_device_obj;
}
/*
@@ -777,43 +777,43 @@ void vmbus_child_device_unregister(struct hyperv_device *device_obj)
*/
static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
{
- struct hyperv_device *device_ctx = device_to_hyperv_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
int ret;
DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={"
"%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}",
- device_ctx->class_id.data[3], device_ctx->class_id.data[2],
- device_ctx->class_id.data[1], device_ctx->class_id.data[0],
- device_ctx->class_id.data[5], device_ctx->class_id.data[4],
- device_ctx->class_id.data[7], device_ctx->class_id.data[6],
- device_ctx->class_id.data[8], device_ctx->class_id.data[9],
- device_ctx->class_id.data[10],
- device_ctx->class_id.data[11],
- device_ctx->class_id.data[12],
- device_ctx->class_id.data[13],
- device_ctx->class_id.data[14],
- device_ctx->class_id.data[15]);
+ device_obj->class_id.data[3], device_obj->class_id.data[2],
+ device_obj->class_id.data[1], device_obj->class_id.data[0],
+ device_obj->class_id.data[5], device_obj->class_id.data[4],
+ device_obj->class_id.data[7], device_obj->class_id.data[6],
+ device_obj->class_id.data[8], device_obj->class_id.data[9],
+ device_obj->class_id.data[10],
+ device_obj->class_id.data[11],
+ device_obj->class_id.data[12],
+ device_obj->class_id.data[13],
+ device_obj->class_id.data[14],
+ device_obj->class_id.data[15]);
ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
"%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}",
- device_ctx->class_id.data[3],
- device_ctx->class_id.data[2],
- device_ctx->class_id.data[1],
- device_ctx->class_id.data[0],
- device_ctx->class_id.data[5],
- device_ctx->class_id.data[4],
- device_ctx->class_id.data[7],
- device_ctx->class_id.data[6],
- device_ctx->class_id.data[8],
- device_ctx->class_id.data[9],
- device_ctx->class_id.data[10],
- device_ctx->class_id.data[11],
- device_ctx->class_id.data[12],
- device_ctx->class_id.data[13],
- device_ctx->class_id.data[14],
- device_ctx->class_id.data[15]);
+ device_obj->class_id.data[3],
+ device_obj->class_id.data[2],
+ device_obj->class_id.data[1],
+ device_obj->class_id.data[0],
+ device_obj->class_id.data[5],
+ device_obj->class_id.data[4],
+ device_obj->class_id.data[7],
+ device_obj->class_id.data[6],
+ device_obj->class_id.data[8],
+ device_obj->class_id.data[9],
+ device_obj->class_id.data[10],
+ device_obj->class_id.data[11],
+ device_obj->class_id.data[12],
+ device_obj->class_id.data[13],
+ device_obj->class_id.data[14],
+ device_obj->class_id.data[15]);
if (ret)
return ret;
@@ -821,22 +821,22 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
ret = add_uevent_var(env, "VMBUS_DEVICE_DEVICE_GUID={"
"%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}",
- device_ctx->device_id.data[3],
- device_ctx->device_id.data[2],
- device_ctx->device_id.data[1],
- device_ctx->device_id.data[0],
- device_ctx->device_id.data[5],
- device_ctx->device_id.data[4],
- device_ctx->device_id.data[7],
- device_ctx->device_id.data[6],
- device_ctx->device_id.data[8],
- device_ctx->device_id.data[9],
- device_ctx->device_id.data[10],
- device_ctx->device_id.data[11],
- device_ctx->device_id.data[12],
- device_ctx->device_id.data[13],
- device_ctx->device_id.data[14],
- device_ctx->device_id.data[15]);
+ device_obj->device_id.data[3],
+ device_obj->device_id.data[2],
+ device_obj->device_id.data[1],
+ device_obj->device_id.data[0],
+ device_obj->device_id.data[5],
+ device_obj->device_id.data[4],
+ device_obj->device_id.data[7],
+ device_obj->device_id.data[6],
+ device_obj->device_id.data[8],
+ device_obj->device_id.data[9],
+ device_obj->device_id.data[10],
+ device_obj->device_id.data[11],
+ device_obj->device_id.data[12],
+ device_obj->device_id.data[13],
+ device_obj->device_id.data[14],
+ device_obj->device_id.data[15]);
if (ret)
return ret;
@@ -850,10 +850,10 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
{
int match = 0;
struct driver_context *driver_ctx = driver_to_driver_context(driver);
- struct hyperv_device *device_ctx = device_to_hyperv_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
/* We found our driver ? */
- if (memcmp(&device_ctx->class_id, &driver_ctx->class_id,
+ if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
sizeof(struct hv_guid)) == 0) {
/*
* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
@@ -862,11 +862,11 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
struct vmbus_driver_context *vmbus_drv_ctx =
(struct vmbus_driver_context *)driver_ctx;
- device_ctx->drv = &vmbus_drv_ctx->drv_obj;
+ device_obj->drv = &vmbus_drv_ctx->drv_obj;
DPRINT_INFO(VMBUS_DRV,
"device object (%p) set to driver object (%p)",
- &device_ctx,
- device_ctx->drv);
+ &device_obj,
+ device_obj->drv);
match = 1;
}
@@ -882,15 +882,15 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
*/
static void vmbus_probe_failed_cb(struct work_struct *context)
{
- struct hyperv_device *device_ctx = (struct hyperv_device *)context;
+ struct hyperv_device *device_obj = (struct hyperv_device *)context;
/*
* Kick off the process of unregistering the device.
* This will call vmbus_remove() and eventually vmbus_device_release()
*/
- device_unregister(&device_ctx->device);
+ device_unregister(&device_obj->device);
- /* put_device(&device_ctx->device); */
+ /* put_device(&device_obj->device); */
}
/*
@@ -901,21 +901,21 @@ static int vmbus_probe(struct device *child_device)
int ret = 0;
struct driver_context *driver_ctx =
driver_to_driver_context(child_device->driver);
- struct hyperv_device *device_ctx =
+ struct hyperv_device *device_obj =
device_to_hyperv_device(child_device);
/* Let the specific open-source driver handles the probe if it can */
if (driver_ctx->probe) {
- ret = device_ctx->probe_error = driver_ctx->probe(child_device);
+ ret = device_obj->probe_error = driver_ctx->probe(child_device);
if (ret != 0) {
DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s "
"(%p) on driver %s (%d)...",
dev_name(child_device), child_device,
child_device->driver->name, ret);
- INIT_WORK(&device_ctx->probe_failed_work_item,
+ INIT_WORK(&device_obj->probe_failed_work_item,
vmbus_probe_failed_cb);
- schedule_work(&device_ctx->probe_failed_work_item);
+ schedule_work(&device_obj->probe_failed_work_item);
}
} else {
DPRINT_ERR(VMBUS_DRV, "probe() method not set for driver - %s",
@@ -1008,11 +1008,11 @@ static void vmbus_bus_release(struct device *device)
*/
static void vmbus_device_release(struct device *device)
{
- struct hyperv_device *device_ctx = device_to_hyperv_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
- kfree(device_ctx);
+ kfree(device_obj);
- /* !!DO NOT REFERENCE device_ctx anymore at this point!! */
+ /* !!DO NOT REFERENCE device_obj anymore at this point!! */
}
/*
--
1.5.5.6
^ permalink raw reply related
* [PATCH 2/6] Staging: hv: Rename vm_device to hyperv_device
From: K. Y. Srinivasan @ 2011-02-26 2:06 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Rename the vm_device abstraction as hyperv_device.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc.c | 4 +-
drivers/staging/hv/blkvsc_drv.c | 8 ++--
drivers/staging/hv/channel_mgmt.h | 2 +-
drivers/staging/hv/netvsc.c | 56 +++++++++++++++++++----------------
drivers/staging/hv/netvsc.h | 2 +-
drivers/staging/hv/netvsc_api.h | 12 ++++----
drivers/staging/hv/netvsc_drv.c | 14 ++++----
drivers/staging/hv/rndis_filter.c | 18 ++++++------
drivers/staging/hv/storvsc.c | 36 ++++++++++++-----------
drivers/staging/hv/storvsc_api.h | 4 +-
drivers/staging/hv/storvsc_drv.c | 10 +++---
drivers/staging/hv/vmbus.h | 6 ++--
drivers/staging/hv/vmbus_api.h | 8 ++--
drivers/staging/hv/vmbus_drv.c | 50 ++++++++++++++++----------------
drivers/staging/hv/vmbus_private.h | 12 ++++----
15 files changed, 124 insertions(+), 118 deletions(-)
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index ecface3..47ccec2 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -35,8 +35,8 @@ static const struct hv_guid g_blk_device_type = {
}
};
-static int blk_vsc_on_device_add(struct vm_device *device,
- void *additional_info)
+static int
+blk_vsc_on_device_add(struct hyperv_device *device, void *additional_info)
{
struct storvsc_device_info *device_info;
int ret = 0;
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 6d1a783..58ab0e8 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -95,7 +95,7 @@ struct blkvsc_request {
/* Per device structure */
struct block_device_context {
/* point back to our device context */
- struct vm_device *device_ctx;
+ struct hyperv_device *device_ctx;
struct kmem_cache *request_pool;
spinlock_t lock;
struct gendisk *gd;
@@ -249,7 +249,7 @@ static int blkvsc_probe(struct device *device)
(struct blkvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
@@ -733,7 +733,7 @@ static int blkvsc_remove(struct device *device)
(struct blkvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
int ret;
@@ -848,7 +848,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
void (*request_completion)(struct hv_storvsc_request *))
{
struct block_device_context *blkdev = blkvsc_req->dev;
- struct vm_device *device_ctx = blkdev->device_ctx;
+ struct hyperv_device *device_ctx = blkdev->device_ctx;
struct driver_context *driver_ctx =
driver_to_driver_context(device_ctx->device.driver);
struct blkvsc_driver_context *blkvsc_drv_ctx =
diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h
index b3a9214..7b42883 100644
--- a/drivers/staging/hv/channel_mgmt.h
+++ b/drivers/staging/hv/channel_mgmt.h
@@ -228,7 +228,7 @@ enum vmbus_channel_state {
struct vmbus_channel {
struct list_head listentry;
- struct vm_device *device_obj;
+ struct hyperv_device *device_obj;
struct timer_list poll_timer; /* SA-111 workaround */
struct work_struct work;
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index ff8e5be..7841cae 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -44,40 +44,41 @@ static const struct hv_guid netvsc_device_type = {
}
};
-static int netvsc_device_add(struct vm_device *device, void *additional_info);
+static int netvsc_device_add(struct hyperv_device *device,
+ void *additional_info);
-static int netvsc_device_remove(struct vm_device *device);
+static int netvsc_device_remove(struct hyperv_device *device);
static void netvsc_cleanup(struct hv_driver *driver);
static void netvsc_channel_cb(void *context);
-static int netvsc_init_send_buf(struct vm_device *device);
+static int netvsc_init_send_buf(struct hyperv_device *device);
-static int netvsc_init_recv_buf(struct vm_device *device);
+static int netvsc_init_recv_buf(struct hyperv_device *device);
static int netvsc_destroy_send_buf(struct netvsc_device *net_device);
static int netvsc_destroy_recv_buf(struct netvsc_device *net_device);
-static int netvsc_connect_vsp(struct vm_device *device);
+static int netvsc_connect_vsp(struct hyperv_device *device);
-static void netvsc_send_completion(struct vm_device *device,
+static void netvsc_send_completion(struct hyperv_device *device,
struct vmpacket_descriptor *packet);
-static int netvsc_send(struct vm_device *device,
+static int netvsc_send(struct hyperv_device *device,
struct hv_netvsc_packet *packet);
-static void netvsc_receive(struct vm_device *device,
+static void netvsc_receive(struct hyperv_device *device,
struct vmpacket_descriptor *packet);
static void netvsc_receive_completion(void *context);
-static void netvsc_send_recv_completion(struct vm_device *device,
+static void netvsc_send_recv_completion(struct hyperv_device *device,
u64 transaction_id);
-static struct netvsc_device *alloc_net_device(struct vm_device *device)
+static struct netvsc_device *alloc_net_device(struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -103,7 +104,8 @@ static void free_net_device(struct netvsc_device *device)
/* Get the net device object iff exists and its refcount > 1 */
-static struct netvsc_device *get_outbound_net_device(struct vm_device *device)
+static struct netvsc_device *
+get_outbound_net_device(struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -117,7 +119,8 @@ static struct netvsc_device *get_outbound_net_device(struct vm_device *device)
}
/* Get the net device object iff exists and its refcount > 0 */
-static struct netvsc_device *get_inbound_net_device(struct vm_device *device)
+static struct netvsc_device *
+get_inbound_net_device(struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -130,7 +133,7 @@ static struct netvsc_device *get_inbound_net_device(struct vm_device *device)
return net_device;
}
-static void put_net_device(struct vm_device *device)
+static void put_net_device(struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -140,7 +143,7 @@ static void put_net_device(struct vm_device *device)
}
static struct netvsc_device *release_outbound_net_device(
- struct vm_device *device)
+ struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -156,7 +159,7 @@ static struct netvsc_device *release_outbound_net_device(
}
static struct netvsc_device *release_inbound_net_device(
- struct vm_device *device)
+ struct hyperv_device *device)
{
struct netvsc_device *net_device;
@@ -200,7 +203,7 @@ int netvsc_initialize(struct hv_driver *drv)
return 0;
}
-static int netvsc_init_recv_buf(struct vm_device *device)
+static int netvsc_init_recv_buf(struct hyperv_device *device)
{
int ret = 0;
struct netvsc_device *net_device;
@@ -330,7 +333,7 @@ exit:
return ret;
}
-static int netvsc_init_send_buf(struct vm_device *device)
+static int netvsc_init_send_buf(struct hyperv_device *device)
{
int ret = 0;
struct netvsc_device *net_device;
@@ -572,7 +575,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
}
-static int netvsc_connect_vsp(struct vm_device *device)
+static int netvsc_connect_vsp(struct hyperv_device *device)
{
int ret;
struct netvsc_device *net_device;
@@ -688,7 +691,8 @@ static void NetVscDisconnectFromVsp(struct netvsc_device *net_device)
* netvsc_device_add - Callback when the device belonging to this
* driver is added
*/
-static int netvsc_device_add(struct vm_device *device, void *additional_info)
+static int
+netvsc_device_add(struct hyperv_device *device, void *additional_info)
{
int ret = 0;
int i;
@@ -781,7 +785,7 @@ cleanup:
/*
* netvsc_device_remove - Callback when the root bus device is removed
*/
-static int netvsc_device_remove(struct vm_device *device)
+static int netvsc_device_remove(struct hyperv_device *device)
{
struct netvsc_device *net_device;
struct hv_netvsc_packet *netvsc_packet, *pos;
@@ -837,7 +841,7 @@ static void netvsc_cleanup(struct hv_driver *drv)
{
}
-static void netvsc_send_completion(struct vm_device *device,
+static void netvsc_send_completion(struct hyperv_device *device,
struct vmpacket_descriptor *packet)
{
struct netvsc_device *net_device;
@@ -886,7 +890,7 @@ static void netvsc_send_completion(struct vm_device *device,
put_net_device(device);
}
-static int netvsc_send(struct vm_device *device,
+static int netvsc_send(struct hyperv_device *device,
struct hv_netvsc_packet *packet)
{
struct netvsc_device *net_device;
@@ -940,7 +944,7 @@ static int netvsc_send(struct vm_device *device,
return ret;
}
-static void netvsc_receive(struct vm_device *device,
+static void netvsc_receive(struct hyperv_device *device,
struct vmpacket_descriptor *packet)
{
struct netvsc_device *net_device;
@@ -1137,7 +1141,7 @@ static void netvsc_receive(struct vm_device *device,
put_net_device(device);
}
-static void netvsc_send_recv_completion(struct vm_device *device,
+static void netvsc_send_recv_completion(struct hyperv_device *device,
u64 transaction_id)
{
struct nvsp_message recvcompMessage;
@@ -1186,7 +1190,7 @@ retry_send_cmplt:
static void netvsc_receive_completion(void *context)
{
struct hv_netvsc_packet *packet = context;
- struct vm_device *device = (struct vm_device *)packet->device;
+ struct hyperv_device *device = (struct hyperv_device *)packet->device;
struct netvsc_device *net_device;
u64 transaction_id = 0;
bool fsend_receive_comp = false;
@@ -1235,7 +1239,7 @@ static void netvsc_receive_completion(void *context)
static void netvsc_channel_cb(void *context)
{
int ret;
- struct vm_device *device = context;
+ struct hyperv_device *device = context;
struct netvsc_device *net_device;
u32 bytes_recvd;
u64 request_id;
diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
index b2709eb..ea3a05f 100644
--- a/drivers/staging/hv/netvsc.h
+++ b/drivers/staging/hv/netvsc.h
@@ -293,7 +293,7 @@ struct nvsp_message {
/* Per netvsc channel-specific */
struct netvsc_device {
- struct vm_device *dev;
+ struct hyperv_device *dev;
atomic_t refcnt;
atomic_t num_outstanding_sends;
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index a9cfeff..e43ff7b 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -49,7 +49,7 @@ struct hv_netvsc_packet {
/* Bookkeeping stuff */
struct list_head list_ent;
- struct vm_device *device;
+ struct hyperv_device *device;
bool is_data_pkt;
/*
@@ -93,12 +93,12 @@ struct netvsc_driver {
* This is set by the caller to allow us to callback when we
* receive a packet from the "wire"
*/
- int (*recv_cb)(struct vm_device *dev,
+ int (*recv_cb)(struct hyperv_device *dev,
struct hv_netvsc_packet *packet);
- void (*link_status_change)(struct vm_device *dev, u32 status);
+ void (*link_status_change)(struct hyperv_device *dev, u32 status);
/* Specific to this driver */
- int (*send)(struct vm_device *dev, struct hv_netvsc_packet *packet);
+ int (*send)(struct hyperv_device *dev, struct hv_netvsc_packet *packet);
void *ctx;
};
@@ -110,7 +110,7 @@ struct netvsc_device_info {
/* Interface */
int netvsc_initialize(struct hv_driver *drv);
-int rndis_filter_open(struct vm_device *dev);
-int rndis_filter_close(struct vm_device *dev);
+int rndis_filter_open(struct hyperv_device *dev);
+int rndis_filter_close(struct hyperv_device *dev);
#endif /* _NETVSC_API_H_ */
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 055986f..31cbbab 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -44,7 +44,7 @@
struct net_device_context {
/* point back to our device context */
- struct vm_device *device_ctx;
+ struct hyperv_device *device_ctx;
unsigned long avail;
};
@@ -76,7 +76,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
- struct vm_device *device_obj = net_device_ctx->device_ctx;
+ struct hyperv_device *device_obj = net_device_ctx->device_ctx;
int ret = 0;
if (netif_carrier_ok(net)) {
@@ -99,7 +99,7 @@ static int netvsc_open(struct net_device *net)
static int netvsc_close(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
- struct vm_device *device_obj = net_device_ctx->device_ctx;
+ struct hyperv_device *device_obj = net_device_ctx->device_ctx;
int ret;
netif_stop_queue(net);
@@ -223,7 +223,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
/*
* netvsc_linkstatus_callback - Link up/down notification
*/
-static void netvsc_linkstatus_callback(struct vm_device *device_obj,
+static void netvsc_linkstatus_callback(struct hyperv_device *device_obj,
unsigned int status)
{
struct net_device *net = dev_get_drvdata(&device_obj->device);
@@ -248,7 +248,7 @@ static void netvsc_linkstatus_callback(struct vm_device *device_obj,
* netvsc_recv_callback - Callback when we receive a packet from the
* "wire" on the specified device.
*/
-static int netvsc_recv_callback(struct vm_device *device_obj,
+static int netvsc_recv_callback(struct hyperv_device *device_obj,
struct hv_netvsc_packet *packet)
{
struct net_device *net = dev_get_drvdata(&device_obj->device);
@@ -343,7 +343,7 @@ static int netvsc_probe(struct device *device)
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct netvsc_device_info device_info;
@@ -414,7 +414,7 @@ static int netvsc_remove(struct device *device)
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret;
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index e0b1b44..b718fa9 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -85,14 +85,14 @@ struct rndis_filter_packet {
};
-static int rndis_filte_device_add(struct vm_device *dev,
+static int rndis_filte_device_add(struct hyperv_device *dev,
void *additional_info);
-static int rndis_filter_device_remove(struct vm_device *dev);
+static int rndis_filter_device_remove(struct hyperv_device *dev);
static void rndis_filter_cleanup(struct hv_driver *drv);
-static int rndis_filter_send(struct vm_device *dev,
+static int rndis_filter_send(struct hyperv_device *dev,
struct hv_netvsc_packet *pkt);
static void rndis_filter_send_completion(void *ctx);
@@ -376,7 +376,7 @@ static void rndis_filter_receive_data(struct rndis_device *dev,
pkt);
}
-static int rndis_filter_receive(struct vm_device *dev,
+static int rndis_filter_receive(struct hyperv_device *dev,
struct hv_netvsc_packet *pkt)
{
struct netvsc_device *net_dev = dev->ext;
@@ -754,7 +754,7 @@ static int rndis_filter_close_device(struct rndis_device *dev)
return ret;
}
-static int rndis_filte_device_add(struct vm_device *dev,
+static int rndis_filte_device_add(struct hyperv_device *dev,
void *additional_info)
{
int ret;
@@ -817,7 +817,7 @@ static int rndis_filte_device_add(struct vm_device *dev,
return ret;
}
-static int rndis_filter_device_remove(struct vm_device *dev)
+static int rndis_filter_device_remove(struct hyperv_device *dev)
{
struct netvsc_device *net_dev = dev->ext;
struct rndis_device *rndis_dev = net_dev->extension;
@@ -838,7 +838,7 @@ static void rndis_filter_cleanup(struct hv_driver *drv)
{
}
-int rndis_filter_open(struct vm_device *dev)
+int rndis_filter_open(struct hyperv_device *dev)
{
struct netvsc_device *netDevice = dev->ext;
@@ -848,7 +848,7 @@ int rndis_filter_open(struct vm_device *dev)
return rndis_filter_open_device(netDevice->extension);
}
-int rndis_filter_close(struct vm_device *dev)
+int rndis_filter_close(struct hyperv_device *dev)
{
struct netvsc_device *netDevice = dev->ext;
@@ -858,7 +858,7 @@ int rndis_filter_close(struct vm_device *dev)
return rndis_filter_close_device(netDevice->extension);
}
-static int rndis_filter_send(struct vm_device *dev,
+static int rndis_filter_send(struct hyperv_device *dev,
struct hv_netvsc_packet *pkt)
{
int ret;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 7b75ab5..6000b0d 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -38,7 +38,7 @@ struct storvsc_request_extension {
/* LIST_ENTRY ListEntry; */
struct hv_storvsc_request *request;
- struct vm_device *device;
+ struct hyperv_device *device;
/* Synchronize the request/response if needed */
int wait_condition;
@@ -49,7 +49,7 @@ struct storvsc_request_extension {
/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
- struct vm_device *device;
+ struct hyperv_device *device;
/* 0 indicates the device is being destroyed */
atomic_t ref_count;
@@ -85,7 +85,8 @@ static const struct hv_guid gStorVscDeviceType = {
};
-static inline struct storvsc_device *alloc_stor_device(struct vm_device *device)
+static inline struct storvsc_device *
+alloc_stor_device(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -110,7 +111,8 @@ static inline void free_stor_device(struct storvsc_device *device)
}
/* Get the stordevice object iff exists and its refcount > 1 */
-static inline struct storvsc_device *get_stor_device(struct vm_device *device)
+static inline struct storvsc_device *
+get_stor_device(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -125,7 +127,7 @@ static inline struct storvsc_device *get_stor_device(struct vm_device *device)
/* Get the stordevice object iff exists and its refcount > 0 */
static inline struct storvsc_device *must_get_stor_device(
- struct vm_device *device)
+ struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -138,7 +140,7 @@ static inline struct storvsc_device *must_get_stor_device(
return stor_device;
}
-static inline void put_stor_device(struct vm_device *device)
+static inline void put_stor_device(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -151,7 +153,7 @@ static inline void put_stor_device(struct vm_device *device)
/* Drop ref count to 1 to effectively disable get_stor_device() */
static inline struct storvsc_device *release_stor_device(
- struct vm_device *device)
+ struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -167,7 +169,7 @@ static inline struct storvsc_device *release_stor_device(
/* Drop ref count to 0. No one can use stor_device object. */
static inline struct storvsc_device *final_release_stor_device(
- struct vm_device *device)
+ struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -182,7 +184,7 @@ static inline struct storvsc_device *final_release_stor_device(
return stor_device;
}
-static int stor_vsc_channel_init(struct vm_device *device)
+static int stor_vsc_channel_init(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
@@ -363,7 +365,7 @@ cleanup:
return ret;
}
-static void stor_vsc_on_io_completion(struct vm_device *device,
+static void stor_vsc_on_io_completion(struct hyperv_device *device,
struct vstor_packet *vstor_packet,
struct storvsc_request_extension *request_ext)
{
@@ -427,7 +429,7 @@ static void stor_vsc_on_io_completion(struct vm_device *device,
put_stor_device(device);
}
-static void stor_vsc_on_receive(struct vm_device *device,
+static void stor_vsc_on_receive(struct hyperv_device *device,
struct vstor_packet *vstor_packet,
struct storvsc_request_extension *request_ext)
{
@@ -450,7 +452,7 @@ static void stor_vsc_on_receive(struct vm_device *device,
static void stor_vsc_on_channel_callback(void *context)
{
- struct vm_device *device = (struct vm_device *)context;
+ struct hyperv_device *device = (struct hyperv_device *)context;
struct storvsc_device *stor_device;
u32 bytes_recvd;
u64 request_id;
@@ -510,7 +512,7 @@ static void stor_vsc_on_channel_callback(void *context)
return;
}
-static int stor_vsc_connect_to_vsp(struct vm_device *device)
+static int stor_vsc_connect_to_vsp(struct hyperv_device *device)
{
struct vmstorage_channel_properties props;
struct storvsc_driver_object *stor_driver;
@@ -544,7 +546,7 @@ static int stor_vsc_connect_to_vsp(struct vm_device *device)
* stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-static int stor_vsc_on_device_add(struct vm_device *device,
+static int stor_vsc_on_device_add(struct hyperv_device *device,
void *additional_info)
{
struct storvsc_device *stor_device;
@@ -593,7 +595,7 @@ cleanup:
/*
* stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-static int stor_vsc_on_device_remove(struct vm_device *device)
+static int stor_vsc_on_device_remove(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
@@ -627,7 +629,7 @@ static int stor_vsc_on_device_remove(struct vm_device *device)
return 0;
}
-int stor_vsc_on_host_reset(struct vm_device *device)
+int stor_vsc_on_host_reset(struct hyperv_device *device)
{
struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
@@ -686,7 +688,7 @@ cleanup:
/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-static int stor_vsc_on_io_request(struct vm_device *device,
+static int stor_vsc_on_io_request(struct hyperv_device *device,
struct hv_storvsc_request *request)
{
struct storvsc_device *stor_device;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 8bed6f5..c2915b4 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -92,7 +92,7 @@ struct storvsc_driver_object {
u32 max_outstanding_req_per_channel;
/* Specific to this driver */
- int (*on_io_request)(struct vm_device *device,
+ int (*on_io_request)(struct hyperv_device *device,
struct hv_storvsc_request *request);
};
@@ -104,7 +104,7 @@ struct storvsc_device_info {
/* Interface */
int stor_vsc_initialize(struct hv_driver *driver);
-int stor_vsc_on_host_reset(struct vm_device *device);
+int stor_vsc_on_host_reset(struct hyperv_device *device);
int blk_vsc_initialize(struct hv_driver *driver);
#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 216d8ff..2b9a097 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -43,7 +43,7 @@ struct host_device_context {
/* must be 1st field
* FIXME this is a bug */
/* point back to our device context */
- struct vm_device *device_ctx;
+ struct hyperv_device *device_ctx;
struct kmem_cache *request_pool;
unsigned int port;
unsigned char path;
@@ -226,7 +226,7 @@ static int storvsc_probe(struct device *device)
(struct storvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
struct storvsc_device_info device_info;
@@ -310,7 +310,7 @@ static int storvsc_remove(struct device *device)
(struct storvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
- struct vm_device *device_obj = device_to_vm_device(device);
+ struct hyperv_device *device_obj = device_to_hyperv_device(device);
struct Scsi_Host *host = dev_get_drvdata(device);
struct host_device_context *host_device_ctx =
(struct host_device_context *)host->hostdata;
@@ -600,7 +600,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
int ret;
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
- struct vm_device *device_ctx = host_device_ctx->device_ctx;
+ struct hyperv_device *device_ctx = host_device_ctx->device_ctx;
struct driver_context *driver_ctx =
driver_to_driver_context(device_ctx->device.driver);
struct storvsc_driver_context *storvsc_drv_ctx =
@@ -838,7 +838,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
int ret;
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
- struct vm_device *device_ctx = host_device_ctx->device_ctx;
+ struct hyperv_device *device_ctx = host_device_ctx->device_ctx;
DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
scmnd->device, device_ctx);
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index e56e61a..1ac7e56 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -43,7 +43,7 @@ struct driver_context {
void (*shutdown)(struct device *);
};
-struct vm_device {
+struct hyperv_device {
char name[64];
struct work_struct probe_failed_work_item;
struct hv_guid class_id; /* device type id */
@@ -56,9 +56,9 @@ struct vm_device {
};
-static inline struct vm_device *device_to_vm_device(struct device *d)
+static inline struct hyperv_device *device_to_hyperv_device(struct device *d)
{
- return container_of(d, struct vm_device, device);
+ return container_of(d, struct hyperv_device, device);
}
static inline struct driver_context *driver_to_driver_context(struct device_driver *d)
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index bf84fb0..260086f 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -56,7 +56,7 @@ struct hv_multipage_buffer {
#pragma pack(pop)
struct hv_driver;
-struct vm_device;
+struct hyperv_device;
struct hv_dev_port_info {
u32 int_mask;
@@ -66,7 +66,7 @@ struct hv_dev_port_info {
u32 bytes_avail_towrite;
};
-struct vm_device_info {
+struct hyperv_device_info {
u32 chn_id;
u32 chn_state;
struct hv_guid chn_type;
@@ -91,8 +91,8 @@ struct hv_driver {
/* the device type supported by this driver */
struct hv_guid class_id;
- int (*dev_add)(struct vm_device *device, void *data);
- int (*dev_rm)(struct vm_device *device);
+ int (*dev_add)(struct hyperv_device *device, void *data);
+ int (*dev_rm)(struct hyperv_device *device);
void (*cleanup)(struct hv_driver *driver);
};
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 531b68d..38152df 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -54,7 +54,7 @@ struct vmbus_driver_context {
struct tasklet_struct event_dpc;
/* The bus root device */
- struct vm_device device_ctx;
+ struct hyperv_device device_ctx;
};
static int vmbus_match(struct device *device, struct device_driver *driver);
@@ -145,12 +145,12 @@ static const struct hv_guid device_id = {
}
};
-static struct vm_device *vmbus_device; /* vmbus root device */
+static struct hyperv_device *vmbus_device; /* vmbus root device */
/*
* vmbus_child_dev_add - Registers the child device with the vmbus
*/
-int vmbus_child_dev_add(struct vm_device *child_dev)
+int vmbus_child_dev_add(struct hyperv_device *child_dev)
{
return vmbus_child_device_register(vmbus_device, child_dev);
}
@@ -158,7 +158,7 @@ int vmbus_child_dev_add(struct vm_device *child_dev)
/*
* vmbus_dev_add - Callback when the root bus device is added
*/
-static int vmbus_dev_add(struct vm_device *dev, void *info)
+static int vmbus_dev_add(struct hyperv_device *dev, void *info)
{
u32 *irqvector = info;
int ret;
@@ -183,7 +183,7 @@ static int vmbus_dev_add(struct vm_device *dev, void *info)
/*
* vmbus_dev_rm - Callback when the root bus device is removed
*/
-static int vmbus_dev_rm(struct vm_device *dev)
+static int vmbus_dev_rm(struct hyperv_device *dev)
{
int ret = 0;
@@ -299,8 +299,8 @@ static int vmbus_on_isr(struct hv_driver *drv)
return ret;
}
-static void get_channel_info(struct vm_device *device,
- struct vm_device_info *info)
+static void get_channel_info(struct hyperv_device *device,
+ struct hyperv_device_info *info)
{
struct vmbus_channel_debug_info debug_info;
@@ -354,10 +354,10 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
struct device_attribute *dev_attr,
char *buf)
{
- struct vm_device *device_ctx = device_to_vm_device(dev);
- struct vm_device_info device_info;
+ struct hyperv_device *device_ctx = device_to_hyperv_device(dev);
+ struct hyperv_device_info device_info;
- memset(&device_info, 0, sizeof(struct vm_device_info));
+ memset(&device_info, 0, sizeof(struct hyperv_device_info));
get_channel_info(device_ctx, &device_info);
@@ -464,7 +464,7 @@ static int vmbus_bus_init(void)
{
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
struct hv_driver *driver = &vmbus_drv.drv_obj;
- struct vm_device *dev_ctx = &vmbus_drv.device_ctx;
+ struct hyperv_device *dev_ctx = &vmbus_drv.device_ctx;
int ret;
unsigned int vector;
@@ -535,7 +535,7 @@ static int vmbus_bus_init(void)
DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
/* Call to bus driver to add the root device */
- memset(dev_ctx, 0, sizeof(struct vm_device));
+ memset(dev_ctx, 0, sizeof(struct hyperv_device));
ret = driver->dev_add(dev_ctx, &vector);
if (ret != 0) {
@@ -590,7 +590,7 @@ static void vmbus_bus_exit(void)
struct hv_driver *driver = &vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
- struct vm_device *dev_ctx = &vmbus_drv.device_ctx;
+ struct hyperv_device *dev_ctx = &vmbus_drv.device_ctx;
/* Remove the root device */
if (driver->dev_rm)
@@ -667,14 +667,14 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister);
* vmbus_child_device_create - Creates and registers a new child device
* on the vmbus.
*/
-struct vm_device *vmbus_child_device_create(struct hv_guid *type,
+struct hyperv_device *vmbus_child_device_create(struct hv_guid *type,
struct hv_guid *instance,
struct vmbus_channel *channel)
{
- struct vm_device *child_device_ctx;
+ struct hyperv_device *child_device_ctx;
/* Allocate the new child device */
- child_device_ctx = kzalloc(sizeof(struct vm_device), GFP_KERNEL);
+ child_device_ctx = kzalloc(sizeof(struct hyperv_device), GFP_KERNEL);
if (!child_device_ctx) {
DPRINT_ERR(VMBUS_DRV,
"unable to allocate device_context for child device");
@@ -711,8 +711,8 @@ struct vm_device *vmbus_child_device_create(struct hv_guid *type,
/*
* vmbus_child_device_register - Register the child device on the specified bus
*/
-int vmbus_child_device_register(struct vm_device *root_device_obj,
- struct vm_device *child_device_obj)
+int vmbus_child_device_register(struct hyperv_device *root_device_obj,
+ struct hyperv_device *child_device_obj)
{
int ret = 0;
static atomic_t device_num = ATOMIC_INIT(0);
@@ -752,7 +752,7 @@ int vmbus_child_device_register(struct vm_device *root_device_obj,
* vmbus_child_device_unregister - Remove the specified child device
* from the vmbus.
*/
-void vmbus_child_device_unregister(struct vm_device *device_obj)
+void vmbus_child_device_unregister(struct hyperv_device *device_obj)
{
DPRINT_INFO(VMBUS_DRV, "unregistering child device (%p)",
@@ -777,7 +777,7 @@ void vmbus_child_device_unregister(struct vm_device *device_obj)
*/
static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
{
- struct vm_device *device_ctx = device_to_vm_device(device);
+ struct hyperv_device *device_ctx = device_to_hyperv_device(device);
int ret;
DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={"
@@ -850,7 +850,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
{
int match = 0;
struct driver_context *driver_ctx = driver_to_driver_context(driver);
- struct vm_device *device_ctx = device_to_vm_device(device);
+ struct hyperv_device *device_ctx = device_to_hyperv_device(device);
/* We found our driver ? */
if (memcmp(&device_ctx->class_id, &driver_ctx->class_id,
@@ -882,7 +882,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
*/
static void vmbus_probe_failed_cb(struct work_struct *context)
{
- struct vm_device *device_ctx = (struct vm_device *)context;
+ struct hyperv_device *device_ctx = (struct hyperv_device *)context;
/*
* Kick off the process of unregistering the device.
@@ -901,8 +901,8 @@ static int vmbus_probe(struct device *child_device)
int ret = 0;
struct driver_context *driver_ctx =
driver_to_driver_context(child_device->driver);
- struct vm_device *device_ctx =
- device_to_vm_device(child_device);
+ struct hyperv_device *device_ctx =
+ device_to_hyperv_device(child_device);
/* Let the specific open-source driver handles the probe if it can */
if (driver_ctx->probe) {
@@ -1008,7 +1008,7 @@ static void vmbus_bus_release(struct device *device)
*/
static void vmbus_device_release(struct device *device)
{
- struct vm_device *device_ctx = device_to_vm_device(device);
+ struct hyperv_device *device_ctx = device_to_hyperv_device(device);
kfree(device_ctx);
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 206218c..4a8f2e8 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -103,18 +103,18 @@ extern struct vmbus_connection vmbus_connection;
/* General vmbus interface */
-struct vm_device *vmbus_child_device_create(struct hv_guid *type,
+struct hyperv_device *vmbus_child_device_create(struct hv_guid *type,
struct hv_guid *instance,
struct vmbus_channel *channel);
-int vmbus_child_dev_add(struct vm_device *device);
-int vmbus_child_device_register(struct vm_device *root_device_obj,
- struct vm_device *child_device_obj);
-void vmbus_child_device_unregister(struct vm_device *device_obj);
+int vmbus_child_dev_add(struct hyperv_device *device);
+int vmbus_child_device_register(struct hyperv_device *root_device_obj,
+ struct hyperv_device *child_device_obj);
+void vmbus_child_device_unregister(struct hyperv_device *device_obj);
/* static void */
/* VmbusChildDeviceDestroy( */
-/* struct vm_device *); */
+/* struct hyperv_device *); */
struct vmbus_channel *relid2channel(u32 relid);
--
1.5.5.6
^ permalink raw reply related
* [PATCH 1/6] Staging: hv: Unify hyper-v device abstractions
From: K. Y. Srinivasan @ 2011-02-26 2:05 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Hyper-V drivers have supported two device abstractions.
This patch implements a single device abstraction.
This simplifies the code and avoids duplication
of state.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc.c | 17 ++++---
drivers/staging/hv/blkvsc_drv.c | 14 +++---
drivers/staging/hv/channel_mgmt.c | 1 +
drivers/staging/hv/channel_mgmt.h | 2 +-
drivers/staging/hv/netvsc.c | 55 ++++++++++++-----------
drivers/staging/hv/netvsc.h | 2 +-
drivers/staging/hv/netvsc_api.h | 12 +++---
drivers/staging/hv/netvsc_drv.c | 28 +++++-------
drivers/staging/hv/rndis_filter.c | 19 ++++----
drivers/staging/hv/storvsc.c | 37 ++++++++--------
drivers/staging/hv/storvsc_api.h | 4 +-
drivers/staging/hv/storvsc_drv.c | 21 ++++-----
drivers/staging/hv/vmbus.h | 13 +++---
drivers/staging/hv/vmbus_api.h | 29 ++----------
drivers/staging/hv/vmbus_drv.c | 84 +++++++++++++++---------------------
drivers/staging/hv/vmbus_private.h | 12 +++---
16 files changed, 157 insertions(+), 193 deletions(-)
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 7c8729b..ecface3 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -35,7 +35,8 @@ static const struct hv_guid g_blk_device_type = {
}
};
-static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info)
+static int blk_vsc_on_device_add(struct vm_device *device,
+ void *additional_info)
{
struct storvsc_device_info *device_info;
int ret = 0;
@@ -51,13 +52,13 @@ static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info
* id. For IDE devices, the device instance id is formatted as
* <bus id> * - <device id> - 8899 - 000000000000.
*/
- device_info->path_id = device->dev_instance.data[3] << 24 |
- device->dev_instance.data[2] << 16 |
- device->dev_instance.data[1] << 8 |
- device->dev_instance.data[0];
+ device_info->path_id = device->device_id.data[3] << 24 |
+ device->device_id.data[2] << 16 |
+ device->device_id.data[1] << 8 |
+ device->device_id.data[0];
- device_info->target_id = device->dev_instance.data[5] << 8 |
- device->dev_instance.data[4];
+ device_info->target_id = device->device_id.data[5] << 8 |
+ device->device_id.data[4];
return ret;
}
@@ -73,7 +74,7 @@ int blk_vsc_initialize(struct hv_driver *driver)
/* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */
driver->name = g_blk_driver_name;
- memcpy(&driver->dev_type, &g_blk_device_type, sizeof(struct hv_guid));
+ memcpy(&driver->class_id, &g_blk_device_type, sizeof(struct hv_guid));
stor_driver->request_ext_size = sizeof(struct storvsc_request_extension);
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 36a0adb..6d1a783 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -183,7 +183,7 @@ static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
drv_init(&storvsc_drv_obj->base);
drv_ctx->driver.name = storvsc_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.dev_type,
+ memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.class_id,
sizeof(struct hv_guid));
drv_ctx->probe = blkvsc_probe;
@@ -249,8 +249,7 @@ static int blkvsc_probe(struct device *device)
(struct blkvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
@@ -282,7 +281,7 @@ static int blkvsc_probe(struct device *device)
/* ASSERT(sizeof(struct blkvsc_request_group) <= */
/* sizeof(struct blkvsc_request)); */
- blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device),
+ blkdev->request_pool = kmem_cache_create(dev_name(&device_obj->device),
sizeof(struct blkvsc_request) +
storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
@@ -299,7 +298,7 @@ static int blkvsc_probe(struct device *device)
goto Cleanup;
}
- blkdev->device_ctx = device_ctx;
+ blkdev->device_ctx = device_obj;
/* this identified the device 0 or 1 */
blkdev->target = device_info.target_id;
/* this identified the ide ctrl 0 or 1 */
@@ -734,8 +733,7 @@ static int blkvsc_remove(struct device *device)
(struct blkvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
int ret;
@@ -897,7 +895,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
- ret = storvsc_drv_obj->on_io_request(&blkdev->device_ctx->device_obj,
+ ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 0781c0e..8d81288 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -28,6 +28,7 @@
#include <linux/completion.h>
#include "hv_api.h"
#include "logging.h"
+#include "vmbus.h"
#include "vmbus_private.h"
#include "utils.h"
diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h
index 3368bf1..b3a9214 100644
--- a/drivers/staging/hv/channel_mgmt.h
+++ b/drivers/staging/hv/channel_mgmt.h
@@ -228,7 +228,7 @@ enum vmbus_channel_state {
struct vmbus_channel {
struct list_head listentry;
- struct hv_device *device_obj;
+ struct vm_device *device_obj;
struct timer_list poll_timer; /* SA-111 workaround */
struct work_struct work;
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 20b1597..ff8e5be 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -26,6 +26,7 @@
#include <linux/io.h>
#include <linux/slab.h>
#include "hv_api.h"
+#include "vmbus.h"
#include "logging.h"
#include "netvsc.h"
#include "rndis_filter.h"
@@ -43,40 +44,40 @@ static const struct hv_guid netvsc_device_type = {
}
};
-static int netvsc_device_add(struct hv_device *device, void *additional_info);
+static int netvsc_device_add(struct vm_device *device, void *additional_info);
-static int netvsc_device_remove(struct hv_device *device);
+static int netvsc_device_remove(struct vm_device *device);
static void netvsc_cleanup(struct hv_driver *driver);
static void netvsc_channel_cb(void *context);
-static int netvsc_init_send_buf(struct hv_device *device);
+static int netvsc_init_send_buf(struct vm_device *device);
-static int netvsc_init_recv_buf(struct hv_device *device);
+static int netvsc_init_recv_buf(struct vm_device *device);
static int netvsc_destroy_send_buf(struct netvsc_device *net_device);
static int netvsc_destroy_recv_buf(struct netvsc_device *net_device);
-static int netvsc_connect_vsp(struct hv_device *device);
+static int netvsc_connect_vsp(struct vm_device *device);
-static void netvsc_send_completion(struct hv_device *device,
+static void netvsc_send_completion(struct vm_device *device,
struct vmpacket_descriptor *packet);
-static int netvsc_send(struct hv_device *device,
+static int netvsc_send(struct vm_device *device,
struct hv_netvsc_packet *packet);
-static void netvsc_receive(struct hv_device *device,
+static void netvsc_receive(struct vm_device *device,
struct vmpacket_descriptor *packet);
static void netvsc_receive_completion(void *context);
-static void netvsc_send_recv_completion(struct hv_device *device,
+static void netvsc_send_recv_completion(struct vm_device *device,
u64 transaction_id);
-static struct netvsc_device *alloc_net_device(struct hv_device *device)
+static struct netvsc_device *alloc_net_device(struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -102,7 +103,7 @@ static void free_net_device(struct netvsc_device *device)
/* Get the net device object iff exists and its refcount > 1 */
-static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
+static struct netvsc_device *get_outbound_net_device(struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -116,7 +117,7 @@ static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
}
/* Get the net device object iff exists and its refcount > 0 */
-static struct netvsc_device *get_inbound_net_device(struct hv_device *device)
+static struct netvsc_device *get_inbound_net_device(struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -129,7 +130,7 @@ static struct netvsc_device *get_inbound_net_device(struct hv_device *device)
return net_device;
}
-static void put_net_device(struct hv_device *device)
+static void put_net_device(struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -139,7 +140,7 @@ static void put_net_device(struct hv_device *device)
}
static struct netvsc_device *release_outbound_net_device(
- struct hv_device *device)
+ struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -155,7 +156,7 @@ static struct netvsc_device *release_outbound_net_device(
}
static struct netvsc_device *release_inbound_net_device(
- struct hv_device *device)
+ struct vm_device *device)
{
struct netvsc_device *net_device;
@@ -186,7 +187,7 @@ int netvsc_initialize(struct hv_driver *drv)
sizeof(struct vmtransfer_page_packet_header));
drv->name = driver_name;
- memcpy(&drv->dev_type, &netvsc_device_type, sizeof(struct hv_guid));
+ memcpy(&drv->class_id, &netvsc_device_type, sizeof(struct hv_guid));
/* Setup the dispatch table */
driver->base.dev_add = netvsc_device_add;
@@ -199,7 +200,7 @@ int netvsc_initialize(struct hv_driver *drv)
return 0;
}
-static int netvsc_init_recv_buf(struct hv_device *device)
+static int netvsc_init_recv_buf(struct vm_device *device)
{
int ret = 0;
struct netvsc_device *net_device;
@@ -329,7 +330,7 @@ exit:
return ret;
}
-static int netvsc_init_send_buf(struct hv_device *device)
+static int netvsc_init_send_buf(struct vm_device *device)
{
int ret = 0;
struct netvsc_device *net_device;
@@ -571,7 +572,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
}
-static int netvsc_connect_vsp(struct hv_device *device)
+static int netvsc_connect_vsp(struct vm_device *device)
{
int ret;
struct netvsc_device *net_device;
@@ -687,7 +688,7 @@ static void NetVscDisconnectFromVsp(struct netvsc_device *net_device)
* netvsc_device_add - Callback when the device belonging to this
* driver is added
*/
-static int netvsc_device_add(struct hv_device *device, void *additional_info)
+static int netvsc_device_add(struct vm_device *device, void *additional_info)
{
int ret = 0;
int i;
@@ -780,7 +781,7 @@ cleanup:
/*
* netvsc_device_remove - Callback when the root bus device is removed
*/
-static int netvsc_device_remove(struct hv_device *device)
+static int netvsc_device_remove(struct vm_device *device)
{
struct netvsc_device *net_device;
struct hv_netvsc_packet *netvsc_packet, *pos;
@@ -836,7 +837,7 @@ static void netvsc_cleanup(struct hv_driver *drv)
{
}
-static void netvsc_send_completion(struct hv_device *device,
+static void netvsc_send_completion(struct vm_device *device,
struct vmpacket_descriptor *packet)
{
struct netvsc_device *net_device;
@@ -885,7 +886,7 @@ static void netvsc_send_completion(struct hv_device *device,
put_net_device(device);
}
-static int netvsc_send(struct hv_device *device,
+static int netvsc_send(struct vm_device *device,
struct hv_netvsc_packet *packet)
{
struct netvsc_device *net_device;
@@ -939,7 +940,7 @@ static int netvsc_send(struct hv_device *device,
return ret;
}
-static void netvsc_receive(struct hv_device *device,
+static void netvsc_receive(struct vm_device *device,
struct vmpacket_descriptor *packet)
{
struct netvsc_device *net_device;
@@ -1136,7 +1137,7 @@ static void netvsc_receive(struct hv_device *device,
put_net_device(device);
}
-static void netvsc_send_recv_completion(struct hv_device *device,
+static void netvsc_send_recv_completion(struct vm_device *device,
u64 transaction_id)
{
struct nvsp_message recvcompMessage;
@@ -1185,7 +1186,7 @@ retry_send_cmplt:
static void netvsc_receive_completion(void *context)
{
struct hv_netvsc_packet *packet = context;
- struct hv_device *device = (struct hv_device *)packet->device;
+ struct vm_device *device = (struct vm_device *)packet->device;
struct netvsc_device *net_device;
u64 transaction_id = 0;
bool fsend_receive_comp = false;
@@ -1234,7 +1235,7 @@ static void netvsc_receive_completion(void *context)
static void netvsc_channel_cb(void *context)
{
int ret;
- struct hv_device *device = context;
+ struct vm_device *device = context;
struct netvsc_device *net_device;
u32 bytes_recvd;
u64 request_id;
diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
index 45d24b9..b2709eb 100644
--- a/drivers/staging/hv/netvsc.h
+++ b/drivers/staging/hv/netvsc.h
@@ -293,7 +293,7 @@ struct nvsp_message {
/* Per netvsc channel-specific */
struct netvsc_device {
- struct hv_device *dev;
+ struct vm_device *dev;
atomic_t refcnt;
atomic_t num_outstanding_sends;
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index b4bed36..a9cfeff 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -49,7 +49,7 @@ struct hv_netvsc_packet {
/* Bookkeeping stuff */
struct list_head list_ent;
- struct hv_device *device;
+ struct vm_device *device;
bool is_data_pkt;
/*
@@ -93,12 +93,12 @@ struct netvsc_driver {
* This is set by the caller to allow us to callback when we
* receive a packet from the "wire"
*/
- int (*recv_cb)(struct hv_device *dev,
+ int (*recv_cb)(struct vm_device *dev,
struct hv_netvsc_packet *packet);
- void (*link_status_change)(struct hv_device *dev, u32 status);
+ void (*link_status_change)(struct vm_device *dev, u32 status);
/* Specific to this driver */
- int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
+ int (*send)(struct vm_device *dev, struct hv_netvsc_packet *packet);
void *ctx;
};
@@ -110,7 +110,7 @@ struct netvsc_device_info {
/* Interface */
int netvsc_initialize(struct hv_driver *drv);
-int rndis_filter_open(struct hv_device *dev);
-int rndis_filter_close(struct hv_device *dev);
+int rndis_filter_open(struct vm_device *dev);
+int rndis_filter_close(struct vm_device *dev);
#endif /* _NETVSC_API_H_ */
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 03f9740..055986f 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -76,7 +76,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
- struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
+ struct vm_device *device_obj = net_device_ctx->device_ctx;
int ret = 0;
if (netif_carrier_ok(net)) {
@@ -99,7 +99,7 @@ static int netvsc_open(struct net_device *net)
static int netvsc_close(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
- struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
+ struct vm_device *device_obj = net_device_ctx->device_ctx;
int ret;
netif_stop_queue(net);
@@ -198,7 +198,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
packet->completion.send.send_completion_ctx = packet;
packet->completion.send.send_completion_tid = (unsigned long)skb;
- ret = net_drv_obj->send(&net_device_ctx->device_ctx->device_obj,
+ ret = net_drv_obj->send(net_device_ctx->device_ctx,
packet);
if (ret == 0) {
net->stats.tx_bytes += skb->len;
@@ -223,11 +223,10 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
/*
* netvsc_linkstatus_callback - Link up/down notification
*/
-static void netvsc_linkstatus_callback(struct hv_device *device_obj,
+static void netvsc_linkstatus_callback(struct vm_device *device_obj,
unsigned int status)
{
- struct vm_device *device_ctx = to_vm_device(device_obj);
- struct net_device *net = dev_get_drvdata(&device_ctx->device);
+ struct net_device *net = dev_get_drvdata(&device_obj->device);
if (!net) {
DPRINT_ERR(NETVSC_DRV, "got link status but net device "
@@ -249,11 +248,10 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
* netvsc_recv_callback - Callback when we receive a packet from the
* "wire" on the specified device.
*/
-static int netvsc_recv_callback(struct hv_device *device_obj,
+static int netvsc_recv_callback(struct vm_device *device_obj,
struct hv_netvsc_packet *packet)
{
- struct vm_device *device_ctx = to_vm_device(device_obj);
- struct net_device *net = dev_get_drvdata(&device_ctx->device);
+ struct net_device *net = dev_get_drvdata(&device_obj->device);
struct sk_buff *skb;
void *data;
int i;
@@ -345,8 +343,7 @@ static int netvsc_probe(struct device *device)
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct netvsc_device_info device_info;
@@ -363,7 +360,7 @@ static int netvsc_probe(struct device *device)
netif_carrier_off(net);
net_device_ctx = netdev_priv(net);
- net_device_ctx->device_ctx = device_ctx;
+ net_device_ctx->device_ctx = device_obj;
net_device_ctx->avail = ring_size;
dev_set_drvdata(device, net);
@@ -417,9 +414,8 @@ static int netvsc_remove(struct device *device)
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct net_device *net = dev_get_drvdata(&device_ctx->device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
+ struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret;
if (net == NULL) {
@@ -508,7 +504,7 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
drv_init(&net_drv_obj->base);
drv_ctx->driver.name = net_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &net_drv_obj->base.dev_type,
+ memcpy(&drv_ctx->class_id, &net_drv_obj->base.class_id,
sizeof(struct hv_guid));
drv_ctx->probe = netvsc_probe;
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index e7189cd..e0b1b44 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -28,6 +28,7 @@
#include "logging.h"
#include "hv_api.h"
+#include "vmbus.h"
#include "netvsc_api.h"
#include "rndis_filter.h"
@@ -84,14 +85,14 @@ struct rndis_filter_packet {
};
-static int rndis_filte_device_add(struct hv_device *dev,
+static int rndis_filte_device_add(struct vm_device *dev,
void *additional_info);
-static int rndis_filter_device_remove(struct hv_device *dev);
+static int rndis_filter_device_remove(struct vm_device *dev);
static void rndis_filter_cleanup(struct hv_driver *drv);
-static int rndis_filter_send(struct hv_device *dev,
+static int rndis_filter_send(struct vm_device *dev,
struct hv_netvsc_packet *pkt);
static void rndis_filter_send_completion(void *ctx);
@@ -375,7 +376,7 @@ static void rndis_filter_receive_data(struct rndis_device *dev,
pkt);
}
-static int rndis_filter_receive(struct hv_device *dev,
+static int rndis_filter_receive(struct vm_device *dev,
struct hv_netvsc_packet *pkt)
{
struct netvsc_device *net_dev = dev->ext;
@@ -753,7 +754,7 @@ static int rndis_filter_close_device(struct rndis_device *dev)
return ret;
}
-static int rndis_filte_device_add(struct hv_device *dev,
+static int rndis_filte_device_add(struct vm_device *dev,
void *additional_info)
{
int ret;
@@ -816,7 +817,7 @@ static int rndis_filte_device_add(struct hv_device *dev,
return ret;
}
-static int rndis_filter_device_remove(struct hv_device *dev)
+static int rndis_filter_device_remove(struct vm_device *dev)
{
struct netvsc_device *net_dev = dev->ext;
struct rndis_device *rndis_dev = net_dev->extension;
@@ -837,7 +838,7 @@ static void rndis_filter_cleanup(struct hv_driver *drv)
{
}
-int rndis_filter_open(struct hv_device *dev)
+int rndis_filter_open(struct vm_device *dev)
{
struct netvsc_device *netDevice = dev->ext;
@@ -847,7 +848,7 @@ int rndis_filter_open(struct hv_device *dev)
return rndis_filter_open_device(netDevice->extension);
}
-int rndis_filter_close(struct hv_device *dev)
+int rndis_filter_close(struct vm_device *dev)
{
struct netvsc_device *netDevice = dev->ext;
@@ -857,7 +858,7 @@ int rndis_filter_close(struct hv_device *dev)
return rndis_filter_close_device(netDevice->extension);
}
-static int rndis_filter_send(struct hv_device *dev,
+static int rndis_filter_send(struct vm_device *dev,
struct hv_netvsc_packet *pkt)
{
int ret;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index e2ad729..7b75ab5 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -26,6 +26,7 @@
#include <linux/mm.h>
#include <linux/delay.h>
#include "hv_api.h"
+#include "vmbus.h"
#include "logging.h"
#include "storvsc_api.h"
#include "vmbus_packet_format.h"
@@ -37,7 +38,7 @@ struct storvsc_request_extension {
/* LIST_ENTRY ListEntry; */
struct hv_storvsc_request *request;
- struct hv_device *device;
+ struct vm_device *device;
/* Synchronize the request/response if needed */
int wait_condition;
@@ -48,7 +49,7 @@ struct storvsc_request_extension {
/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
- struct hv_device *device;
+ struct vm_device *device;
/* 0 indicates the device is being destroyed */
atomic_t ref_count;
@@ -84,7 +85,7 @@ static const struct hv_guid gStorVscDeviceType = {
};
-static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
+static inline struct storvsc_device *alloc_stor_device(struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -109,7 +110,7 @@ static inline void free_stor_device(struct storvsc_device *device)
}
/* Get the stordevice object iff exists and its refcount > 1 */
-static inline struct storvsc_device *get_stor_device(struct hv_device *device)
+static inline struct storvsc_device *get_stor_device(struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -124,7 +125,7 @@ static inline struct storvsc_device *get_stor_device(struct hv_device *device)
/* Get the stordevice object iff exists and its refcount > 0 */
static inline struct storvsc_device *must_get_stor_device(
- struct hv_device *device)
+ struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -137,7 +138,7 @@ static inline struct storvsc_device *must_get_stor_device(
return stor_device;
}
-static inline void put_stor_device(struct hv_device *device)
+static inline void put_stor_device(struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -150,7 +151,7 @@ static inline void put_stor_device(struct hv_device *device)
/* Drop ref count to 1 to effectively disable get_stor_device() */
static inline struct storvsc_device *release_stor_device(
- struct hv_device *device)
+ struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -166,7 +167,7 @@ static inline struct storvsc_device *release_stor_device(
/* Drop ref count to 0. No one can use stor_device object. */
static inline struct storvsc_device *final_release_stor_device(
- struct hv_device *device)
+ struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -181,7 +182,7 @@ static inline struct storvsc_device *final_release_stor_device(
return stor_device;
}
-static int stor_vsc_channel_init(struct hv_device *device)
+static int stor_vsc_channel_init(struct vm_device *device)
{
struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
@@ -362,7 +363,7 @@ cleanup:
return ret;
}
-static void stor_vsc_on_io_completion(struct hv_device *device,
+static void stor_vsc_on_io_completion(struct vm_device *device,
struct vstor_packet *vstor_packet,
struct storvsc_request_extension *request_ext)
{
@@ -426,7 +427,7 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
put_stor_device(device);
}
-static void stor_vsc_on_receive(struct hv_device *device,
+static void stor_vsc_on_receive(struct vm_device *device,
struct vstor_packet *vstor_packet,
struct storvsc_request_extension *request_ext)
{
@@ -449,7 +450,7 @@ static void stor_vsc_on_receive(struct hv_device *device,
static void stor_vsc_on_channel_callback(void *context)
{
- struct hv_device *device = (struct hv_device *)context;
+ struct vm_device *device = (struct vm_device *)context;
struct storvsc_device *stor_device;
u32 bytes_recvd;
u64 request_id;
@@ -509,7 +510,7 @@ static void stor_vsc_on_channel_callback(void *context)
return;
}
-static int stor_vsc_connect_to_vsp(struct hv_device *device)
+static int stor_vsc_connect_to_vsp(struct vm_device *device)
{
struct vmstorage_channel_properties props;
struct storvsc_driver_object *stor_driver;
@@ -543,7 +544,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *device)
* stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-static int stor_vsc_on_device_add(struct hv_device *device,
+static int stor_vsc_on_device_add(struct vm_device *device,
void *additional_info)
{
struct storvsc_device *stor_device;
@@ -592,7 +593,7 @@ cleanup:
/*
* stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-static int stor_vsc_on_device_remove(struct hv_device *device)
+static int stor_vsc_on_device_remove(struct vm_device *device)
{
struct storvsc_device *stor_device;
@@ -626,7 +627,7 @@ static int stor_vsc_on_device_remove(struct hv_device *device)
return 0;
}
-int stor_vsc_on_host_reset(struct hv_device *device)
+int stor_vsc_on_host_reset(struct vm_device *device)
{
struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
@@ -685,7 +686,7 @@ cleanup:
/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-static int stor_vsc_on_io_request(struct hv_device *device,
+static int stor_vsc_on_io_request(struct vm_device *device,
struct hv_storvsc_request *request)
{
struct storvsc_device *stor_device;
@@ -804,7 +805,7 @@ int stor_vsc_initialize(struct hv_driver *driver)
/* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */
driver->name = g_driver_name;
- memcpy(&driver->dev_type, &gStorVscDeviceType,
+ memcpy(&driver->class_id, &gStorVscDeviceType,
sizeof(struct hv_guid));
stor_driver->request_ext_size =
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index fbf5755..8bed6f5 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -92,7 +92,7 @@ struct storvsc_driver_object {
u32 max_outstanding_req_per_channel;
/* Specific to this driver */
- int (*on_io_request)(struct hv_device *device,
+ int (*on_io_request)(struct vm_device *device,
struct hv_storvsc_request *request);
};
@@ -104,7 +104,7 @@ struct storvsc_device_info {
/* Interface */
int stor_vsc_initialize(struct hv_driver *driver);
-int stor_vsc_on_host_reset(struct hv_device *device);
+int stor_vsc_on_host_reset(struct vm_device *device);
int blk_vsc_initialize(struct hv_driver *driver);
#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index a8427ff..216d8ff 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -32,6 +32,7 @@
#include <scsi/scsi_devinfo.h>
#include <scsi/scsi_dbg.h>
#include "hv_api.h"
+#include "vmbus.h"
#include "logging.h"
#include "version_info.h"
#include "vmbus.h"
@@ -161,7 +162,7 @@ static int storvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
}
drv_ctx->driver.name = storvsc_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.dev_type,
+ memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.class_id,
sizeof(struct hv_guid));
drv_ctx->probe = storvsc_probe;
@@ -225,8 +226,7 @@ static int storvsc_probe(struct device *device)
(struct storvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
struct storvsc_device_info device_info;
@@ -247,10 +247,10 @@ static int storvsc_probe(struct device *device)
memset(host_device_ctx, 0, sizeof(struct host_device_context));
host_device_ctx->port = host->host_no;
- host_device_ctx->device_ctx = device_ctx;
+ host_device_ctx->device_ctx = device_obj;
host_device_ctx->request_pool =
- kmem_cache_create(dev_name(&device_ctx->device),
+ kmem_cache_create(dev_name(&device_obj->device),
sizeof(struct storvsc_cmd_request) +
storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
@@ -310,8 +310,7 @@ static int storvsc_remove(struct device *device)
(struct storvsc_driver_context *)driver_ctx;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
- struct vm_device *device_ctx = device_to_vm_device(device);
- struct hv_device *device_obj = &device_ctx->device_obj;
+ struct vm_device *device_obj = device_to_vm_device(device);
struct Scsi_Host *host = dev_get_drvdata(device);
struct host_device_context *host_device_ctx =
(struct host_device_context *)host->hostdata;
@@ -752,7 +751,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
retry_request:
/* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->on_io_request(&device_ctx->device_obj,
+ ret = storvsc_drv_obj->on_io_request(device_ctx,
&cmd_request->request);
if (ret == -1) {
/* no more space */
@@ -842,15 +841,15 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
struct vm_device *device_ctx = host_device_ctx->device_ctx;
DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
- scmnd->device, &device_ctx->device_obj);
+ scmnd->device, device_ctx);
/* Invokes the vsc to reset the host/bus */
- ret = stor_vsc_on_host_reset(&device_ctx->device_obj);
+ ret = stor_vsc_on_host_reset(device_ctx);
if (ret != 0)
return ret;
DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
- scmnd->device, &device_ctx->device_obj);
+ scmnd->device, device_ctx);
return ret;
}
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index 42f2adb..e56e61a 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -44,18 +44,17 @@ struct driver_context {
};
struct vm_device {
+ char name[64];
struct work_struct probe_failed_work_item;
- struct hv_guid class_id;
- struct hv_guid device_id;
+ struct hv_guid class_id; /* device type id */
+ struct hv_guid device_id; /* device instance id */
+ struct hv_driver *drv;
int probe_error;
- struct hv_device device_obj;
+ struct vmbus_channel *channel; /* associated channel to host*/
+ void *ext;
struct device device;
};
-static inline struct vm_device *to_vm_device(struct hv_device *d)
-{
- return container_of(d, struct vm_device, device_obj);
-}
static inline struct vm_device *device_to_vm_device(struct device *d)
{
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 635ce22..bf84fb0 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -56,7 +56,7 @@ struct hv_multipage_buffer {
#pragma pack(pop)
struct hv_driver;
-struct hv_device;
+struct vm_device;
struct hv_dev_port_info {
u32 int_mask;
@@ -66,7 +66,7 @@ struct hv_dev_port_info {
u32 bytes_avail_towrite;
};
-struct hv_device_info {
+struct vm_device_info {
u32 chn_id;
u32 chn_state;
struct hv_guid chn_type;
@@ -89,30 +89,11 @@ struct hv_driver {
const char *name;
/* the device type supported by this driver */
- struct hv_guid dev_type;
+ struct hv_guid class_id;
- int (*dev_add)(struct hv_device *device, void *data);
- int (*dev_rm)(struct hv_device *device);
+ int (*dev_add)(struct vm_device *device, void *data);
+ int (*dev_rm)(struct vm_device *device);
void (*cleanup)(struct hv_driver *driver);
};
-/* Base device object */
-struct hv_device {
- /* the driver for this device */
- struct hv_driver *drv;
-
- char name[64];
-
- /* the device type id of this device */
- struct hv_guid dev_type;
-
- /* the device instance id of this device */
- struct hv_guid dev_instance;
-
- struct vmbus_channel *channel;
-
- /* Device extension; */
- void *ext;
-};
-
#endif /* _VMBUS_API_H_ */
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 459c707..531b68d 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -145,12 +145,12 @@ static const struct hv_guid device_id = {
}
};
-static struct hv_device *vmbus_device; /* vmbus root device */
+static struct vm_device *vmbus_device; /* vmbus root device */
/*
* vmbus_child_dev_add - Registers the child device with the vmbus
*/
-int vmbus_child_dev_add(struct hv_device *child_dev)
+int vmbus_child_dev_add(struct vm_device *child_dev)
{
return vmbus_child_device_register(vmbus_device, child_dev);
}
@@ -158,15 +158,15 @@ int vmbus_child_dev_add(struct hv_device *child_dev)
/*
* vmbus_dev_add - Callback when the root bus device is added
*/
-static int vmbus_dev_add(struct hv_device *dev, void *info)
+static int vmbus_dev_add(struct vm_device *dev, void *info)
{
u32 *irqvector = info;
int ret;
vmbus_device = dev;
- memcpy(&vmbus_device->dev_type, &device_type, sizeof(struct hv_guid));
- memcpy(&vmbus_device->dev_instance, &device_id,
+ memcpy(&vmbus_device->class_id, &device_type, sizeof(struct hv_guid));
+ memcpy(&vmbus_device->device_id, &device_id,
sizeof(struct hv_guid));
/* strcpy(dev->name, "vmbus"); */
@@ -183,7 +183,7 @@ static int vmbus_dev_add(struct hv_device *dev, void *info)
/*
* vmbus_dev_rm - Callback when the root bus device is removed
*/
-static int vmbus_dev_rm(struct hv_device *dev)
+static int vmbus_dev_rm(struct vm_device *dev)
{
int ret = 0;
@@ -299,8 +299,8 @@ static int vmbus_on_isr(struct hv_driver *drv)
return ret;
}
-static void get_channel_info(struct hv_device *device,
- struct hv_device_info *info)
+static void get_channel_info(struct vm_device *device,
+ struct vm_device_info *info)
{
struct vmbus_channel_debug_info debug_info;
@@ -355,11 +355,11 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
char *buf)
{
struct vm_device *device_ctx = device_to_vm_device(dev);
- struct hv_device_info device_info;
+ struct vm_device_info device_info;
- memset(&device_info, 0, sizeof(struct hv_device_info));
+ memset(&device_info, 0, sizeof(struct vm_device_info));
- get_channel_info(&device_ctx->device_obj, &device_info);
+ get_channel_info(device_ctx, &device_info);
if (!strcmp(dev_attr->attr.name, "class_id")) {
return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
@@ -480,7 +480,7 @@ static int vmbus_bus_init(void)
sizeof(struct vmbus_channel_packet_multipage_buffer));
driver->name = driver_name;
- memcpy(&driver->dev_type, &device_type, sizeof(struct hv_guid));
+ memcpy(&driver->class_id, &device_type, sizeof(struct hv_guid));
/* Setup dispatch table */
driver->dev_add = vmbus_dev_add;
@@ -537,7 +537,7 @@ static int vmbus_bus_init(void)
/* Call to bus driver to add the root device */
memset(dev_ctx, 0, sizeof(struct vm_device));
- ret = driver->dev_add(&dev_ctx->device_obj, &vector);
+ ret = driver->dev_add(dev_ctx, &vector);
if (ret != 0) {
DPRINT_ERR(VMBUS_DRV,
"ERROR - Unable to add vmbus root device");
@@ -551,10 +551,6 @@ static int vmbus_bus_init(void)
}
/* strcpy(dev_ctx->device.bus_id, dev_ctx->device_obj.name); */
dev_set_name(&dev_ctx->device, "vmbus_0_0");
- memcpy(&dev_ctx->class_id, &dev_ctx->device_obj.dev_type,
- sizeof(struct hv_guid));
- memcpy(&dev_ctx->device_id, &dev_ctx->device_obj.dev_instance,
- sizeof(struct hv_guid));
/* No need to bind a driver to the root device. */
dev_ctx->device.parent = NULL;
@@ -598,7 +594,7 @@ static void vmbus_bus_exit(void)
/* Remove the root device */
if (driver->dev_rm)
- driver->dev_rm(&dev_ctx->device_obj);
+ driver->dev_rm(dev_ctx);
if (driver->cleanup)
driver->cleanup(driver);
@@ -671,12 +667,11 @@ EXPORT_SYMBOL(vmbus_child_driver_unregister);
* vmbus_child_device_create - Creates and registers a new child device
* on the vmbus.
*/
-struct hv_device *vmbus_child_device_create(struct hv_guid *type,
+struct vm_device *vmbus_child_device_create(struct hv_guid *type,
struct hv_guid *instance,
struct vmbus_channel *channel)
{
struct vm_device *child_device_ctx;
- struct hv_device *child_device_obj;
/* Allocate the new child device */
child_device_ctx = kzalloc(sizeof(struct vm_device), GFP_KERNEL);
@@ -705,58 +700,50 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type,
instance->data[12], instance->data[13],
instance->data[14], instance->data[15]);
- child_device_obj = &child_device_ctx->device_obj;
- child_device_obj->channel = channel;
- memcpy(&child_device_obj->dev_type, type, sizeof(struct hv_guid));
- memcpy(&child_device_obj->dev_instance, instance,
- sizeof(struct hv_guid));
+ child_device_ctx->channel = channel;
memcpy(&child_device_ctx->class_id, type, sizeof(struct hv_guid));
memcpy(&child_device_ctx->device_id, instance, sizeof(struct hv_guid));
- return child_device_obj;
+ return child_device_ctx;
}
/*
* vmbus_child_device_register - Register the child device on the specified bus
*/
-int vmbus_child_device_register(struct hv_device *root_device_obj,
- struct hv_device *child_device_obj)
+int vmbus_child_device_register(struct vm_device *root_device_obj,
+ struct vm_device *child_device_obj)
{
int ret = 0;
- struct vm_device *root_device_ctx =
- to_vm_device(root_device_obj);
- struct vm_device *child_device_ctx =
- to_vm_device(child_device_obj);
static atomic_t device_num = ATOMIC_INIT(0);
DPRINT_DBG(VMBUS_DRV, "child device (%p) registering",
- child_device_ctx);
+ child_device_obj);
/* Set the device name. Otherwise, device_register() will fail. */
- dev_set_name(&child_device_ctx->device, "vmbus_0_%d",
+ dev_set_name(&child_device_obj->device, "vmbus_0_%d",
atomic_inc_return(&device_num));
/* The new device belongs to this bus */
- child_device_ctx->device.bus = &vmbus_drv.bus; /* device->dev.bus; */
- child_device_ctx->device.parent = &root_device_ctx->device;
- child_device_ctx->device.release = vmbus_device_release;
+ child_device_obj->device.bus = &vmbus_drv.bus; /* device->dev.bus; */
+ child_device_obj->device.parent = &root_device_obj->device;
+ child_device_obj->device.release = vmbus_device_release;
/*
* Register with the LDM. This will kick off the driver/device
* binding...which will eventually call vmbus_match() and vmbus_probe()
*/
- ret = device_register(&child_device_ctx->device);
+ ret = device_register(&child_device_obj->device);
/* vmbus_probe() error does not get propergate to device_register(). */
- ret = child_device_ctx->probe_error;
+ ret = child_device_obj->probe_error;
if (ret)
DPRINT_ERR(VMBUS_DRV, "unable to register child device (%p)",
- &child_device_ctx->device);
+ &child_device_obj->device);
else
DPRINT_INFO(VMBUS_DRV, "child device (%p) registered",
- &child_device_ctx->device);
+ &child_device_obj->device);
return ret;
}
@@ -765,21 +752,20 @@ int vmbus_child_device_register(struct hv_device *root_device_obj,
* vmbus_child_device_unregister - Remove the specified child device
* from the vmbus.
*/
-void vmbus_child_device_unregister(struct hv_device *device_obj)
+void vmbus_child_device_unregister(struct vm_device *device_obj)
{
- struct vm_device *device_ctx = to_vm_device(device_obj);
DPRINT_INFO(VMBUS_DRV, "unregistering child device (%p)",
- &device_ctx->device);
+ &device_obj->device);
/*
* Kick off the process of unregistering the device.
* This will call vmbus_remove() and eventually vmbus_device_release()
*/
- device_unregister(&device_ctx->device);
+ device_unregister(&device_obj->device);
DPRINT_INFO(VMBUS_DRV, "child device (%p) unregistered",
- &device_ctx->device);
+ &device_obj->device);
}
/*
@@ -876,11 +862,11 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
struct vmbus_driver_context *vmbus_drv_ctx =
(struct vmbus_driver_context *)driver_ctx;
- device_ctx->device_obj.drv = &vmbus_drv_ctx->drv_obj;
+ device_ctx->drv = &vmbus_drv_ctx->drv_obj;
DPRINT_INFO(VMBUS_DRV,
"device object (%p) set to driver object (%p)",
- &device_ctx->device_obj,
- device_ctx->device_obj.drv);
+ &device_ctx,
+ device_ctx->drv);
match = 1;
}
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 9f505c4..206218c 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -103,18 +103,18 @@ extern struct vmbus_connection vmbus_connection;
/* General vmbus interface */
-struct hv_device *vmbus_child_device_create(struct hv_guid *type,
+struct vm_device *vmbus_child_device_create(struct hv_guid *type,
struct hv_guid *instance,
struct vmbus_channel *channel);
-int vmbus_child_dev_add(struct hv_device *device);
-int vmbus_child_device_register(struct hv_device *root_device_obj,
- struct hv_device *child_device_obj);
-void vmbus_child_device_unregister(struct hv_device *device_obj);
+int vmbus_child_dev_add(struct vm_device *device);
+int vmbus_child_device_register(struct vm_device *root_device_obj,
+ struct vm_device *child_device_obj);
+void vmbus_child_device_unregister(struct vm_device *device_obj);
/* static void */
/* VmbusChildDeviceDestroy( */
-/* struct hv_device *); */
+/* struct vm_device *); */
struct vmbus_channel *relid2channel(u32 relid);
--
1.5.5.6
^ permalink raw reply related
* Re: Can't build in the virtio console driver on x86_64 when the other virtio drivers are modular
From: Chuck Ebbert @ 2011-02-25 17:13 UTC (permalink / raw)
To: Amit Shah; +Cc: linux-kernel, virtualization
In-Reply-To: <20110225060815.GB15723@amit-x200.redhat.com>
On Fri, 25 Feb 2011 11:38:15 +0530
Amit Shah <amit.shah@redhat.com> wrote:
> On (Thu) 24 Feb 2011 [11:28:19], Chuck Ebbert wrote:
> > The virtio configuration options are inconsistent. According to this,
> > every options that needs virtio will select it:
> >
> > # Virtio always gets selected by whoever wants it.
> > config VIRTIO
> > tristate
> >
> > Note that it's not user-selectable, so any config file that tries to
> > set it will be ignored when kconfig loads those options. And yet we
> > have a whole set of options that depend on VIRTIO, like VIRTIO_CONSOLE
> > for example. This makes it impossible to have VIRTIO_PCI modular and
> > VIRTIO_CONSOLE built-in on x86_64, because:
>
> Any reason to have VIRTIO_PCI modular instead of built in (on x86-64,
> virtio-console won't work without virtio-pci anyway)?
>
None that I know of offhand, other than not building in things unless
absolutely necessary. There's no dependency of any kind there, so it's
even possible to build a kernel with VIRTIO_CONSOLE enabled and
VIRTIO_PCI completely disabled.
^ permalink raw reply
* Re: Bug inkvm_set_irq
From: Gleb Natapov @ 2011-02-25 10:36 UTC (permalink / raw)
To: Jean-Philippe Menil; +Cc: netdev, mst, kvm, virtualization
In-Reply-To: <4D67714A.2050100@univ-nantes.fr>
CCing Michael in case he missed this.
On Fri, Feb 25, 2011 at 10:07:22AM +0100, Jean-Philippe Menil wrote:
> Hi,
>
> Each time i try tou use vhost_net, i'm facing a kernel bug.
> I do a "modprobe vhost_net", and start guest whith vhost=on.
>
> Following is a trace with a kernel 2.6.37, but i had the same
> problem with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
>
> The bug only occurs whith vhost_net charged, so i don't know if this
> is a bug in kvm module code or in the vhost_net code.
>
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243100] BUG: unable to handle kernel paging request at
> 0000000000002458
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243250] IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243378] PGD 45d363067 PUD 45e77a067 PMD 0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243556] Oops: 0000 [#1] SMP
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243692] last sysfs file:
> /sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.243820] Modules linked in: vhost_net macvtap macvlan tun
> powernow_k8 mperf cpufreq_userspace cpufreq_stats cpufreq_powersave
> cpufreq_ondemand fre
> q_table cpufreq_conservative fuse xt_physdev ip6t_LOG
> ip6table_filter ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp
> xt_state iptable_filter ip_tables x_tables nf_conntrack_tftp
> nf_conntrack_ftp nf_connt
> rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache
> dm_round_robin dm_multipath nf_conntrack_ipv6 nf_conntrack
> nf_defrag_ipv6 kvm_amd kvm ipv6 snd_pcm snd_timer snd soundcore
> snd_page_alloc tpm_tis tpm ps
> mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes
> serio_raw joydev evdev pci_hotplug i2c_core hed button thermal_sys
> xfs exportfs dm_mod sg sr_mod cdrom usbhid hid usb_storage ses
> sd_mod enclosu
> re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2
> scsi_mod ehci_hcd [last unloaded: scsi_wait_scan]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Pid: 10, comm: kworker/0:1 Not tainted
> 2.6.37-dsiun-110105 #17 0K543T/PowerEdge M605
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
> kvm_set_irq+0x2a/0x130 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RAX: 0000000000000000 RBX: 000000000000001a RCX:
> 0000000000000001
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RBP: 0000000000000000 R08: 0000000000000001 R09:
> ffff880856a91e48
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] R10: 0000000000000000 R11: 00000000ffffffff R12:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] R13: 0000000000000001 R14: 0000000000000000 R15:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] FS: 00007f617986c710(0000) GS:ffff88007f800000(0000)
> knlGS:0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CR2: 0000000000002458 CR3: 000000045d197000 CR4:
> 00000000000006f0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
> 0000000000000000
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
> 0000000000000400
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Process kworker/0:1 (pid: 10, threadinfo
> ffff88045fc88000, task ffff88085fc53c30)
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] ffff88045fc89fd8 00000000000119c0 ffff88045fc88010
> ffff88085fc53ee8
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30
> 00000000000119c0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] 00000000000119c0 ffffffff8137f7ce ffff88007f80df40
> 00000000ffffffff
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Call Trace:
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106be25>] ? worker_thread+0x145/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106bce0>] ? worker_thread+0x0/0x410
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106f786>] ? kthread+0x96/0xa0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff8106f6f0>] ? kthread+0x0/0xa0
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] [<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89
> fc 55 53 89 d3 48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4
> 00 00 00 <4
> 9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] RSP <ffff88045fc89d30>
> Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [
> 685.246123] CR2: 0000000000002458
>
>
> If someone can help me, on how to solve this.
>
> Regards.
> begin:vcard
> fn:Jean-Philippe Menil
> n:Menil;Jean-Philippe
> org;quoted-printable:Universit=C3=A9 de Nantes;IRTS
> adr;dom:;;;Nantes
> email;internet:jean-philippe.menil@univ-nantes.fr
> title:Reseau
> tel;work:02.53.48.49.27
> tel;fax:02.53.48.49.97
> x-mozilla-html:FALSE
> version:2.1
> end:vcard
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
--
Gleb.
^ permalink raw reply
* Bug inkvm_set_irq
From: Jean-Philippe Menil @ 2011-02-25 9:07 UTC (permalink / raw)
To: kvm; +Cc: netdev, virtualization
[-- Attachment #1: Type: text/plain, Size: 6833 bytes --]
Hi,
Each time i try tou use vhost_net, i'm facing a kernel bug.
I do a "modprobe vhost_net", and start guest whith vhost=on.
Following is a trace with a kernel 2.6.37, but i had the same problem
with 2.6.36 (cf https://lkml.org/lkml/2010/11/30/29).
The bug only occurs whith vhost_net charged, so i don't know if this is
a bug in kvm module code or in the vhost_net code.
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243100]
BUG: unable to handle kernel paging request at 0000000000002458
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243250]
IP: [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243378]
PGD 45d363067 PUD 45e77a067 PMD 0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243556]
Oops: 0000 [#1] SMP
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243692]
last sysfs file:
/sys/devices/pci0000:00/0000:00:0d.0/0000:05:00.0/0000:06:00.0/irq
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243777] CPU 0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.243820]
Modules linked in: vhost_net macvtap macvlan tun powernow_k8 mperf
cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand fre
q_table cpufreq_conservative fuse xt_physdev ip6t_LOG ip6table_filter
ip6_tables ipt_LOG xt_multiport xt_limit xt_tcpudp xt_state
iptable_filter ip_tables x_tables nf_conntrack_tftp nf_conntrack_ftp
nf_connt
rack_ipv4 nf_defrag_ipv4 8021q bridge stp ext2 mbcache dm_round_robin
dm_multipath nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 kvm_amd kvm
ipv6 snd_pcm snd_timer snd soundcore snd_page_alloc tpm_tis tpm ps
mouse dcdbas tpm_bios processor i2c_nforce2 shpchp pcspkr ghes serio_raw
joydev evdev pci_hotplug i2c_core hed button thermal_sys xfs exportfs
dm_mod sg sr_mod cdrom usbhid hid usb_storage ses sd_mod enclosu
re megaraid_sas ohci_hcd lpfc scsi_transport_fc scsi_tgt bnx2 scsi_mod
ehci_hcd [last unloaded: scsi_wait_scan]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
Pid: 10, comm: kworker/0:1 Not tainted 2.6.37-dsiun-110105 #17
0K543T/PowerEdge M605
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RIP: 0010:[<ffffffffa041aa8a>] [<ffffffffa041aa8a>]
kvm_set_irq+0x2a/0x130 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RSP: 0018:ffff88045fc89d30 EFLAGS: 00010246
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RAX: 0000000000000000 RBX: 000000000000001a RCX: 0000000000000001
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RBP: 0000000000000000 R08: 0000000000000001 R09: ffff880856a91e48
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
R10: 0000000000000000 R11: 00000000ffffffff R12: 0000000000000000
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
FS: 00007f617986c710(0000) GS:ffff88007f800000(0000) knlGS:0000000000000000
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
CR2: 0000000000002458 CR3: 000000045d197000 CR4: 00000000000006f0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
Process kworker/0:1 (pid: 10, threadinfo ffff88045fc88000, task
ffff88085fc53c30)
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123] Stack:
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
ffff88045fc89fd8 00000000000119c0 ffff88045fc88010 ffff88085fc53ee8
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
ffff88045fc89fd8 ffff88085fc53ee0 ffff88085fc53c30 00000000000119c0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
00000000000119c0 ffffffff8137f7ce ffff88007f80df40 00000000ffffffff
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
Call Trace:
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8137f7ce>] ? common_interrupt+0xe/0x13
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffffa041bc57>] ? irqfd_inject+0x27/0x50 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffffa041bc30>] ? irqfd_inject+0x0/0x50 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106b6f2>] ? process_one_work+0x112/0x460
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106be25>] ? worker_thread+0x145/0x410
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8103a3d0>] ? __wake_up_common+0x50/0x80
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106bce0>] ? worker_thread+0x0/0x410
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106bce0>] ? worker_thread+0x0/0x410
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106f786>] ? kthread+0x96/0xa0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff81003ce4>] ? kernel_thread_helper+0x4/0x10
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff8106f6f0>] ? kthread+0x0/0xa0
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
[<ffffffff81003ce0>] ? kernel_thread_helper+0x0/0x10
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
Code: ff 41 57 41 89 f7 41 56 41 55 41 89 cd 41 54 49 89 fc 55 53 89 d3
48 81 ec 98 00 00 00 8b 15 c6 79 03 00 85 d2 0f 85 c4 00 00 00 <4
9> 8b 84 24 58 24 00 00 3b 98 28 01 00 00 73 5e 89 db 48 8b 84
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RIP [<ffffffffa041aa8a>] kvm_set_irq+0x2a/0x130 [kvm]
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
RSP <ffff88045fc89d30>
Feb 23 13:56:19 ayrshire.u06.univ-nantes.prive kernel: [ 685.246123]
CR2: 0000000000002458
If someone can help me, on how to solve this.
Regards.
[-- Attachment #2: jean-philippe_menil.vcf --]
[-- Type: text/x-vcard, Size: 281 bytes --]
begin:vcard
fn:Jean-Philippe Menil
n:Menil;Jean-Philippe
org;quoted-printable:Universit=C3=A9 de Nantes;IRTS
adr;dom:;;;Nantes
email;internet:jean-philippe.menil@univ-nantes.fr
title:Reseau
tel;work:02.53.48.49.27
tel;fax:02.53.48.49.97
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 184 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: Can't build in the virtio console driver on x86_64 when the other virtio drivers are modular
From: Amit Shah @ 2011-02-25 6:08 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: linux-kernel, virtualization
In-Reply-To: <20110224112819.10f59f68@katamari>
On (Thu) 24 Feb 2011 [11:28:19], Chuck Ebbert wrote:
> The virtio configuration options are inconsistent. According to this,
> every options that needs virtio will select it:
>
> # Virtio always gets selected by whoever wants it.
> config VIRTIO
> tristate
>
> Note that it's not user-selectable, so any config file that tries to
> set it will be ignored when kconfig loads those options. And yet we
> have a whole set of options that depend on VIRTIO, like VIRTIO_CONSOLE
> for example. This makes it impossible to have VIRTIO_PCI modular and
> VIRTIO_CONSOLE built-in on x86_64, because:
Any reason to have VIRTIO_PCI modular instead of built in (on x86-64,
virtio-console won't work without virtio-pci anyway)?
Amit
^ permalink raw reply
* RE: [PATCH ] Staging: hv: Hyper-V driver cleanup
From: KY Srinivasan @ 2011-02-25 1:07 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Hank Janssen
In-Reply-To: <20110225003136.GA27272@suse.de>
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Thursday, February 24, 2011 7:32 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; Haiyang Zhang; Hank Janssen
> Subject: Re: [PATCH ] Staging: hv: Hyper-V driver cleanup
>
> On Fri, Feb 25, 2011 at 12:24:57AM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:gregkh@suse.de]
> > > Sent: Thursday, February 24, 2011 6:46 PM
> > > To: KY Srinivasan
> > > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > > virtualization@lists.osdl.org; Haiyang Zhang; Hank Janssen
> > > Subject: Re: [PATCH ] Staging: hv: Hyper-V driver cleanup
> > >
> > > On Thu, Feb 24, 2011 at 03:20:58PM -0800, K. Y. Srinivasan wrote:
> > > > This patch cleans up (a lot of the) naming issues that
> > > > various reviewers have noted. It also gets rid of
> > > > some unnecessary layering in the code.
> > >
> > > Whenever you have a patch description that says "It also..." you know
> > > you need to break this up into smaller, logical pieces.
> >
> > The name change was related to the layering issue. For instance I combined the
> > Vm_device and hv_device abstractions to build the hyperv_device abstraction.
> > Likewise, I combined the driver_context and the hv_driver abstractions to build
> the
> > the hyperv_driver abstraction. Would breaking this patch up into two patches,
> > one dealing with the device abstraction consolidation and the other dealing
> with
> > the consolidation of driver abstractions satisfy your concern. Even if I partition
> this
> > patch along these lines, it will still be a large set of patches; since these changes
> > are pervasive.
>
> pervasive patches are fine, just remember, "each patch can only do one
> thing". It sounds like you want to do at least 2 patches here, if not
> a lot more. Look at my past patches when I combined things and removed
> a whole layer for how to do this in a very incremental, piece-by-piece
> fashion (i.e, move one field over at a time until the structure is gone,
> and then remove it entirely.)
If it is ok with you, I will do two patches - one for dealing with consolidating device structure
and the other for consolidating the driver abstractions.
>
> > > There is no 2.6.38 kernel yet, so I find this very hard to believe :)
> >
> > My mistake; I did not specify the full output of uname -a on the box
> > that I tested this code. This box is running the LINUX-NEXT kernel :
> > 2.6.38-rc1-0.2-default.
>
> linux-next should be farther along than -rc1 as -rc6 is currently out.
While the hv code is from the tip of the tree; the kernel I am running is a little dated.
Regards,
K. Y
>
> confused,
>
> greg k-h
^ permalink raw reply
* Re: [PATCH ] Staging: hv: Hyper-V driver cleanup
From: Greg KH @ 2011-02-25 0:31 UTC (permalink / raw)
To: KY Srinivasan
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Hank Janssen
In-Reply-To: <6E21E5352C11B742B20C142EB499E04801522A@TK5EX14MBXC128.redmond.corp.microsoft.com>
On Fri, Feb 25, 2011 at 12:24:57AM +0000, KY Srinivasan wrote:
>
>
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@suse.de]
> > Sent: Thursday, February 24, 2011 6:46 PM
> > To: KY Srinivasan
> > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > virtualization@lists.osdl.org; Haiyang Zhang; Hank Janssen
> > Subject: Re: [PATCH ] Staging: hv: Hyper-V driver cleanup
> >
> > On Thu, Feb 24, 2011 at 03:20:58PM -0800, K. Y. Srinivasan wrote:
> > > This patch cleans up (a lot of the) naming issues that
> > > various reviewers have noted. It also gets rid of
> > > some unnecessary layering in the code.
> >
> > Whenever you have a patch description that says "It also..." you know
> > you need to break this up into smaller, logical pieces.
>
> The name change was related to the layering issue. For instance I combined the
> Vm_device and hv_device abstractions to build the hyperv_device abstraction.
> Likewise, I combined the driver_context and the hv_driver abstractions to build the
> the hyperv_driver abstraction. Would breaking this patch up into two patches,
> one dealing with the device abstraction consolidation and the other dealing with
> the consolidation of driver abstractions satisfy your concern. Even if I partition this
> patch along these lines, it will still be a large set of patches; since these changes
> are pervasive.
pervasive patches are fine, just remember, "each patch can only do one
thing". It sounds like you want to do at least 2 patches here, if not
a lot more. Look at my past patches when I combined things and removed
a whole layer for how to do this in a very incremental, piece-by-piece
fashion (i.e, move one field over at a time until the structure is gone,
and then remove it entirely.)
> > There is no 2.6.38 kernel yet, so I find this very hard to believe :)
>
> My mistake; I did not specify the full output of uname -a on the box
> that I tested this code. This box is running the LINUX-NEXT kernel :
> 2.6.38-rc1-0.2-default.
linux-next should be farther along than -rc1 as -rc6 is currently out.
confused,
greg k-h
^ permalink raw reply
* RE: [PATCH ] Staging: hv: Hyper-V driver cleanup
From: KY Srinivasan @ 2011-02-25 0:24 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Hank Janssen
In-Reply-To: <20110224234541.GA23711@suse.de>
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Thursday, February 24, 2011 6:46 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; Haiyang Zhang; Hank Janssen
> Subject: Re: [PATCH ] Staging: hv: Hyper-V driver cleanup
>
> On Thu, Feb 24, 2011 at 03:20:58PM -0800, K. Y. Srinivasan wrote:
> > This patch cleans up (a lot of the) naming issues that
> > various reviewers have noted. It also gets rid of
> > some unnecessary layering in the code.
>
> Whenever you have a patch description that says "It also..." you know
> you need to break this up into smaller, logical pieces.
The name change was related to the layering issue. For instance I combined the
Vm_device and hv_device abstractions to build the hyperv_device abstraction.
Likewise, I combined the driver_context and the hv_driver abstractions to build the
the hyperv_driver abstraction. Would breaking this patch up into two patches,
one dealing with the device abstraction consolidation and the other dealing with
the consolidation of driver abstractions satisfy your concern. Even if I partition this
patch along these lines, it will still be a large set of patches; since these changes
are pervasive.
>
> As it is, I can not take this patch.
>
> Please break it up into logical patches, each doing only one thing, so
> we can properly review it.
>
> > At the lowest
> > level, we have one abstraction for representing
> > a hyperv device (struct hyperv_device) and one
> > abstraction for representing a hyperv driver
> > (struct hyperv_driver). This collapses an unnecessary
> > layering that existed in the code for historical reasons.
> > While the patch is large, it was generated by a very
> > mechanical process (global search and replace). The code
> > compiles cleanly and I have tested this code on a 2.6.38
> > kernel.
>
> There is no 2.6.38 kernel yet, so I find this very hard to believe :)
My mistake; I did not specify the full output of uname -a on the box
that I tested this code. This box is running the LINUX-NEXT kernel :
2.6.38-rc1-0.2-default.
Regards,
K. Y
>
> thanks,
>
> greg k-h
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox