Re: [PATCH 0/5 V5] vhost-scsi: IO error fixups

2020-11-12 Thread Stefan Hajnoczi
On Mon, Nov 09, 2020 at 11:33:18PM -0600, Mike Christie wrote: > The following patches were made over Michael's vhost branch: > > https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/log/?h=vhost > > They fixe a couple issues where the guest is getting IO errors: > 1. The admin may set

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > Just like MSI/MSI-X, IO-APIC interrupts are remapped by Microsoft > Hypervisor when Linux runs as the root partition. Implement an IRQ chip > to handle mapping and unmapping of IO-APIC interrupts. > > Use custom functions for mapping and unmapping ACPI GSIs. They will > issue

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

2020-11-12 Thread Vitaly Kuznetsov
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-Drake > Signed-off-by: Sunil Muthuswamy > Co-Developed-by: Lillian Grassin-Drake > Co-Developed-by: Sunil

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > They are used to deposit pages into Microsoft Hypervisor and bring up > logical and virtual processors. > > Signed-off-by: Lillian Grassin-Drake > Signed-off-by: Sunil Muthuswamy > Signed-off-by: Nuno Das Neves > Co-Developed-by: Lillian Grassin-Drake > Co-Developed-by:

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

2020-11-12 Thread Vitaly Kuznetsov
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. > > The suspend, resume and cleanup paths remain untouched because they are > not supported in this setup yet. What about

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > 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 ++ >

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > 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 >

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

2020-11-12 Thread Vitaly Kuznetsov
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 that it's not available and actually we're supposed to use raw TSC value (because root partitions never migrate) but please

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

2020-11-12 Thread Vitaly Kuznetsov
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 'root partition' as 'root' has a 'slightly different' meaning in Linux and this commit message may sound

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

2020-11-12 Thread Vitaly Kuznetsov
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 > --- > drivers/hv/vmbus_drv.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/hv/vmbus_drv.c

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > 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 >

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

2020-11-12 Thread Vitaly Kuznetsov
Wei Liu writes: > 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

[PATCH v2 29/29] virtio-mem: Big Block Mode (BBM) - safe memory hotunplug

2020-11-12 Thread David Hildenbrand
Let's add a safe mechanism to unplug memory, avoiding long/endless loops when trying to offline memory - similar to in SBM. Fake-offline all memory (via alloc_contig_range()) before trying to offline+remove it. Use this mode as default, but allow to enable the other mode explicitly (which could

[PATCH v2 25/29] virtio-mem: Big Block Mode (BBM) memory hotplug

2020-11-12 Thread David Hildenbrand
Currently, we do not support device block sizes that exceed the Linux memory block size. For example, having a device block size of 1 GiB (e.g., gigantic pages in the hypervisor) won't work with 128 MiB Linux memory blocks. Let's implement Big Block Mode (BBM), whereby we add/remove at least one

[PATCH v2 28/29] virtio-mem: Big Block Mode (BBM) - basic memory hotunplug

2020-11-12 Thread David Hildenbrand
Let's try to unplug completely offline big blocks first. Then, (if enabled via unplug_offline) try to offline and remove whole big blocks. No locking necessary - we can deal with concurrent onlining/offlining just fine. Note1: This is sub-optimal and might be dangerous in some environments: we

[PATCH v2 26/29] virtio-mem: allow to force Big Block Mode (BBM) and set the big block size

2020-11-12 Thread David Hildenbrand
Let's allow to force BBM, even if subblocks would be possible. Take care of properly calculating the first big block id, because the start address might no longer be aligned to the big block size. Also, allow to manually configure the size of Big Blocks. Reviewed-by: Wei Yang Cc: "Michael S.

[PATCH v2 27/29] mm/memory_hotplug: extend offline_and_remove_memory() to handle more than one memory block

2020-11-12 Thread David Hildenbrand
virtio-mem soon wants to use offline_and_remove_memory() memory that exceeds a single Linux memory block (memory_block_size_bytes()). Let's remove that restriction. Let's remember the old state and try to restore that if anything goes wrong. While re-onlining can, in general, fail, it's highly

