Re: [PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor

2020-12-15 Thread Wei Liu
On Tue, Dec 15, 2020 at 04:25:03PM +0100, Enrico Weigelt, metux IT consult wrote: > On 03.12.20 00:22, Wei Liu wrote: > > Hi, > > > I don't follow. Do you mean reusing /dev/kvm but with a different set of > > APIs underneath? I don't think that will work. &g

[GIT PULL] Hyper-V commits for 5.11

2020-12-14 Thread Wei Liu
Hi Linus Please pull the following changes since commit 09162bc32c880a791c6c0668ce0745cf7958f576: Linux 5.10-rc4 (2020-11-15 16:44:31 -0800) are available in the Git repository at: ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git tags/hyperv-next-signed-20201214 f

Re: [PATCH 0/2] hv_balloon: hide ballooned out memory in stats

2020-12-13 Thread Wei Liu
On Wed, Dec 09, 2020 at 01:17:18PM +, Wei Liu wrote: > On Wed, Dec 02, 2020 at 05:12:43PM +0100, Vitaly Kuznetsov wrote: > > It was noticed that 'free' information on a Hyper-V guest reports ballooned > > out memory in 'total' and this contradicts what

Re: [PATCH] Revert "scsi: storvsc: Validate length of incoming packet in storvsc_on_channel_callback()"

2020-12-11 Thread Wei Liu
On Fri, Dec 11, 2020 at 09:59:34AM -0500, Martin K. Petersen wrote: > > Wei, > > > Sorry for the last minute patch. We would very like this goes into > > 5.10 if possible; otherwise Linux 5.10 is going to be broken on > > Hyper-V. :-( > > Applied to 5.10/scsi-fixes. Thanks Martin.

Re: [PATCH] Revert "scsi: storvsc: Validate length of incoming packet in storvsc_on_channel_callback()"

2020-12-11 Thread Wei Liu
On Fri, Dec 11, 2020 at 02:14:04PM +0100, Andrea Parri (Microsoft) wrote: > This reverts commit 3b8c72d076c42bf27284cda7b2b2b522810686f8. > > Dexuan reported a regression where StorVSC fails to probe a device (and > where, consequently, the VM may fail to boot). The root-cause analysis > led to a

Re: [PATCH 1/1] scsi: Fix possible buffer overflows in storvsc_queuecommand

2020-12-09 Thread Wei Liu
On Wed, Dec 09, 2020 at 09:25:23AM +0800, Xiaohui Zhang wrote: > > > > At 2020-12-09 01:52:42, "Michael Kelley" wrote: > >From: Xiaohui Zhang Sent: Tuesday, December 8, > >2020 5:19 AM > >> > >> From: Zhang Xiaohui > >> > >> storvsc_queuecommand() calls memcpy() without checking > >> the

Re: [PATCH 0/2] hv_balloon: hide ballooned out memory in stats

2020-12-09 Thread Wei Liu
On Wed, Dec 02, 2020 at 05:12:43PM +0100, Vitaly Kuznetsov wrote: > It was noticed that 'free' information on a Hyper-V guest reports ballooned > out memory in 'total' and this contradicts what other ballooning drivers > (e.g. virtio-balloon/virtio-mem/xen balloon) do. > > Vitaly Kuznetsov (2): >

Re: [PATCH] drivers/hv: remove obsolete TODO and fix misleading typo in comment

2020-12-07 Thread Wei Liu
On Sun, Dec 06, 2020 at 11:48:50AM +0100, Stefan Eschenbacher wrote: > Removes an obsolete TODO in the VMBus module and fixes a misleading typo > in the comment for the macro MAX_NUM_CHANNELS, where two digits have been > twisted. > > Signed-off-by: Stefan Eschenbacher > Co-developed-by: Max Stol

Re: [PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor

2020-12-02 Thread Wei Liu
On Wed, Dec 02, 2020 at 08:51:38PM +0100, Enrico Weigelt, metux IT consult wrote: > On 24.11.20 18:07, Wei Liu wrote: > > Hi, > > > There will be a subsequent patch series to provide a > > device node (/dev/mshv) such that userspace programs can create and run

Re: [PATCH v3 16/17] x86/ioapic: export a few functions and data structures via io_apic.h

2020-12-02 Thread Wei Liu
On Wed, Nov 25, 2020 at 12:26:12PM +0200, Andy Shevchenko wrote: > On Wed, Nov 25, 2020 at 1:46 AM Wei Liu wrote: > > > > We are about to implement an irqchip for IO-APIC when Linux runs as root > > on Microsoft Hypervisor. At the same time we would like to reuse > &g

Re: [PATCH v2 2/7] Drivers: hv: vmbus: Avoid double fetch of msgtype in vmbus_on_msg_dpc()

2020-12-02 Thread Wei Liu
On Wed, Dec 02, 2020 at 02:37:16PM +0100, Andrea Parri wrote: > > > @@ -1072,12 +1073,19 @@ void vmbus_on_msg_dpc(unsigned long data) > > > /* no msg */ > > > return; > > > > > > + /* > > > + * The hv_message object is in memory shared with the host. The host > > > + * coul

Re: [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry

2020-12-02 Thread Wei Liu
On Tue, Nov 24, 2020 at 06:05:27PM +, David Woodhouse wrote: > On Tue, 2020-11-24 at 17:07 +0000, Wei Liu wrote: > > We will soon use the same structure to handle IO-APIC interrupts as > > well. Introduce an enum to identify the source and a data structure for > > IO-API

Re: [PATCH v2 2/7] Drivers: hv: vmbus: Avoid double fetch of msgtype in vmbus_on_msg_dpc()

2020-12-02 Thread Wei Liu
On Wed, Dec 02, 2020 at 10:22:09AM +0100, Andrea Parri (Microsoft) wrote: > vmbus_on_msg_dpc() double fetches from msgtype. The double fetch can > lead to an out-of-bound access when accessing the channel_message_table > array. In turn, the use of the out-of-bound entry could lead to code > execu

Re: [PATCH v3 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING

2020-12-02 Thread Wei Liu
On Sun, Nov 29, 2020 at 09:43:28PM -0800, Stephen Hemminger wrote: > On Sun, 29 Nov 2020 08:51:47 -0800 > "Michael Kelley" wrote: > > > From: Matheus Castello Sent: Tuesday, November > > 24, 2020 7:29 PM > > > > > > Checkpatch emits WARNING: quoted string split across lines. > > > To keep the c

Re: [PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-25 Thread si-wei liu
On 11/25/2020 1:30 AM, Michael S. Tsirkin wrote: On Thu, Nov 05, 2020 at 06:26:33PM -0500, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping

[PATCH v3 07/17] x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary

2020-11-24 Thread Wei Liu
We will need the partition ID for executing some hypercalls later. Signed-off-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- v3: 1. Make hv_get_partition_id static. 2. Change code structure a bit. --- arch/x86/hyperv/hv_init.c | 27

[PATCH v3 10/17] x86/hyperv: implement and use hv_smp_prepare_cpus

2020-11-24 Thread Wei Liu
Microsoft Hypervisor requires the root partition to make a few hypercalls to setup application processors before they can be used. Signed-off-by: Lillian Grassin-Drake Signed-off-by: Sunil Muthuswamy Co-Developed-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei

[PATCH v3 13/17] asm-generic/hyperv: introduce hv_device_id and auxiliary structures

2020-11-24 Thread Wei Liu
We will need to identify the device we want Microsoft Hypervisor to manipulate. Introduce the data structures for that purpose. They will be used in a later patch. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- include/asm-generic/hyperv-tlfs.h

[PATCH v3 16/17] x86/ioapic: export a few functions and data structures via io_apic.h

2020-11-24 Thread Wei Liu
We are about to implement an irqchip for IO-APIC when Linux runs as root on Microsoft Hypervisor. At the same time we would like to reuse existing code as much as possible. Move mp_chip_data to io_apic.h and make a few helper functions non-static. No functional change. Signed-off-by: Wei Liu

[PATCH v3 09/17] x86/hyperv: provide a bunch of helper functions

2020-11-24 Thread Wei Liu
: Nuno Das Neves Signed-off-by: Wei Liu --- v3: 1. Add __packed to structures. 2. Drop unnecessary exports. v2: 1. Adapt to hypervisor side changes 2. Address Vitaly's comments --- arch/x86/hyperv/Makefile | 2 +- arch/x86/hyperv/hv_proc.c

[PATCH v3 15/17] x86/hyperv: implement an MSI domain for root partition

2020-11-24 Thread Wei Liu
: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- v3: build irqdomain.o for 32bit as well v2: This patch is simplified due to upstream changes. --- arch/x86/hyperv/Makefile| 2 +- arch/x86/hyperv/hv_init.c | 9 + arch/x86/hyperv/irqdomain.c | 330

[PATCH v3 14/17] asm-generic/hyperv: import data structures for mapping device interrupts

2020-11-24 Thread Wei Liu
Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- arch/x86/include/asm/hyperv-tlfs.h | 13 +++ include/asm-generic/hyperv-tlfs.h | 36 ++ 2 files changed, 49 insertions(+) diff --git a/arch/x86/include/asm/hyperv

[PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry

2020-11-24 Thread Wei Liu
We will soon use the same structure to handle IO-APIC interrupts as well. Introduce an enum to identify the source and a data structure for IO-APIC RTE. While at it, update pci-hyperv.c to use the enum. No functional change. Signed-off-by: Wei Liu Acked-by: Rob Herring --- drivers/pci

[PATCH v3 17/17] x86/hyperv: handle IO-APIC when running as root

2020-11-24 Thread Wei Liu
hypercalls on top of the native routines. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- arch/x86/hyperv/hv_init.c | 13 +++ arch/x86/hyperv/irqdomain.c | 226 2 files changed, 239 insertions(+) diff --git a

[PATCH v3 11/17] asm-generic/hyperv: update hv_msi_entry

2020-11-24 Thread Wei Liu
We will soon need to access fields inside the MSI address and MSI data fields. Introduce hv_msi_address_register and hv_msi_data_register. Fix up one user of hv_msi_entry in mshyperv.h. No functional change expected. Signed-off-by: Wei Liu --- arch/x86/include/asm/mshyperv.h | 4

[PATCH v3 08/17] x86/hyperv: handling hypercall page setup for root

2020-11-24 Thread Wei Liu
f-by: Sunil Muthuswamy Signed-off-by: Nuno Das Neves Co-Developed-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Co-Developed-by: Nuno Das Neves Signed-off-by: Wei Liu --- v3: 1. Use HV_HYP_PAGE_SIZE. 2. Add checks to hv_suspend & co. --- arch/x86/hyperv/hv_ini

[PATCH v3 06/17] x86/hyperv: allocate output arg pages if required

2020-11-24 Thread Wei Liu
When Linux runs as the root partition, it will need to make hypercalls which return data from the hypervisor. Allocate pages for storing results when Linux runs as the root partition. Signed-off-by: Lillian Grassin-Drake Co-Developed-by: Lillian Grassin-Drake Signed-off-by: Wei Liu --- v3

[PATCH v3 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-24 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Joerg Roedel Reviewed-by: Vitaly Kuznetsov --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 del

[PATCH v3 05/17] clocksource/hyperv: use MSR-based access if running as root

2020-11-24 Thread Wei Liu
When Linux runs as the root partition, the setup required for TSC page is different. Luckily Linux also has access to the MSR based clocksource. We can just disable the TSC page clocksource if Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Daniel Lezcano --- drivers/clocksource

[PATCH v3 01/17] asm-generic/hyperv: change HV_CPU_POWER_MANAGEMENT to HV_CPU_MANAGEMENT

2020-11-24 Thread Wei Liu
This makes the name match Hyper-V TLFS. Signed-off-by: Wei Liu Reviewed-by: Vitaly Kuznetsov --- include/asm-generic/hyperv-tlfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h index e73a11850055

[PATCH v3 03/17] Drivers: hv: vmbus: skip VMBus initialization if Linux is root

2020-11-24 Thread Wei Liu
There is no VMBus and the other infrastructures initialized in hv_acpi_init when Linux is running as the root partition. Signed-off-by: Wei Liu --- v3: Return 0 instead of -ENODEV. --- drivers/hv/vmbus_drv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hv/vmbus_drv.c b/drivers

[PATCH v3 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-24 Thread Wei Liu
For now we can use the privilege flag to check. Stash the value to be used later. Put in a bunch of defines for future use when we want to have more fine-grained detection. Signed-off-by: Wei Liu --- v3: move hv_root_partition to mshyperv.c --- arch/x86/include/asm/hyperv-tlfs.h | 10

[PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor

2020-11-24 Thread Wei Liu
2. Address Vitaly's comments. Wei Liu (17): asm-generic/hyperv: change HV_CPU_POWER_MANAGEMENT to HV_CPU_MANAGEMENT x86/hyperv: detect if Linux is the root partition Drivers: hv: vmbus: skip VMBus initialization if Linux is root iommu/hyperv: don't setup IRQ remapping

Re: [PATCH 4/6] Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind()

2020-11-24 Thread Wei Liu
On Wed, Nov 18, 2020 at 03:36:47PM +0100, Andrea Parri (Microsoft) wrote: > When channel->device_obj is non-NULL, vmbus_onoffer_rescind() could > invoke put_device(), that will eventually release the device and free > the channel object (cf. vmbus_device_release()). However, a pointer > to the obj

Re: [PATCH] hv_netvsc: Validate number of allocated sub-channels

2020-11-24 Thread Wei Liu
On Wed, Nov 18, 2020 at 05:37:15PM -0800, Jakub Kicinski wrote: > On Wed, 18 Nov 2020 16:33:10 +0100 Andrea Parri (Microsoft) wrote: > > Lack of validation could lead to out-of-bound reads and information > > leaks (cf. usage of nvdev->chan_table[]). Check that the number of > > allocated sub-chan

Re: [RFC PATCH 00/18] Microsoft Hypervisor root partition ioctl interface

2020-11-24 Thread Wei Liu
nux is the root > partition, > this series depends on the RFC already posted by Wei Liu: > https://lore.kernel.org/linux-hyperv/20201105165814.29233-1-wei@kernel.org/T/#t > > The first two patches provide some helpers for converting hypervisor status > codes to linux error codes, and

Re: [RFC PATCH 12/18] virt/mshv: run vp ioctl and isr

2020-11-24 Thread Wei Liu
On Fri, Nov 20, 2020 at 04:30:31PM -0800, Nuno Das Neves wrote: [...] > diff --git a/virt/mshv/mshv_main.c b/virt/mshv/mshv_main.c > index c9445d2edb37..7ddb66d260ce 100644 > --- a/virt/mshv/mshv_main.c > +++ b/virt/mshv/mshv_main.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#inc

Re: [PATCH] video: hyperv_fb: Directly use the MMIO VRAM

2020-11-24 Thread Wei Liu
On Tue, Nov 24, 2020 at 08:33:32AM +, Dexuan Cui wrote: > Hi Wei Liu, > Please do not pick up this patch, because actually MMIO VRAM can not work > with fb_deferred_io. > No problem. Thanks for the heads-up. Wei.

[GIT PULL] Hyper-V fixes for 5.10-rc6

2020-11-23 Thread Wei Liu
Hi Linus, Please pull the following changes since commit 92e4dc8b05663d6539b1b8375f3b1cf7b204cfe9: Drivers: hv: vmbus: Allow cleanup of VMBUS_CONNECT_CPU if disconnected (2020-11-11 10:58:09 +) are available in the Git repository at: ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel

Re: [PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-19 Thread si-wei liu
A gentle reminder. Any chance this patch will get picked soon? Thanks, -Siwei On 11/9/2020 7:28 PM, Jason Wang wrote: On 2020/11/6 上午7:26, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the

Re: [PATCH] video: hyperv_fb: Fix the cache type when mapping the VRAM

2020-11-18 Thread Wei Liu
On Wed, Nov 18, 2020 at 12:20:11AM +, Michael Kelley wrote: > From: Dexuan Cui Sent: Tuesday, November 17, 2020 4:03 > PM > > > > x86 Hyper-V used to essentially always overwrite the effective cache type > > of guest memory accesses to WB. This was problematic in cases where there > > is a p

Re: [PATCH 2/2] x86: make hyperv support optional

2020-11-18 Thread Wei Liu
On Tue, Nov 17, 2020 at 09:23:08PM +0100, Enrico Weigelt, metux IT consult wrote: > Make it possible to opt-out from hyperv support. > "Hyper-V support". Have you tested this patch? If so, how? > Signed-off-by: Enrico Weigelt, metux IT consult > --- > arch/x86/Kconfig | 7 +++

Re: [PATCH 0/6] Add improvements suggested by checkpatch for vmbus_drv

2020-11-17 Thread Wei Liu
On Sun, Nov 15, 2020 at 04:57:28PM -0300, Matheus Castello wrote: > This series fixes some warnings edmited by the checkpatch in the file > vmbus_drv.c. I thought it would be good to split each fix into a commit to > help with the review. > > Matheus Castello (6): > drivers: hv: Fix hyperv_recor

Re: [PATCH v9 0/3] Drivers: hv: vmbus: vmbus_requestor data structure for VMBus hardening

2020-11-17 Thread Wei Liu
On Mon, Nov 09, 2020 at 11:03:59AM +0100, Andrea Parri (Microsoft) wrote: > Currently, VMbus drivers use pointers into guest memory as request IDs > for interactions with Hyper-V. To be more robust in the face of errors > or malicious behavior from a compromised Hyper-V, avoid exposing > guest memo

[GIT PULL] Hyper-V fixes for 5.10-rc5

2020-11-16 Thread Wei Liu
Hi Linus, Please pull the following changes since commit dbf563eee0b8cc056744514d91c5ffc2fa6c0982: x86/hyperv: Clarify comment on x2apic mode (2020-10-26 16:28:06 +) are available in the Git repository at: ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git tags/h

Re: [PATCH 5/6] drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE

2020-11-16 Thread Wei Liu
On Mon, Nov 16, 2020 at 11:21:48AM +, Wei Liu wrote: > On Sun, Nov 15, 2020 at 04:57:33PM -0300, Matheus Castello wrote: > > Fixed checkpatch warning: Possible unnecessary 'out of memory' message > > checkpatch(OOM_MESSAGE) > > > > Signed-off-by: Math

Re: [PATCH v2 09/17] x86/hyperv: provide a bunch of helper functions

2020-11-16 Thread Wei Liu
On Fri, Nov 13, 2020 at 05:13:44PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > On Thu, Nov 12, 2020 at 04:57:46PM +0100, Vitaly Kuznetsov wrote: > >> Wei Liu writes: > > [...] > >> > diff --git a/arch/x86/include/asm/mshyperv.h > >>

Re: [PATCH 5/6] drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE

2020-11-16 Thread Wei Liu
On Sun, Nov 15, 2020 at 04:57:33PM -0300, Matheus Castello wrote: > Fixed checkpatch warning: Possible unnecessary 'out of memory' message > checkpatch(OOM_MESSAGE) > > Signed-off-by: Matheus Castello > --- > drivers/hv/vmbus_drv.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > >

Re: [PATCH v9 2/3] scsi: storvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening

2020-11-16 Thread Wei Liu
On Fri, Nov 13, 2020 at 10:39:33PM +0100, Andrea Parri wrote: > On Fri, Nov 13, 2020 at 06:54:24PM +0000, Wei Liu wrote: > > On Fri, Nov 13, 2020 at 11:33:27AM +0000, Wei Liu wrote: > > > On Mon, Nov 09, 2020 at 11:04:01AM +0100, Andrea Parri (Microsoft) wrote: > >

Re: [PATCH v9 2/3] scsi: storvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening

2020-11-13 Thread Wei Liu
On Fri, Nov 13, 2020 at 11:33:27AM +, Wei Liu wrote: > On Mon, Nov 09, 2020 at 11:04:01AM +0100, Andrea Parri (Microsoft) wrote: > > From: Andres Beltran > > > > Currently, pointers to guest memory are passed to Hyper-V as > > transaction IDs in storvsc. In the

Re: [PATCH v2 08/17] x86/hyperv: handling hypercall page setup for root

2020-11-13 Thread Wei Liu
On Fri, Nov 13, 2020 at 03:33:33PM +, Wei Liu wrote: > On Thu, Nov 12, 2020 at 04:51:09PM +0100, Vitaly Kuznetsov wrote: > > Wei Liu writes: > > > > > When Linux is running as the root partition, the hypercall page will > > > have already been setup by Hype

Re: [PATCH v2 17/17] x86/hyperv: handle IO-APIC when running as root

2020-11-13 Thread Wei Liu
On Fri, Nov 13, 2020 at 04:01:58PM +, Wei Liu wrote: > On Thu, Nov 12, 2020 at 05:56:41PM +0100, Vitaly Kuznetsov wrote: > [...] > > > +static unsigned int hv_ioapic_startup_irq(struct irq_data *data) > > > +{ > > > + u16 status; > > > + struct I

Re: [PATCH v2 17/17] x86/hyperv: handle IO-APIC when running as root

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 05:56:41PM +0100, Vitaly Kuznetsov wrote: [...] > > +static unsigned int hv_ioapic_startup_irq(struct irq_data *data) > > +{ > > + u16 status; > > + struct IO_APIC_route_entry ire; > > + u32 vector; > > + struct irq_cfg *cfg; > > + int ioapic; > > + u8 ioapic_pin

Re: [PATCH v2 10/17] x86/hyperv: implement and use hv_smp_prepare_cpus

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 05:44:48PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > Microsoft Hypervisor requires the root partition to make a few > > hypercalls to setup application processors before they can be used. > > > > Signed-off-by: Lillian Grassin-D

Re: [PATCH v2 09/17] x86/hyperv: provide a bunch of helper functions

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:57:46PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: [...] > > diff --git a/arch/x86/include/asm/mshyperv.h > > b/arch/x86/include/asm/mshyperv.h > > index 67f5d35a73d3..4e590a167160 100644 > > --- a/arch/x86/include/asm/mshyperv.h >

Re: [PATCH v2 08/17] x86/hyperv: handling hypercall page setup for root

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:51:09PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > When Linux is running as the root partition, the hypercall page will > > have already been setup by Hyper-V. Copy the content over to the > > allocated page. > > > > T

Re: [PATCH v2 07/17] x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:44:39PM +0100, Vitaly Kuznetsov wrote: [...] > > +void __init hv_get_partition_id(void) > > +{ > > + struct hv_get_partition_id *output_page; > > + u16 status; > > + unsigned long flags; > > + > > + local_irq_save(flags); > > + output_page = *this_cpu_ptr(hyperv

Re: [PATCH v2 06/17] x86/hyperv: allocate output arg pages if required

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:35:48PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: [...] > > @@ -209,14 +219,23 @@ static int hv_cpu_die(unsigned int cpu) > > unsigned int new_cpu; > > unsigned long flags; > > void **input_arg; > > - void *

Re: [PATCH v2 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:27:14PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > The IOMMU code needs more work. We're sure for now the IRQ remapping > > hooks are not applicable when Linux is the root. > > Super-nitpick: I would suggest we always say '

Re: [PATCH v2 03/17] Drivers: hv: vmbus: skip VMBus initialization if Linux is root

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:24:38PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > There is no VMBus and the other infrastructures initialized in > > hv_acpi_init when Linux is running as the root partition. > > > > Signed-off-by: Wei Liu > >

Re: [PATCH v9 1/3] Drivers: hv: vmbus: Add vmbus_requestor data structure for VMBus hardening

2020-11-13 Thread Wei Liu
est IDs. > > Signed-off-by: Andres Beltran > Co-developed-by: Andrea Parri (Microsoft) > Signed-off-by: Andrea Parri (Microsoft) > Reviewed-by: Michael Kelley Reviewed-by: Wei Liu

Re: [PATCH v9 3/3] hv_netvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening

2020-11-13 Thread Wei Liu
rea Parri (Microsoft) > Reviewed-by: Michael Kelley > Acked-by: Jakub Kicinski > Cc: "David S. Miller" > Cc: Jakub Kicinski > Cc: net...@vger.kernel.org Reviewed-by: Wei Liu

Re: [PATCH v9 2/3] scsi: storvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening

2020-11-13 Thread Wei Liu
rea Parri (Microsoft) > Reviewed-by: Michael Kelley > Cc: "James E.J. Bottomley" > Cc: "Martin K. Petersen" > Cc: linux-s...@vger.kernel.org Reviewed-by: Wei Liu

Re: [PATCH v2 05/17] clocksource/hyperv: use MSR-based access if running as root

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:30:57PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > Signed-off-by: Wei Liu > > In the missing commit message I'd like to see why we don't use 'TSC > page' clocksource for the root partition. My guess would be tha

Re: [PATCH v2 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:16:30PM +0100, Vitaly Kuznetsov wrote: [...] > > /* > > * Virtual processor will never share a physical core with another virtual > > * processor, except for virtual processors that are reported as sibling > > SMT > > diff --git a/arch/x86/include/asm/mshyperv.h >

Re: [PATCH v2 15/17] x86/hyperv: implement an MSI domain for root partition

2020-11-12 Thread Wei Liu
On Thu, Nov 05, 2020 at 04:58:12PM +, Wei Liu wrote: > When Linux runs as the root partition on Microsoft Hypervisor, its > interrupts are remapped. Linux will need to explicitly map and unmap > interrupts for hardware. > > Implement an MSI domain to issue the correct

Re: [PATCH v2 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 11:46:41AM +, Wei Liu wrote: > On Thu, Nov 12, 2020 at 11:42:15AM +0000, Wei Liu wrote: > > On Fri, Nov 06, 2020 at 03:16:07AM +0800, kernel test robot wrote: > > > Hi Wei, > > > > > > I love your patch! Yet something to improve: &g

Re: [PATCH v2 07/17] x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary

2020-11-12 Thread Wei Liu
master v5.10-rc2 next-20201105] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux

Re: [PATCH v2 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 11:42:15AM +, Wei Liu wrote: > On Fri, Nov 06, 2020 at 03:16:07AM +0800, kernel test robot wrote: > > Hi Wei, > > > > I love your patch! Yet something to improve: > > > > [auto build test ERROR on tip/x86/core] > > [also build

Re: [PATCH v2 05/17] clocksource/hyperv: use MSR-based access if running as root

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 12:40:53PM +0100, Daniel Lezcano wrote: > On 12/11/2020 12:24, Wei Liu wrote: > > On Thu, Nov 12, 2020 at 10:56:17AM +0100, Daniel Lezcano wrote: > >> On 05/11/2020 17:58, Wei Liu wrote: > >>> Signed-off-by: Wei Liu > > Acked-by: Daniel Lezcano Thanks Daniel. Wei.

Re: [PATCH v2 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-12 Thread Wei Liu
On Fri, Nov 06, 2020 at 03:16:07AM +0800, kernel test robot wrote: > Hi Wei, > > I love your patch! Yet something to improve: > > [auto build test ERROR on tip/x86/core] > [also build test ERROR on asm-generic/master iommu/next tip/timers/core > pci/next linus/master v5.10-rc2 next-20201105] > [

Re: [PATCH v2 16/17] x86/ioapic: export a few functions and data structures via io_apic.h

2020-11-12 Thread Wei Liu
On Thu, Nov 05, 2020 at 04:58:13PM +, Wei Liu wrote: > We are about to implement an irqchip for IO-APIC when Linux runs as root > on Microsoft Hypervisor. At the same time we would like to reuse > existing code as much as possible. > > Move mp_chip_data to io_apic.h and ma

Re: [PATCH v2 05/17] clocksource/hyperv: use MSR-based access if running as root

2020-11-12 Thread Wei Liu
On Thu, Nov 12, 2020 at 10:56:17AM +0100, Daniel Lezcano wrote: > On 05/11/2020 17:58, Wei Liu wrote: > > Signed-off-by: Wei Liu > > --- > > I would like to apply this patch but the changelog is too short (one line). > > Please add a small paragraph (no need to rese

Re: [PATCH] Drivers: hv: vmbus: Allow cleanup of VMBUS_CONNECT_CPU if disconnected

2020-11-11 Thread Wei Liu
On Tue, Nov 10, 2020 at 09:18:33PM +0100, Andrea Parri wrote: > On Tue, Nov 10, 2020 at 07:01:18PM +, Chris Co wrote: > > From: Chris Co > > > > When invoking kexec() on a Linux guest running on a Hyper-V host, the > > kernel panics. > > > > RIP: 0010:cpuhp_issue_call+0x137/0x140 > >

Re: [PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-10 Thread si-wei liu
On 11/9/2020 7:28 PM, Jason Wang wrote: On 2020/11/6 上午7:26, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping pinned pages is reverted to what

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-09 Thread si-wei liu
On 11/9/2020 2:42 PM, Michael S. Tsirkin wrote: On Mon, Nov 09, 2020 at 01:44:03PM -0800, si-wei liu wrote: On 11/8/2020 7:21 PM, Jason Wang wrote: On 2020/11/6 上午6:57, si-wei liu wrote: On 11/4/2020 7:26 PM, Jason Wang wrote: On 2020/11/5 上午7:33, Si-Wei Liu wrote: Pinned pages are not

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-09 Thread si-wei liu
On 11/8/2020 7:21 PM, Jason Wang wrote: On 2020/11/6 上午6:57, si-wei liu wrote: On 11/4/2020 7:26 PM, Jason Wang wrote: On 2020/11/5 上午7:33, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for

[PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-05 Thread Si-Wei Liu
memory demand for VM with a large amount of memory, or in the situation where host is running short of free memory. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Signed-off-by: Si-Wei Liu --- Changes in v3: - Turn explicit last_pfn check to a WARN_ON() (Jason) Changes in v2:

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-05 Thread si-wei liu
On 11/4/2020 7:26 PM, Jason Wang wrote: On 2020/11/5 上午7:33, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping pinned pages is reverted to what

Re: [PATCH 2/2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-05 Thread si-wei liu
On 11/4/2020 7:12 PM, Jason Wang wrote: On 2020/11/5 上午7:40, si-wei liu wrote: On 11/3/2020 6:42 PM, Jason Wang wrote: On 2020/10/30 下午3:45, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages

[PATCH v2 03/17] Drivers: hv: vmbus: skip VMBus initialization if Linux is root

2020-11-05 Thread Wei Liu
There is no VMBus and the other infrastructures initialized in hv_acpi_init when Linux is running as the root partition. Signed-off-by: Wei Liu --- drivers/hv/vmbus_drv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 4fad3e6745e5

[PATCH v2 06/17] x86/hyperv: allocate output arg pages if required

2020-11-05 Thread Wei Liu
When Linux runs as the root partition, it will need to make hypercalls which return data from the hypervisor. Allocate pages for storing results when Linux runs as the root partition. Signed-off-by: Lillian Grassin-Drake Co-Developed-by: Lillian Grassin-Drake Signed-off-by: Wei Liu --- v2

[PATCH v2 16/17] x86/ioapic: export a few functions and data structures via io_apic.h

2020-11-05 Thread Wei Liu
We are about to implement an irqchip for IO-APIC when Linux runs as root on Microsoft Hypervisor. At the same time we would like to reuse existing code as much as possible. Move mp_chip_data to io_apic.h and make a few helper functions non-static. No functional change. Signed-off-by: Wei Liu

[PATCH v2 17/17] x86/hyperv: handle IO-APIC when running as root

2020-11-05 Thread Wei Liu
hypercalls on top of the native routines. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- arch/x86/hyperv/hv_init.c | 13 +++ arch/x86/hyperv/irqdomain.c | 226 2 files changed, 239 insertions(+) diff --git a

[PATCH v2 08/17] x86/hyperv: handling hypercall page setup for root

2020-11-05 Thread Wei Liu
Signed-off-by: Sunil Muthuswamy Signed-off-by: Nuno Das Neves Co-Developed-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Co-Developed-by: Nuno Das Neves Signed-off-by: Wei Liu --- arch/x86/hyperv/hv_init.c | 32 ++-- 1 file changed, 30 insertions(+), 2

[PATCH v2 14/17] asm-generic/hyperv: import data structures for mapping device interrupts

2020-11-05 Thread Wei Liu
Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- arch/x86/include/asm/hyperv-tlfs.h | 13 +++ include/asm-generic/hyperv-tlfs.h | 36 ++ 2 files changed, 49 insertions(+) diff --git a/arch/x86/include/asm/hyperv

[PATCH v2 15/17] x86/hyperv: implement an MSI domain for root partition

2020-11-05 Thread Wei Liu
: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- v2: This patch is simplified due to upstream changes. --- arch/x86/hyperv/Makefile| 2 +- arch/x86/hyperv/hv_init.c | 10 +- arch/x86/hyperv/irqdomain.c | 330 3 files

[PATCH v2 05/17] clocksource/hyperv: use MSR-based access if running as root

2020-11-05 Thread Wei Liu
Signed-off-by: Wei Liu --- drivers/clocksource/hyperv_timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index ba04cb381cd3..269a691bd2c4 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource

[PATCH v2 00/17] Introducing Linux root partition support for Microsoft Hypervisor

2020-11-05 Thread Wei Liu
is shorter. Comments and suggestions are welcome. Thanks, Wei. Changes since v1: 1. Simplify MSI IRQ domain implementation. 2. Address Vitaly's comments. Wei Liu (17): asm-generic/hyperv: change HV_CPU_POWER_MANAGEMENT to HV_CPU_MANAGEMENT x86/hyperv: detect if Linux is the root part

[PATCH v2 10/17] x86/hyperv: implement and use hv_smp_prepare_cpus

2020-11-05 Thread Wei Liu
Microsoft Hypervisor requires the root partition to make a few hypercalls to setup application processors before they can be used. Signed-off-by: Lillian Grassin-Drake Signed-off-by: Sunil Muthuswamy Co-Developed-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei

[PATCH v2 09/17] x86/hyperv: provide a bunch of helper functions

2020-11-05 Thread Wei Liu
: Nuno Das Neves Signed-off-by: Wei Liu --- v2: 1. Adapt to hypervisor side changes 2. Address Vitaly's comments --- arch/x86/hyperv/Makefile | 2 +- arch/x86/hyperv/hv_proc.c | 217 ++ arch/x86/include/asm/mshyperv.h | 4 + include/asm-ge

[PATCH v2 07/17] x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary

2020-11-05 Thread Wei Liu
We will need the partition ID for executing some hypercalls later. Signed-off-by: Lillian Grassin-Drake Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- arch/x86/hyperv/hv_init.c | 26 ++ arch/x86/include/asm/mshyperv.h | 2 ++ include/asm

[PATCH v2 13/17] asm-generic/hyperv: introduce hv_device_id and auxiliary structures

2020-11-05 Thread Wei Liu
We will need to identify the device we want Microsoft Hypervisor to manipulate. Introduce the data structures for that purpose. They will be used in a later patch. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- include/asm-generic/hyperv-tlfs.h

[PATCH v2 11/17] asm-generic/hyperv: update hv_msi_entry

2020-11-05 Thread Wei Liu
We will soon need to access fields inside the MSI address and MSI data fields. Introduce hv_msi_address_register and hv_msi_data_register. Fix up one user of hv_msi_entry in mshyperv.h. No functional change expected. Signed-off-by: Wei Liu --- arch/x86/include/asm/mshyperv.h | 4

[PATCH v2 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-05 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root. Signed-off-by: Wei Liu Acked-by: Joerg Roedel --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/h

[PATCH v2 12/17] asm-generic/hyperv: update hv_interrupt_entry

2020-11-05 Thread Wei Liu
We will soon use the same structure to handle IO-APIC interrupts as well. Introduce an enum to identify the source and a data structure for IO-APIC RTE. While at it, update pci-hyperv.c to use the enum. No functional change. Signed-off-by: Wei Liu Acked-by: Rob Herring --- drivers/pci

[PATCH v2 01/17] asm-generic/hyperv: change HV_CPU_POWER_MANAGEMENT to HV_CPU_MANAGEMENT

2020-11-05 Thread Wei Liu
This makes the name match Hyper-V TLFS. Signed-off-by: Wei Liu --- include/asm-generic/hyperv-tlfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h index e73a11850055..e6903589a82a 100644 --- a/include

[PATCH v2 02/17] x86/hyperv: detect if Linux is the root partition

2020-11-05 Thread Wei Liu
For now we can use the privilege flag to check. Stash the value to be used later. Put in a bunch of defines for future use when we want to have more fine-grained detection. Signed-off-by: Wei Liu --- arch/x86/hyperv/hv_init.c | 4 arch/x86/include/asm/hyperv-tlfs.h | 10

[GIT PULL] Hyper-V fixes for 5.10-rc3

2020-11-05 Thread Wei Liu
Hi Linus Please pull the following changes since commit bbf5c979011a099af5dc76498918ed7df445635b: Linux 5.9 (2020-10-11 14:15:50 -0700) are available in the Git repository at: ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git tags/hyperv-fixes-signed for you to fet

[PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-04 Thread Si-Wei Liu
memory demand for VM with a large amount of memory, or in the situation where host is running short of free memory. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Signed-off-by: Si-Wei Liu --- Changes in v2: - Drop the reversion patch - Fix unhandled page leak towards the end of

<    1   2   3   4   5   6   >