<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/hv/hv.c, branch linux-4.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-12-15T03:15:05Z</updated>
<entry>
<title>drivers/hv: correct tsc page sequence invalid value</title>
<updated>2015-12-15T03:15:05Z</updated>
<author>
<name>Andrey Smetanin</name>
</author>
<published>2015-12-15T00:01:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c35b82ef0294ae5052120615f5cfcef17c5a6bf7'/>
<id>urn:sha1:c35b82ef0294ae5052120615f5cfcef17c5a6bf7</id>
<content type='text'>
Hypervisor Top Level Functional Specification v3/4 says
that TSC page sequence value = -1(0xFFFFFFFF) is used to
indicate that TSC page no longer reliable source of reference
timer. Unfortunately, we found that Windows Hyper-V guest
side implementation uses sequence value = 0 to indicate
that Tsc page no longer valid. This is clearly visible
inside Windows 2012R2 ntoskrnl.exe HvlGetReferenceTime()
function dissassembly:

HvlGetReferenceTime proc near
                 xchg    ax, ax
loc_1401C3132:
                 mov     rax, cs:HvlpReferenceTscPage
                 mov     r9d, [rax]
                 test    r9d, r9d
                 jz      short loc_1401C3176
                 rdtsc
                 mov     rcx, cs:HvlpReferenceTscPage
                 shl     rdx, 20h
                 or      rdx, rax
                 mov     rax, [rcx+8]
                 mov     rcx, cs:HvlpReferenceTscPage
                 mov     r8, [rcx+10h]
                 mul     rdx
                 mov     rax, cs:HvlpReferenceTscPage
                 add     rdx, r8
                 mov     ecx, [rax]
                 cmp     ecx, r9d
                 jnz     short loc_1401C3132
                 jmp     short loc_1401C3184
loc_1401C3176:
                 mov     ecx, 40000020h
                 rdmsr
                 shl     rdx, 20h
                 or      rdx, rax
loc_1401C3184:
                 mov     rax, rdx
                 retn
HvlGetReferenceTime endp

This patch aligns Tsc page invalid sequence value with
Windows Hyper-V guest implementation which is more
compatible with both Hyper-V hypervisor and KVM hypervisor.

Signed-off-by: Andrey Smetanin &lt;asmetanin@virtuozzo.com&gt;
Signed-off-by: Denis V. Lunev &lt;den@openvz.org&gt;
CC: "K. Y. Srinivasan" &lt;kys@microsoft.com&gt;
CC: Haiyang Zhang &lt;haiyangz@microsoft.com&gt;
CC: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;

Signed-off-by: Denis V. Lunev &lt;den@openvz.org&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers:hv: Export the API to invoke a hypercall on Hyper-V</title>
<updated>2015-12-15T03:12:21Z</updated>
<author>
<name>Jake Oshins</name>
</author>
<published>2015-12-15T00:01:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a108393dbf764efb2405f21ca759806c65b8bc16'/>
<id>urn:sha1:a108393dbf764efb2405f21ca759806c65b8bc16</id>
<content type='text'>
This patch exposes the function that hv_vmbus.ko uses to make hypercalls.  This
is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible outside
the hv.c file.

Signed-off-by: Jake Oshins &lt;jakeo@microsoft.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: vmbus: fix build warning</title>
<updated>2015-12-14T21:34:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
</author>
<published>2015-12-11T08:53:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9220e39b5c900c67ddcb517d52fe52d90fb5e3c8'/>
<id>urn:sha1:9220e39b5c900c67ddcb517d52fe52d90fb5e3c8</id>
<content type='text'>
We were getting build warning about unused variable "tsc_msr" and
"va_tsc" while building for i386 allmodconfig.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: vmbus: Implement a clocksource based on the TSC page</title>
<updated>2015-08-05T18:44:29Z</updated>
<author>
<name>K. Y. Srinivasan</name>
</author>
<published>2015-08-05T07:52:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ca9357bd26c2f8e7b909321eedd651f52cc30d04'/>
<id>urn:sha1:ca9357bd26c2f8e7b909321eedd651f52cc30d04</id>
<content type='text'>
The current Hyper-V clock source is based on the per-partition reference counter
and this counter is being accessed via s synthetic MSR - HV_X64_MSR_TIME_REF_COUNT.
Hyper-V has a more efficient way of computing the per-partition reference
counter value that does not involve reading a synthetic MSR. We implement
a time source based on this mechanism.

Tested-by: Vivek Yadav &lt;vyadav@microsoft.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers/hv: Migrate to new 'set-state' interface</title>
<updated>2015-08-05T18:44:29Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2015-08-05T07:52:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bc609cb47fb2e74654e23cef0a1d4db38b6570a3'/>
<id>urn:sha1:bc609cb47fb2e74654e23cef0a1d4db38b6570a3</id>
<content type='text'>
Migrate hv driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Cc: "K. Y. Srinivasan" &lt;kys@microsoft.com&gt;
Cc: Haiyang Zhang &lt;haiyangz@microsoft.com&gt;
Cc: devel@linuxdriverproject.org
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: vmbus: Improve the CPU affiliation for channels</title>
<updated>2015-08-05T18:41:31Z</updated>
<author>
<name>K. Y. Srinivasan</name>
</author>
<published>2015-08-05T07:52:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9f01ec53458d9e9b68f1c555e773b5d1a1f66e94'/>
<id>urn:sha1:9f01ec53458d9e9b68f1c555e773b5d1a1f66e94</id>
<content type='text'>
The current code tracks the assigned CPUs within a NUMA node in the context of
the primary channel. So, if we have a VM with a single NUMA node with 8 VCPUs, we may
end up unevenly distributing the channel load. Fix the issue by tracking affiliations
globally.

Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: don't do hypercalls when hypercall_page is NULL</title>
<updated>2015-08-05T05:25:29Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
</author>
<published>2015-08-01T23:08:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7646eaa7678fe5adc42247b4bdfbe9d9db8c253'/>
<id>urn:sha1:d7646eaa7678fe5adc42247b4bdfbe9d9db8c253</id>
<content type='text'>
At the very late stage of kexec a driver (which are not being unloaded) can
try to post a message or signal an event. This will crash the kernel as we
already did hv_cleanup() and the hypercall page is NULL.