[PATCH v2 22/29] virito-mem: existing (un)plug functions are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's rename them accordingly. virtio_mem_plug_request() and virtio_mem_unplug_request() will be handled separately. Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 90

[PATCH v2 21/29] virtio-mem: memory block ids are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's move first_mb_id/next_mb_id/last_usable_mb_id accordingly. Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 46 ++--- 1 file changed, 23 insertions(+), 23

[PATCH v2 20/29] virtio-mem: nb_sb_per_mb and subblock_size are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's rename to "sbs_per_mb" and "sb_size" and move accordingly. Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 96 ++--- 1 file changed, 48 insertions(+), 48

[PATCH v2 19/29] virito-mem: subblock states are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's rename and move accordingly. While at it, rename sb_bitmap to "sb_states". Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 132

[PATCH v2 24/29] virtio-mem: factor out adding/removing memory from Linux

2020-11-12 Thread David Hildenbrand
Let's use wrappers for the low-level functions that dev_dbg/dev_warn and work on addr + size, such that we can reuse them for adding/removing in other granularity. We only warn when adding memory failed, because that's something to pay attention to. We won't warn when removing failed, we'll reuse

[PATCH v2 23/29] virtio-mem: memory notifier callbacks are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's rename accordingly. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/virtio/virtio_mem.c

[PATCH v2 16/29] virtio-mem: generalize handling when memory is getting onlined deferred

2020-11-12 Thread David Hildenbrand
We don't want to add too much memory when it's not getting onlined immediately, to avoid running OOM. Generalize the handling, to avoid making use of memory block states. Use a threshold of 1 GiB for now. Properly adjust the offline size when adding/removing memory. As we are not always protected

[PATCH v2 13/29] virtio-mem: generalize virtio_mem_overlaps_range()

2020-11-12 Thread David Hildenbrand
Avoid using memory block ids. While at it, use uint64_t for address/size. This is a preparation for Big Block Mode (BBM). Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 10 +++--- 1

[PATCH v2 15/29] virtio-mem: don't always trigger the workqueue when offlining memory

2020-11-12 Thread David Hildenbrand
Let's trigger from offlining code only when we're not allowed to unplug online memory. Handle the other case (memmap possibly freeing up another memory block) when actually removing memory. We now also properly handle the case when removing already offline memory blocks via virtio_mem_mb_remove().

[PATCH v2 17/29] virito-mem: document Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
Let's add some documentation for the current mode - Sub Block Mode (SBM) - to prepare for a new mode - Big Block Mode (BBM). Follow-up patches will properly factor out the existing Sub Block Mode (SBM) and implement Big Block Mode (BBM). Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc:

[PATCH v2 18/29] virtio-mem: memory block states are specific to Sub Block Mode (SBM)

2020-11-12 Thread David Hildenbrand
let's use a new "sbm" sub-struct to hold SBM-specific state and rename + move applicable definitions, functions, and variables (related to memory block states). While at it: - Drop the "_STATE" part from memory block states - Rename "nb_mb_state" to "mb_count" - "set_mb_state" / "get_mb_state"

[PATCH v2 14/29] virtio-mem: drop last_mb_id

2020-11-12 Thread David Hildenbrand
No longer used, let's drop it. Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/virtio/virtio_mem.c

[PATCH v2 11/29] virtio-mem: generalize check for added memory

2020-11-12 Thread David Hildenbrand
Let's check by traversing busy system RAM resources instead, to avoid relying on memory block states. Don't use walk_system_ram_range(), as that works on pages and we want to use the bare addresses we have easily at hand. This is a preparation for Big Block Mode (BBM), which won't have memory

[PATCH v2 07/29] virtio-mem: print debug messages from virtio_mem_send_*_request()

2020-11-12 Thread David Hildenbrand
Let's move the existing dev_dbg() into the functions, print if something went wrong, and also print for virtio_mem_send_unplug_all_request(). Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 50

[PATCH v2 01/29] virtio-mem: determine nid only once using memory_add_physaddr_to_nid()

2020-11-12 Thread David Hildenbrand
Let's determine the target nid only once in case we have none specified - usually, we'll end up with node 0 either way. Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c

[PATCH v2 10/29] virtio-mem: retry fake-offlining via alloc_contig_range() on ZONE_MOVABLE

