All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Nadav Amit <namit@vmware.com>, Wanpeng Li <wanpengli@tencent.com>
Subject: linux-next: manual merge of the kvm tree with the tip tree
Date: Thu, 22 Apr 2021 14:30:56 +1000	[thread overview]
Message-ID: <20210422143056.62a3fee4@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3518 bytes --]

Hi all,

Today's linux-next merge of the kvm tree got a conflict in:

  arch/x86/kernel/kvm.c

between commit:

  4ce94eabac16 ("x86/mm/tlb: Flush remote and local TLBs concurrently")

from the tip tree and commit:

  2b519b5797d4 ("x86/kvm: Don't bother __pv_cpu_mask when !CONFIG_SMP")

from the kvm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/kernel/kvm.c
index 5d32fa477a62,224a7a1ed6c3..000000000000
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@@ -574,6 -574,49 +574,54 @@@ static void kvm_smp_send_call_func_ipi(
  	}
  }
  
 -static void kvm_flush_tlb_others(const struct cpumask *cpumask,
++static void kvm_flush_tlb_multi(const struct cpumask *cpumask,
+ 			const struct flush_tlb_info *info)
+ {
+ 	u8 state;
+ 	int cpu;
+ 	struct kvm_steal_time *src;
+ 	struct cpumask *flushmask = this_cpu_cpumask_var_ptr(__pv_cpu_mask);
+ 
+ 	cpumask_copy(flushmask, cpumask);
+ 	/*
+ 	 * We have to call flush only on online vCPUs. And
+ 	 * queue flush_on_enter for pre-empted vCPUs
+ 	 */
+ 	for_each_cpu(cpu, flushmask) {
++		/*
++		 * The local vCPU is never preempted, so we do not explicitly
++		 * skip check for local vCPU - it will never be cleared from
++		 * flushmask.
++		 */
+ 		src = &per_cpu(steal_time, cpu);
+ 		state = READ_ONCE(src->preempted);
+ 		if ((state & KVM_VCPU_PREEMPTED)) {
+ 			if (try_cmpxchg(&src->preempted, &state,
+ 					state | KVM_VCPU_FLUSH_TLB))
+ 				__cpumask_clear_cpu(cpu, flushmask);
+ 		}
+ 	}
+ 
 -	native_flush_tlb_others(flushmask, info);
++	native_flush_tlb_multi(flushmask, info);
+ }
+ 
+ static __init int kvm_alloc_cpumask(void)
+ {
+ 	int cpu;
+ 
+ 	if (!kvm_para_available() || nopv)
+ 		return 0;
+ 
+ 	if (pv_tlb_flush_supported() || pv_ipi_supported())
+ 		for_each_possible_cpu(cpu) {
+ 			zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu),
+ 				GFP_KERNEL, cpu_to_node(cpu));
+ 		}
+ 
+ 	return 0;
+ }
+ arch_initcall(kvm_alloc_cpumask);
+ 
  static void __init kvm_smp_prepare_boot_cpu(void)
  {
  	/*
@@@ -655,15 -668,9 +673,9 @@@ static void __init kvm_guest_init(void
  
  	if (kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
  		has_steal_clock = 1;
 -		pv_ops.time.steal_clock = kvm_steal_clock;
 +		static_call_update(pv_steal_clock, kvm_steal_clock);
  	}
  
- 	if (pv_tlb_flush_supported()) {
- 		pv_ops.mmu.flush_tlb_multi = kvm_flush_tlb_multi;
- 		pv_ops.mmu.tlb_remove_table = tlb_remove_table;
- 		pr_info("KVM setup pv remote TLB flush\n");
- 	}
- 
  	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
  		apic_set_eoi_write(kvm_guest_apic_eoi_write);
  
@@@ -673,6 -680,12 +685,12 @@@
  	}
  
  #ifdef CONFIG_SMP
+ 	if (pv_tlb_flush_supported()) {
 -		pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others;
++		pv_ops.mmu.flush_tlb_multi = kvm_flush_tlb_multi;
+ 		pv_ops.mmu.tlb_remove_table = tlb_remove_table;
+ 		pr_info("KVM setup pv remote TLB flush\n");
+ 	}
+ 
  	smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
  	if (pv_sched_yield_supported()) {
  		smp_ops.send_call_func_ipi = kvm_smp_send_call_func_ipi;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-04-22  4:31 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  4:30 Stephen Rothwell [this message]
2021-04-22  4:45 ` linux-next: manual merge of the kvm tree with the tip tree Nadav Amit
2021-04-22  4:58   ` Stephen Rothwell
2021-04-22  6:29   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2023-01-18  0:32 Stephen Rothwell
2022-12-01  0:18 Stephen Rothwell
2022-12-01  0:14 Stephen Rothwell
2022-12-15 23:26 ` Stephen Rothwell
2022-01-10  2:16 Stephen Rothwell
2022-01-10  2:28 ` Like Xu
2021-12-13 17:46 broonie
2021-12-13 18:14 ` Paolo Bonzini
2021-12-13 18:23 ` Mark Brown
2021-10-25  5:11 Stephen Rothwell
2021-10-21  2:39 Stephen Rothwell
2021-10-21 15:32 ` Borislav Petkov
2020-07-29  6:47 Stephen Rothwell
2020-07-17  5:25 Stephen Rothwell
2020-06-02  4:53 Stephen Rothwell
2020-06-04  3:09 ` Stephen Rothwell
2020-01-16  2:48 Stephen Rothwell
2018-12-19  4:12 Stephen Rothwell
2018-12-17  5:22 Stephen Rothwell
2018-10-19  3:25 Stephen Rothwell
2018-08-08  3:54 Stephen Rothwell
2018-08-15  4:27 ` Stephen Rothwell
2018-08-06  5:12 Stephen Rothwell
2018-08-06  6:27 ` Tianyu Lan
2018-02-02  0:51 Stephen Rothwell
2018-01-15  2:39 Stephen Rothwell
2017-08-28  4:52 Stephen Rothwell
2017-09-04  6:09 ` Stephen Rothwell
2017-08-25  4:39 Stephen Rothwell
2017-08-25  6:39 ` Paolo Bonzini
2017-08-25 13:57   ` Tom Lendacky
2017-08-25 16:53     ` Brijesh Singh
2017-08-25 20:05       ` Paolo Bonzini
2017-08-25 20:41         ` Brijesh Singh
2017-08-25 20:42           ` Paolo Bonzini
2017-08-26  7:24             ` Ingo Molnar
2016-11-28  3:56 Stephen Rothwell
2016-11-17  3:50 Stephen Rothwell
2016-11-17  7:07 ` Thomas Gleixner
2016-11-17 21:31   ` Stephen Rothwell
2016-05-12  2:54 Stephen Rothwell
2016-05-12  2:54 ` Stephen Rothwell
2015-06-19  4:59 Michael Ellerman
2015-05-26  4:45 Stephen Rothwell
2012-11-30  4:26 Stephen Rothwell
2012-05-16  7:14 Stephen Rothwell
2012-05-16  7:53 ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210422143056.62a3fee4@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.