1. 09 Jul, 2024 10 commits
    • Bibo Mao's avatar
      LoongArch: KVM: Add PV steal time support in guest side · 03779999
      Bibo Mao authored
      Per-cpu struct kvm_steal_time is added here, its size is 64 bytes and
      also defined as 64 bytes, so that the whole structure is in one physical
      page.
      
      When a VCPU is online, function pv_enable_steal_time() is called. This
      function will pass guest physical address of struct kvm_steal_time and
      tells hypervisor to enable steal time. When a vcpu is offline, physical
      address is set as 0 and tells hypervisor to disable steal time.
      
      Here is an output of vmstat on guest when there is workload on both host
      and guest. It shows steal time stat information.
      
      procs -----------memory---------- -----io---- -system-- ------cpu-----
       r  b   swpd   free  inact active   bi    bo   in   cs us sy id wa st
      15  1      0 7583616 184112  72208    20    0  162   52 31  6 43  0 20
      17  0      0 7583616 184704  72192    0     0 6318 6885  5 60  8  5 22
      16  0      0 7583616 185392  72144    0     0 1766 1081  0 49  0  1 50
      16  0      0 7583616 184816  72304    0     0 6300 6166  4 62 12  2 20
      18  0      0 7583632 184480  72240    0     0 2814 1754  2 58  4  1 35
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      03779999
    • Bibo Mao's avatar
      LoongArch: KVM: Add PV steal time support in host side · b4ba1570
      Bibo Mao authored
      Add ParaVirt steal time feature in host side, VM can search supported
      features provided by KVM hypervisor, a feature KVM_FEATURE_STEAL_TIME
      is added here. Like x86, steal time structure is saved in guest memory,
      one hypercall function KVM_HCALL_FUNC_NOTIFY is added to notify KVM to
      enable this feature.
      
      One CPU attr ioctl command KVM_LOONGARCH_VCPU_PVTIME_CTRL is added to
      save and restore the base address of steal time structure when a VM is
      migrated.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b4ba1570
    • Jia Qingtong's avatar
      LoongArch: KVM: always make pte young in page map's fast path · d7ad41a3
      Jia Qingtong authored
      It seems redundant to check if pte is young before the call to
      kvm_pte_mkyoung() in kvm_map_page_fast(). Just remove the check.
      Reviewed-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarJia Qingtong <jiaqingtong97@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      d7ad41a3
    • Bibo Mao's avatar
      LoongArch: KVM: Mark page accessed and dirty with page ref added · ebf00272
      Bibo Mao authored
      Function kvm_map_page_fast() is fast path of secondary mmu page fault
      flow, pfn is parsed from secondary mmu page table walker. However the
      corresponding page reference is not added, it is dangerious to access
      page out of mmu_lock.
      
      Here page ref is added inside mmu_lock, function kvm_set_pfn_accessed()
      and kvm_set_pfn_dirty() is called with page ref added, so that the page
      will not be freed by others.
      
      Also kvm_set_pfn_accessed() is removed here since it is called in the
      following function kvm_release_pfn_clean().
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ebf00272
    • Bibo Mao's avatar
      LoongArch: KVM: Add dirty bitmap initially all set support · 8c347042
      Bibo Mao authored
      Add KVM_DIRTY_LOG_INITIALLY_SET support on LoongArch system, this
      feature comes from other architectures like x86 and arm64.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      8c347042
    • Bibo Mao's avatar
      LoongArch: KVM: Add memory barrier before update pmd entry · 32d4b999
      Bibo Mao authored
      When updating pmd entry such as allocating new pmd page or splitting
      huge page into normal page, it is necessary to firstly update all pte
      entries, and then update pmd entry.
      
      It is weak order with LoongArch system, there will be problem if other
      VCPUs see pmd update firstly while ptes are not updated. Here smp_wmb()
      is added to assure this.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      32d4b999
    • Bibo Mao's avatar
      LoongArch: KVM: Discard dirty page tracking on readonly memslot · b072cbf0
      Bibo Mao authored
      For readonly memslot such as UEFI BIOS or UEFI var space, guest cannot
      write this memory space directly. So it is not necessary to track dirty
      pages for readonly memslot. Here we make such optimization in function
      kvm_arch_commit_memory_region().
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b072cbf0
    • Bibo Mao's avatar
      LoongArch: KVM: Select huge page only if secondary mmu supports it · 2f56f9ea
      Bibo Mao authored
      Currently page level selection about secondary mmu depends on memory
      slot and page level about host mmu. There will be problems if page level
      of secondary mmu is zero already. Huge page cannot be selected if there is
      normal page mapped in secondary mmu already, since it is not supported to
      merge normal pages into huge pages now.
      
      So page level selection should depend on the following three conditions.
       1. Memslot is aligned for huge page and vm is not migrating.
       2. Page level of host mmu is also huge page.
       3. Page level of secondary mmu is suituable for huge page.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2f56f9ea
    • Bibo Mao's avatar
      LoongArch: KVM: Delay secondary mmu tlb flush until guest entry · b5d4e232
      Bibo Mao authored
      With hardware assisted virtualization, there are two level HW mmu, one
      is GVA to GPA mapping, the other is GPA to HPA mapping which is called
      secondary mmu in generic. If there is page fault for secondary mmu,
      there needs tlb flush operation indexed with fault GPA address and VMID.
      VMID is stored at register CSR.GSTAT and will be reload or recalculated
      before guest entry.
      
      Currently CSR.GSTAT is not saved and restored during VCPU context
      switch, instead it is recalculated during guest entry. So CSR.GSTAT is
      effective only when a VCPU runs in guest mode, however it may not be
      effective if the VCPU exits to host mode. Since register CSR.GSTAT may
      be stale, it may records the VMID of the last schedule-out VCPU, rather
      than the current VCPU.
      
      Function kvm_flush_tlb_gpa() should be called with its real VMID, so
      here move it to the guest entrance. Also an arch-specific request id
      KVM_REQ_TLB_FLUSH_GPA is added to flush tlb for secondary mmu, and it
      can be optimized if VMID is updated, since all guest tlb entries will
      be invalid if VMID is updated.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b5d4e232
    • Bibo Mao's avatar
      LoongArch: KVM: Sync pending interrupt when getting ESTAT from user mode · e306e514
      Bibo Mao authored
      Currently interrupts are posted and cleared with the asynchronous mode,
      meanwhile they are saved in SW state vcpu::arch::irq_pending and vcpu::
      arch::irq_clear. When vcpu is ready to run, pending interrupt is written
      back to CSR.ESTAT register from SW state vcpu::arch::irq_pending at the
      guest entrance.
      
      During VM migration stage, vcpu is put into stopped state, however
      pending interrupts are not synced to CSR.ESTAT register. So there will
      be interrupt lost when VCPU is migrated to another host machines.
      
      Here in this patch when ESTAT CSR register is read from VMM user mode,
      pending interrupts are synchronized to ESTAT also. So that VMM can get
      correct pending interrupts.
      Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      e306e514
  2. 07 Jul, 2024 3 commits
    • Linus Torvalds's avatar
      Linux 6.10-rc7 · 256abd8e
      Linus Torvalds authored
      256abd8e
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 5a4bd506
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A set of clk fixes for the Qualcomm, Mediatek, and Allwinner drivers:
      
         - Fix the Qualcomm Stromer Plus PLL set_rate() clk_op to explicitly
           set the alpha enable bit and not set bits that don't exist
      
         - Mark Qualcomm IPQ9574 crypto clks as voted to avoid stuck clk
           warnings
      
         - Fix the parent of some PLLs on Qualcomm sm6530 so their rate is
           correct
      
         - Fix the min/max rate clamping logic in the Allwinner driver that
           got broken in v6.9
      
         - Limit runtime PM enabling in the Mediatek driver to only
           mt8183-mfgcfg so that system wide resume doesn't break on other
           Mediatek SoCs"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mediatek: mt8183: Only enable runtime PM on mt8183-mfgcfg
        clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common
        clk: qcom: gcc-ipq9574: Add BRANCH_HALT_VOTED flag
        clk: qcom: apss-ipq-pll: remove 'config_ctl_hi_val' from Stromer pll configs
        clk: qcom: clk-alpha-pll: set ALPHA_EN bit for Stromer Plus PLLs
        clk: qcom: gcc-sm6350: Fix gpll6* & gpll7 parents
      5a4bd506
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · c6653f49
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix unnecessary copy to 0 when kernel is booted at address 0
      
       - Fix usercopy crash when dumping dtl via debugfs
      
       - Avoid possible crash when PCI hotplug races with error handling
      
       - Fix kexec crash caused by scv being disabled before other CPUs
         call-in
      
       - Fix powerpc selftests build with USERCFLAGS set
      
      Thanks to Anjali K, Ganesh Goudar, Gautam Menghani, Jinglin Wen,
      Nicholas Piggin, Sourabh Jain, Srikar Dronamraju, and Vishal Chourasia.
      
      * tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        selftests/powerpc: Fix build with USERCFLAGS set
        powerpc/pseries: Fix scv instruction crash with kexec
        powerpc/eeh: avoid possible crash when edev->pdev changes
        powerpc/pseries: Whitelist dtl slub object for copying to userspace
        powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0
      c6653f49
  3. 06 Jul, 2024 3 commits
    • Linus Torvalds's avatar
      Merge tag '6.10-rc6-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6 · 256fdd4b
      Linus Torvalds authored
      Pull smb client fix from Steve French:
       "Fix for smb3 readahead performance regression"
      
      * tag '6.10-rc6-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: Fix read-performance regression by dropping readahead expansion
      256fdd4b
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 22f902df
      Linus Torvalds authored
      Pull i2c fix from Wolfram Sang:
       "An i2c driver fix"
      
      * tag 'i2c-for-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr
      22f902df
    • Michael Ellerman's avatar
      selftests/powerpc: Fix build with USERCFLAGS set · 8b7f59de
      Michael Ellerman authored
      Currently building the powerpc selftests with USERCFLAGS set to anything
      causes the build to break:
      
        $ make -C tools/testing/selftests/powerpc V=1 USERCFLAGS=-Wno-error
        ...
        gcc -Wno-error    cache_shape.c ...
        cache_shape.c:18:10: fatal error: utils.h: No such file or directory
           18 | #include "utils.h"
              |          ^~~~~~~~~
        compilation terminated.
      
      This happens because the USERCFLAGS are added to CFLAGS in lib.mk, which
      causes the check of CFLAGS in powerpc/flags.mk to skip setting CFLAGS at
      all, resulting in none of the usual CFLAGS being passed. That can
      be seen in the output above, the only flag passed to the compiler is
      -Wno-error.
      
      Fix it by dropping the conditional setting of CFLAGS in flags.mk.
      Instead always set CFLAGS, but also append USERCFLAGS if they are set.
      
      Note that appending to CFLAGS (with +=) wouldn't work, because flags.mk
      is included by multiple Makefiles (to support partial builds), causing
      CFLAGS to be appended to multiple times. Additionally that would place
      the USERCFLAGS prior to the standard CFLAGS, meaning the USERCFLAGS
      couldn't override the standard flags. Being able to override the
      standard flags is desirable, for example for adding -Wno-error.
      
      With the fix in place, the CFLAGS are set correctly, including the
      USERCFLAGS:
      
        $ make -C tools/testing/selftests/powerpc V=1 USERCFLAGS=-Wno-error
        ...
        gcc -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"v6.10-rc2-7-gdea17e7e56c3"'
        -I/home/michael/linux/tools/testing/selftests/powerpc/include -Wno-error
        cache_shape.c ...
      
      Fixes: 5553a793 ("selftests/powerpc: Add flags.mk to support pmu buildable")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20240706120833.909853-1-mpe@ellerman.id.au
      8b7f59de
  4. 05 Jul, 2024 11 commits
  5. 04 Jul, 2024 13 commits