2020-11-12 Thread David Hildenbrand
ZONE_MOVABLE is supposed to give some guarantees, yet, alloc_contig_range() isn't prepared to properly deal with some racy cases properly (e.g., temporary page pinning when exiting processed, PCP). Retry 5 times for now. There is certainly room for improvement in the future. Cc: "Michael S.

[PATCH v2 06/29] virtio-mem: factor out calculation of the bit number within the subblock bitmap

2020-11-12 Thread David Hildenbrand
The calculation is already complicated enough, let's limit it to one location. Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 20 +++- 1 file

[PATCH v2 00/29] virtio-mem: Big Block Mode (BBM)

2020-11-12 Thread David Hildenbrand
@Andrew, can we have an ack for patch #27, so that one can go via the vhost tree for 5.11? --- virtio-mem currently only supports device block sizes that span at most a single Linux memory block. For example, gigantic pages in the hypervisor result on x86-64 in a device block size of 1 GiB -

[PATCH v2 09/29] virtio-mem: factor out handling of fake-offline pages in memory notifier

2020-11-12 Thread David Hildenbrand
Let's factor out the core pieces and place the implementation next to virtio_mem_fake_offline(). We'll reuse this functionality soon. Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 73

[PATCH v2 12/29] virtio-mem: generalize virtio_mem_owned_mb()

2020-11-12 Thread David Hildenbrand
Avoid using memory block ids. Rename it to virtio_mem_contains_range(). This is a preparation for Big Block Mode (BBM). Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 9 + 1 file

[PATCH v2 08/29] virtio-mem: factor out fake-offlining into virtio_mem_fake_offline()

2020-11-12 Thread David Hildenbrand
... which now matches virtio_mem_fake_online(). We'll reuse this functionality soon. Reviewed-by: Wei Yang Reviewed-by: Pankaj Gupta Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 34

[PATCH v2 03/29] virtio-mem: simplify MAX_ORDER - 1 / pageblock_order handling

2020-11-12 Thread David Hildenbrand
Let's use pageblock_nr_pages and MAX_ORDER_NR_PAGES instead where possible to simplify. Add a comment why we have that restriction for now. Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 35

[PATCH v2 04/29] virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()

2020-11-12 Thread David Hildenbrand
We can drop rc2, we don't actually need the value. Reviewed-by: Pankaj Gupta Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff

[PATCH v2 05/29] virtio-mem: use "unsigned long" for nr_pages when fake onlining/offlining

2020-11-12 Thread David Hildenbrand
No harm done, but let's be consistent. Reviewed-by: Pankaj Gupta Reviewed-by: Wei Yang Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2 02/29] virtio-mem: more precise calculation in virtio_mem_mb_state_prepare_next_mb()

2020-11-12 Thread David Hildenbrand
We actually need one byte less (next_mb_id is exclusive, first_mb_id is inclusive). While at it, compact the code. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 6 ++ 1 file changed, 2 insertions(+), 4

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

2020-11-12 Thread Daniel Lezcano
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 >>> --- >> >> I would like to apply this patch but the changelog is too short (one line). >> >>

Re: [patch V3 10/37] ARM: highmem: Switch to generic kmap atomic

2020-11-12 Thread Sebastian Andrzej Siewior
On 2020-11-12 09:10:34 [+0100], Marek Szyprowski wrote: > I can do more tests to help fixing this issue. Just let me know what to do. -> https://lkml.kernel.org/r/87y2j6n8mj@nanos.tec.linutronix.de Sebastian ___ Virtualization mailing list

Re: [patch V3 10/37] ARM: highmem: Switch to generic kmap atomic

2020-11-12 Thread Thomas Gleixner
Marek, On Thu, Nov 12 2020 at 09:10, Marek Szyprowski wrote: > On 03.11.2020 10:27, Thomas Gleixner wrote: > > I can do more tests to help fixing this issue. Just let me know what to do. Just sent out the fix before I saw your report.

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

2020-11-12 Thread Daniel Lezcano
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 resend just answer here, I will amend the log myself. > drivers/clocksource/hyperv_timer.c | 3 +++ > 1 file