Move all common (between 32 and 64 bit code) declarations to the beginning
of the do_hypercall() function. Unfortunately we have to write the
!hypercall_page check twice to not mix declarations and code.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: vmbus: remove hv_synic_free_cpu() call from hv_synic_cleanup()</title>
<updated>2015-08-05T05:25:28Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
</author>
<published>2015-08-01T23:08:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=06210b42f33ea1c29a90f4db2d88be91c511154b'/>
<id>urn:sha1:06210b42f33ea1c29a90f4db2d88be91c511154b</id>
<content type='text'>
We already have hv_synic_free() which frees all per-cpu pages for all
CPUs, let's remove the hv_synic_free_cpu() call from hv_synic_cleanup()
so it will be possible to do separate cleanup (writing to MSRs) and final
freeing. This is going to be used to assist kexec.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: vmbus: Teardown clockevent devices on module unload</title>
<updated>2015-03-02T03:30:07Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
</author>
<published>2015-02-27T19:25:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e086748c655ab99bac91b87d1bb59d9cc45867b9'/>
<id>urn:sha1:e086748c655ab99bac91b87d1bb59d9cc45867b9</id>
<content type='text'>
Newly introduced clockevent devices made it impossible to unload hv_vmbus
module as clockevents_config_and_register() takes additional reverence to
the module. To make it possible again we do the following:
- avoid setting dev-&gt;owner for clockevent devices;
- implement hv_synic_clockevents_cleanup() doing clockevents_unbind_device();
- call it from vmbus_exit().

In theory hv_synic_clockevents_cleanup() can be merged with hv_synic_cleanup(),
however, we call hv_synic_cleanup() from smp_call_function_single() and this
doesn't work for clockevents_unbind_device() as it does such call on its own. I
opted for a separate function.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers: hv: vmbus: Teardown synthetic interrupt controllers on module unload</title>
<updated>2015-03-02T03:29:05Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
</author>
<published>2015-02-27T19:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e72e7ac583ee8adddbc668cdefde7d7d3021be79'/>
<id>urn:sha1:e72e7ac583ee8adddbc668cdefde7d7d3021be79</id>
<content type='text'>
SynIC has to be switched off when we unload the module, otherwise registered
memory pages can get corrupted after (as Hyper-V host still writes there) and
we see the following crashes for random processes:

[   89.116774] BUG: Bad page map in process sh  pte:4989c716 pmd:36f81067
[   89.159454] addr:0000000000437000 vm_flags:00000875 anon_vma:          (null) mapping:ffff88007bba55a0 index:37
[   89.226146] vma-&gt;vm_ops-&gt;fault: filemap_fault+0x0/0x410
[   89.257776] vma-&gt;vm_file-&gt;f_op-&gt;mmap: generic_file_mmap+0x0/0x60
[   89.297570] CPU: 0 PID: 215 Comm: sh Tainted: G    B          3.19.0-rc5_bug923184+ #488
[   89.353738] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006  05/23/2012
[   89.409138]  0000000000000000 000000004e083d7b ffff880036e9fa18 ffffffff81a68d31
[   89.468724]  0000000000000000 0000000000437000 ffff880036e9fa68 ffffffff811a1e3a
[   89.519233]  000000004989c716 0000000000000037 ffffea0001edc340 0000000000437000
[   89.575751] Call Trace:
[   89.591060]  [&lt;ffffffff81a68d31&gt;] dump_stack+0x45/0x57
[   89.625164]  [&lt;ffffffff811a1e3a&gt;] print_bad_pte+0x1aa/0x250
[   89.667234]  [&lt;ffffffff811a2c95&gt;] vm_normal_page+0x55/0xa0
[   89.703818]  [&lt;ffffffff811a3105&gt;] unmap_page_range+0x425/0x8a0
[   89.737982]  [&lt;ffffffff811a3601&gt;] unmap_single_vma+0x81/0xf0
[   89.780385]  [&lt;ffffffff81184320&gt;] ? lru_deactivate_fn+0x190/0x190
[   89.820130]  [&lt;ffffffff811a4131&gt;] unmap_vmas+0x51/0xa0
[   89.860168]  [&lt;ffffffff811ad12c&gt;] exit_mmap+0xac/0x1a0
[   89.890588]  [&lt;ffffffff810763c3&gt;] mmput+0x63/0x100
[   89.919205]  [&lt;ffffffff811eba48&gt;] flush_old_exec+0x3f8/0x8b0
[   89.962135]  [&lt;ffffffff8123b5bb&gt;] load_elf_binary+0x32b/0x1260
[   89.998581]  [&lt;ffffffff811a14f2&gt;] ? get_user_pages+0x52/0x60

hv_synic_cleanup() function exists but noone calls it now. Do the following:
- call hv_synic_cleanup() on each cpu from vmbus_exit();
- write global disable bit through MSR;
- use hv_synic_free_cpu() to avoid memory leask and code duplication.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
