]> Git Repo - J-linux.git/commitdiff
Merge tag 'for-linus-6.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Wed, 22 Feb 2023 01:07:39 +0000 (17:07 -0800)
committerLinus Torvalds <[email protected]>
Wed, 22 Feb 2023 01:07:39 +0000 (17:07 -0800)
Pull xen updates from Juergen Gross:

 - help deprecate the /proc/xen files by making the related information
   available via sysfs

 - mark the Xen variants of play_dead "noreturn"

 - support a shared Xen platform interrupt

 - several small cleanups and fixes

* tag 'for-linus-6.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen: sysfs: make kobj_type structure constant
  x86/Xen: drop leftover VM-assist uses
  xen: Replace one-element array with flexible-array member
  xen/grant-dma-iommu: Implement a dummy probe_device() callback
  xen/pvcalls-back: fix permanently masked event channel
  xen: Allow platform PCI interrupt to be shared
  x86/xen/time: prefer tsc as clocksource when it is invariant
  x86/xen: mark xen_pv_play_dead() as __noreturn
  x86/xen: don't let xen_pv_play_dead() return
  drivers/xen/hypervisor: Expose Xen SIF flags to userspace

1  2 
arch/x86/xen/time.c
tools/objtool/check.c

diff --combined arch/x86/xen/time.c
index 6b8836deb7382f935cb7678f9485439508cb349d,95140609c8a8084930bbc68832cc3a7b46088928..1d597364b49dc3f9b7e8d259f1300181d4beab8e
@@@ -60,17 -60,9 +60,17 @@@ static u64 xen_clocksource_get_cycles(s
        return xen_clocksource_read();
  }
  
 -static u64 xen_sched_clock(void)
 +static noinstr u64 xen_sched_clock(void)
  {
 -      return xen_clocksource_read() - xen_sched_clock_offset;
 +        struct pvclock_vcpu_time_info *src;
 +      u64 ret;
 +
 +      preempt_disable_notrace();
 +      src = &__this_cpu_read(xen_vcpu)->time;
 +      ret = pvclock_clocksource_read_nowd(src);
 +      ret -= xen_sched_clock_offset;
 +      preempt_enable_notrace();
 +      return ret;
  }
  
  static void xen_read_wallclock(struct timespec64 *ts)
@@@ -482,15 -474,51 +482,51 @@@ static void xen_setup_vsyscall_time_inf
        xen_clocksource.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
  }
  
+ /*
+  * Check if it is possible to safely use the tsc as a clocksource.  This is
+  * only true if the hypervisor notifies the guest that its tsc is invariant,
+  * the tsc is stable, and the tsc instruction will never be emulated.
+  */
+ static int __init xen_tsc_safe_clocksource(void)
+ {
+       u32 eax, ebx, ecx, edx;
+       if (!(boot_cpu_has(X86_FEATURE_CONSTANT_TSC)))
+               return 0;
+       if (!(boot_cpu_has(X86_FEATURE_NONSTOP_TSC)))
+               return 0;
+       if (check_tsc_unstable())
+               return 0;
+       /* Leaf 4, sub-leaf 0 (0x40000x03) */
+       cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);
+       /* tsc_mode = no_emulate (2) */
+       if (ebx != 2)
+               return 0;
+       return 1;
+ }
  static void __init xen_time_init(void)
  {
        struct pvclock_vcpu_time_info *pvti;
        int cpu = smp_processor_id();
        struct timespec64 tp;
  
-       /* As Dom0 is never moved, no penalty on using TSC there */
+       /*
+        * As Dom0 is never moved, no penalty on using TSC there.
+        *
+        * If it is possible for the guest to determine that the tsc is a safe
+        * clocksource, then set xen_clocksource rating below that of the tsc
+        * so that the system prefers tsc instead.
+        */
        if (xen_initial_domain())
                xen_clocksource.rating = 275;
+       else if (xen_tsc_safe_clocksource())
+               xen_clocksource.rating = 299;
  
        clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
  
diff --combined tools/objtool/check.c
index b118f588cd2b15b780b0cec64e46382b2b1cd5a5,68e87b45caefc6c49b73a27098b5e4a2d6942f0f..94b518c12f9afe3fe577b9937bb4f8521b4e8453
@@@ -186,6 -186,7 +186,7 @@@ static bool __dead_end_function(struct 
                "snp_abort",
                "stop_this_cpu",
                "usercopy_abort",
+               "xen_cpu_bringup_again",
                "xen_start_kernel",
        };
  
@@@ -376,7 -377,6 +377,7 @@@ static int decode_instructions(struct o
  
                if (!strcmp(sec->name, ".noinstr.text") ||
                    !strcmp(sec->name, ".entry.text") ||
 +                  !strcmp(sec->name, ".cpuidle.text") ||
                    !strncmp(sec->name, ".text.__x86.", 12))
                        sec->noinstr = true;
  
@@@ -1225,7 -1225,6 +1226,7 @@@ static const char *uaccess_safe_builtin
        "__ubsan_handle_type_mismatch",
        "__ubsan_handle_type_mismatch_v1",
        "__ubsan_handle_shift_out_of_bounds",
 +      "__ubsan_handle_load_invalid_value",
        /* misc */
        "csum_partial_copy_generic",
        "copy_mc_fragile",
@@@ -3376,12 -3375,6 +3377,12 @@@ static inline bool noinstr_call_dest(st
        if (func->sec->noinstr)
                return true;
  
 +      /*
 +       * If the symbol is a static_call trampoline, we can't tell.
 +       */
 +      if (func->static_call_tramp)
 +              return true;
 +
        /*
         * The __ubsan_handle_*() calls are like WARN(), they only happen when
         * something 'BAD' happened. At the risk of taking the machine down,
@@@ -4179,12 -4172,6 +4180,12 @@@ static int validate_noinstr_sections(st
                warnings += validate_unwind_hints(file, sec);
        }
  
 +      sec = find_section_by_name(file->elf, ".cpuidle.text");
 +      if (sec) {
 +              warnings += validate_section(file, sec);
 +              warnings += validate_unwind_hints(file, sec);
 +      }
 +
        return warnings;
  }
  
This page took 0.085795 seconds and 4 git commands to generate.