lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202001110746.p7zKbJlw%lkp@intel.com>
Date:   Sat, 11 Jan 2020 07:10:52 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Alex Shi <alex.shi@...ux.alibaba.com>
Cc:     kbuild-all@...ts.01.org, Paolo Bonzini <pbonzini@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Frederic Weisbecker <frederic@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: remove unused guest_enter/exit

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on kvm/linux-next]
[also build test ERROR on linux/master linus/master v5.5-rc5 next-20200110]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Alex-Shi/KVM-remove-unused-guest_enter-exit/20200111-004903
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: powerpc-ppc64_defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   arch/powerpc/kvm/book3s_hv.c: In function 'kvmppc_run_core':
>> arch/powerpc/kvm/book3s_hv.c:3360:2: error: implicit declaration of function 'guest_exit'; did you mean 'user_exit'? [-Werror=implicit-function-declaration]
     guest_exit();
     ^~~~~~~~~~
     user_exit
   cc1: all warnings being treated as errors

vim +3360 arch/powerpc/kvm/book3s_hv.c

8b24e69fc47e43 Paul Mackerras       2017-06-26  3040  
371fefd6f2dc46 Paul Mackerras       2011-06-29  3041  /*
371fefd6f2dc46 Paul Mackerras       2011-06-29  3042   * Run a set of guest threads on a physical core.
371fefd6f2dc46 Paul Mackerras       2011-06-29  3043   * Called with vc->lock held.
371fefd6f2dc46 Paul Mackerras       2011-06-29  3044   */
66feed61cdf6ee Paul Mackerras       2015-03-28  3045  static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
371fefd6f2dc46 Paul Mackerras       2011-06-29  3046  {
7b5f8272c792d4 Suraj Jitindar Singh 2016-08-02  3047  	struct kvm_vcpu *vcpu;
d911f0beddc2a9 Paul Mackerras       2015-03-28  3048  	int i;
2c9097e4c13402 Paul Mackerras       2012-09-11  3049  	int srcu_idx;
ec257165082616 Paul Mackerras       2015-06-24  3050  	struct core_info core_info;
898b25b202f350 Paul Mackerras       2017-06-22  3051  	struct kvmppc_vcore *pvc;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3052  	struct kvm_split_mode split_info, *sip;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3053  	int split, subcore_size, active;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3054  	int sub;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3055  	bool thr0_done;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3056  	unsigned long cmd_bit, stat_bit;
ec257165082616 Paul Mackerras       2015-06-24  3057  	int pcpu, thr;
ec257165082616 Paul Mackerras       2015-06-24  3058  	int target_threads;
45c940ba490df2 Paul Mackerras       2016-11-18  3059  	int controlled_threads;
8b24e69fc47e43 Paul Mackerras       2017-06-26  3060  	int trap;
516f7898ae20d9 Paul Mackerras       2017-10-16  3061  	bool is_power8;
c01015091a7703 Paul Mackerras       2017-10-19  3062  	bool hpt_on_radix;
371fefd6f2dc46 Paul Mackerras       2011-06-29  3063  
d911f0beddc2a9 Paul Mackerras       2015-03-28  3064  	/*
d911f0beddc2a9 Paul Mackerras       2015-03-28  3065  	 * Remove from the list any threads that have a signal pending
d911f0beddc2a9 Paul Mackerras       2015-03-28  3066  	 * or need a VPA update done
d911f0beddc2a9 Paul Mackerras       2015-03-28  3067  	 */
d911f0beddc2a9 Paul Mackerras       2015-03-28  3068  	prepare_threads(vc);
d911f0beddc2a9 Paul Mackerras       2015-03-28  3069  
d911f0beddc2a9 Paul Mackerras       2015-03-28  3070  	/* if the runner is no longer runnable, let the caller pick a new one */
d911f0beddc2a9 Paul Mackerras       2015-03-28  3071  	if (vc->runner->arch.state != KVMPPC_VCPU_RUNNABLE)
913d3ff9a3c3a1 Paul Mackerras       2012-10-15  3072  		return;
081f323bd3cc3a Paul Mackerras       2012-06-01  3073  
081f323bd3cc3a Paul Mackerras       2012-06-01  3074  	/*
d911f0beddc2a9 Paul Mackerras       2015-03-28  3075  	 * Initialize *vc.
081f323bd3cc3a Paul Mackerras       2012-06-01  3076  	 */
898b25b202f350 Paul Mackerras       2017-06-22  3077  	init_vcore_to_run(vc);
2711e248a352d7 Paul Mackerras       2014-12-04  3078  	vc->preempt_tb = TB_NIL;
081f323bd3cc3a Paul Mackerras       2012-06-01  3079  
45c940ba490df2 Paul Mackerras       2016-11-18  3080  	/*
45c940ba490df2 Paul Mackerras       2016-11-18  3081  	 * Number of threads that we will be controlling: the same as
45c940ba490df2 Paul Mackerras       2016-11-18  3082  	 * the number of threads per subcore, except on POWER9,
45c940ba490df2 Paul Mackerras       2016-11-18  3083  	 * where it's 1 because the threads are (mostly) independent.
45c940ba490df2 Paul Mackerras       2016-11-18  3084  	 */
516f7898ae20d9 Paul Mackerras       2017-10-16  3085  	controlled_threads = threads_per_vcore(vc->kvm);
45c940ba490df2 Paul Mackerras       2016-11-18  3086  
7b444c6710c6c4 Paul Mackerras       2012-10-15  3087  	/*
3102f7843c7501 Michael Ellerman     2014-05-23  3088  	 * Make sure we are running on primary threads, and that secondary
3102f7843c7501 Michael Ellerman     2014-05-23  3089  	 * threads are offline.  Also check if the number of threads in this
3102f7843c7501 Michael Ellerman     2014-05-23  3090  	 * guest are greater than the current system threads per guest.
c01015091a7703 Paul Mackerras       2017-10-19  3091  	 * On POWER9, we need to be not in independent-threads mode if
00608e1f007e4c Paul Mackerras       2018-01-11  3092  	 * this is a HPT guest on a radix host machine where the
00608e1f007e4c Paul Mackerras       2018-01-11  3093  	 * CPU threads may not be in different MMU modes.
7b444c6710c6c4 Paul Mackerras       2012-10-15  3094  	 */
00608e1f007e4c Paul Mackerras       2018-01-11  3095  	hpt_on_radix = no_mixing_hpt_and_radix && radix_enabled() &&
00608e1f007e4c Paul Mackerras       2018-01-11  3096  		!kvm_is_radix(vc->kvm);
c01015091a7703 Paul Mackerras       2017-10-19  3097  	if (((controlled_threads > 1) &&
c01015091a7703 Paul Mackerras       2017-10-19  3098  	     ((vc->num_threads > threads_per_subcore) || !on_primary_thread())) ||
c01015091a7703 Paul Mackerras       2017-10-19  3099  	    (hpt_on_radix && vc->kvm->arch.threads_indep)) {
7b5f8272c792d4 Suraj Jitindar Singh 2016-08-02  3100  		for_each_runnable_thread(i, vcpu, vc) {
7b444c6710c6c4 Paul Mackerras       2012-10-15  3101  			vcpu->arch.ret = -EBUSY;
25fedfca94cfbf Paul Mackerras       2015-03-28  3102  			kvmppc_remove_runnable(vc, vcpu);
25fedfca94cfbf Paul Mackerras       2015-03-28  3103  			wake_up(&vcpu->arch.cpu_run);
25fedfca94cfbf Paul Mackerras       2015-03-28  3104  		}
7b444c6710c6c4 Paul Mackerras       2012-10-15  3105  		goto out;
7b444c6710c6c4 Paul Mackerras       2012-10-15  3106  	}
7b444c6710c6c4 Paul Mackerras       2012-10-15  3107  
ec257165082616 Paul Mackerras       2015-06-24  3108  	/*
ec257165082616 Paul Mackerras       2015-06-24  3109  	 * See if we could run any other vcores on the physical core
ec257165082616 Paul Mackerras       2015-06-24  3110  	 * along with this one.
ec257165082616 Paul Mackerras       2015-06-24  3111  	 */
ec257165082616 Paul Mackerras       2015-06-24  3112  	init_core_info(&core_info, vc);
ec257165082616 Paul Mackerras       2015-06-24  3113  	pcpu = smp_processor_id();
45c940ba490df2 Paul Mackerras       2016-11-18  3114  	target_threads = controlled_threads;
ec257165082616 Paul Mackerras       2015-06-24  3115  	if (target_smt_mode && target_smt_mode < target_threads)
ec257165082616 Paul Mackerras       2015-06-24  3116  		target_threads = target_smt_mode;
ec257165082616 Paul Mackerras       2015-06-24  3117  	if (vc->num_threads < target_threads)
ec257165082616 Paul Mackerras       2015-06-24  3118  		collect_piggybacks(&core_info, target_threads);
3102f7843c7501 Michael Ellerman     2014-05-23  3119  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3120  	/*
8b24e69fc47e43 Paul Mackerras       2017-06-26  3121  	 * On radix, arrange for TLB flushing if necessary.
8b24e69fc47e43 Paul Mackerras       2017-06-26  3122  	 * This has to be done before disabling interrupts since
8b24e69fc47e43 Paul Mackerras       2017-06-26  3123  	 * it uses smp_call_function().
8b24e69fc47e43 Paul Mackerras       2017-06-26  3124  	 */
8b24e69fc47e43 Paul Mackerras       2017-06-26  3125  	pcpu = smp_processor_id();
8b24e69fc47e43 Paul Mackerras       2017-06-26  3126  	if (kvm_is_radix(vc->kvm)) {
8b24e69fc47e43 Paul Mackerras       2017-06-26  3127  		for (sub = 0; sub < core_info.n_subcores; ++sub)
8b24e69fc47e43 Paul Mackerras       2017-06-26  3128  			for_each_runnable_thread(i, vcpu, core_info.vc[sub])
8b24e69fc47e43 Paul Mackerras       2017-06-26  3129  				kvmppc_prepare_radix_vcpu(vcpu, pcpu);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3130  	}
8b24e69fc47e43 Paul Mackerras       2017-06-26  3131  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3132  	/*
8b24e69fc47e43 Paul Mackerras       2017-06-26  3133  	 * Hard-disable interrupts, and check resched flag and signals.
8b24e69fc47e43 Paul Mackerras       2017-06-26  3134  	 * If we need to reschedule or deliver a signal, clean up
8b24e69fc47e43 Paul Mackerras       2017-06-26  3135  	 * and return without going into the guest(s).
072df8130c6b60 Paul Mackerras       2017-11-09  3136  	 * If the mmu_ready flag has been cleared, don't go into the
38c53af853069a Paul Mackerras       2017-11-08  3137  	 * guest because that means a HPT resize operation is in progress.
8b24e69fc47e43 Paul Mackerras       2017-06-26  3138  	 */
8b24e69fc47e43 Paul Mackerras       2017-06-26  3139  	local_irq_disable();
8b24e69fc47e43 Paul Mackerras       2017-06-26  3140  	hard_irq_disable();
8b24e69fc47e43 Paul Mackerras       2017-06-26  3141  	if (lazy_irq_pending() || need_resched() ||
d28eafc5a64045 Paul Mackerras       2019-08-27  3142  	    recheck_signals_and_mmu(&core_info)) {
8b24e69fc47e43 Paul Mackerras       2017-06-26  3143  		local_irq_enable();
8b24e69fc47e43 Paul Mackerras       2017-06-26  3144  		vc->vcore_state = VCORE_INACTIVE;
8b24e69fc47e43 Paul Mackerras       2017-06-26  3145  		/* Unlock all except the primary vcore */
8b24e69fc47e43 Paul Mackerras       2017-06-26  3146  		for (sub = 1; sub < core_info.n_subcores; ++sub) {
8b24e69fc47e43 Paul Mackerras       2017-06-26  3147  			pvc = core_info.vc[sub];
8b24e69fc47e43 Paul Mackerras       2017-06-26  3148  			/* Put back on to the preempted vcores list */
8b24e69fc47e43 Paul Mackerras       2017-06-26  3149  			kvmppc_vcore_preempt(pvc);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3150  			spin_unlock(&pvc->lock);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3151  		}
8b24e69fc47e43 Paul Mackerras       2017-06-26  3152  		for (i = 0; i < controlled_threads; ++i)
8b24e69fc47e43 Paul Mackerras       2017-06-26  3153  			kvmppc_release_hwthread(pcpu + i);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3154  		return;
8b24e69fc47e43 Paul Mackerras       2017-06-26  3155  	}
8b24e69fc47e43 Paul Mackerras       2017-06-26  3156  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3157  	kvmppc_clear_host_core(pcpu);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3158  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3159  	/* Decide on micro-threading (split-core) mode */
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3160  	subcore_size = threads_per_subcore;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3161  	cmd_bit = stat_bit = 0;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3162  	split = core_info.n_subcores;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3163  	sip = NULL;
516f7898ae20d9 Paul Mackerras       2017-10-16  3164  	is_power8 = cpu_has_feature(CPU_FTR_ARCH_207S)
516f7898ae20d9 Paul Mackerras       2017-10-16  3165  		&& !cpu_has_feature(CPU_FTR_ARCH_300);
516f7898ae20d9 Paul Mackerras       2017-10-16  3166  
c01015091a7703 Paul Mackerras       2017-10-19  3167  	if (split > 1 || hpt_on_radix) {
516f7898ae20d9 Paul Mackerras       2017-10-16  3168  		sip = &split_info;
516f7898ae20d9 Paul Mackerras       2017-10-16  3169  		memset(&split_info, 0, sizeof(split_info));
516f7898ae20d9 Paul Mackerras       2017-10-16  3170  		for (sub = 0; sub < core_info.n_subcores; ++sub)
516f7898ae20d9 Paul Mackerras       2017-10-16  3171  			split_info.vc[sub] = core_info.vc[sub];
516f7898ae20d9 Paul Mackerras       2017-10-16  3172  
516f7898ae20d9 Paul Mackerras       2017-10-16  3173  		if (is_power8) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3174  			if (split == 2 && (dynamic_mt_modes & 2)) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3175  				cmd_bit = HID0_POWER8_1TO2LPAR;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3176  				stat_bit = HID0_POWER8_2LPARMODE;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3177  			} else {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3178  				split = 4;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3179  				cmd_bit = HID0_POWER8_1TO4LPAR;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3180  				stat_bit = HID0_POWER8_4LPARMODE;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3181  			}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3182  			subcore_size = MAX_SMT_THREADS / split;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3183  			split_info.rpr = mfspr(SPRN_RPR);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3184  			split_info.pmmar = mfspr(SPRN_PMMAR);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3185  			split_info.ldbar = mfspr(SPRN_LDBAR);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3186  			split_info.subcore_size = subcore_size;
516f7898ae20d9 Paul Mackerras       2017-10-16  3187  		} else {
516f7898ae20d9 Paul Mackerras       2017-10-16  3188  			split_info.subcore_size = 1;
c01015091a7703 Paul Mackerras       2017-10-19  3189  			if (hpt_on_radix) {
c01015091a7703 Paul Mackerras       2017-10-19  3190  				/* Use the split_info for LPCR/LPIDR changes */
c01015091a7703 Paul Mackerras       2017-10-19  3191  				split_info.lpcr_req = vc->lpcr;
c01015091a7703 Paul Mackerras       2017-10-19  3192  				split_info.lpidr_req = vc->kvm->arch.lpid;
c01015091a7703 Paul Mackerras       2017-10-19  3193  				split_info.host_lpcr = vc->kvm->arch.host_lpcr;
c01015091a7703 Paul Mackerras       2017-10-19  3194  				split_info.do_set = 1;
c01015091a7703 Paul Mackerras       2017-10-19  3195  			}
516f7898ae20d9 Paul Mackerras       2017-10-16  3196  		}
516f7898ae20d9 Paul Mackerras       2017-10-16  3197  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3198  		/* order writes to split_info before kvm_split_mode pointer */
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3199  		smp_wmb();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3200  	}
c01015091a7703 Paul Mackerras       2017-10-19  3201  
c01015091a7703 Paul Mackerras       2017-10-19  3202  	for (thr = 0; thr < controlled_threads; ++thr) {
d2e60075a3d442 Nicholas Piggin      2018-02-14  3203  		struct paca_struct *paca = paca_ptrs[pcpu + thr];
d2e60075a3d442 Nicholas Piggin      2018-02-14  3204  
d2e60075a3d442 Nicholas Piggin      2018-02-14  3205  		paca->kvm_hstate.tid = thr;
d2e60075a3d442 Nicholas Piggin      2018-02-14  3206  		paca->kvm_hstate.napping = 0;
d2e60075a3d442 Nicholas Piggin      2018-02-14  3207  		paca->kvm_hstate.kvm_split_mode = sip;
c01015091a7703 Paul Mackerras       2017-10-19  3208  	}
3102f7843c7501 Michael Ellerman     2014-05-23  3209  
516f7898ae20d9 Paul Mackerras       2017-10-16  3210  	/* Initiate micro-threading (split-core) on POWER8 if required */
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3211  	if (cmd_bit) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3212  		unsigned long hid0 = mfspr(SPRN_HID0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3213  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3214  		hid0 |= cmd_bit | HID0_POWER8_DYNLPARDIS;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3215  		mb();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3216  		mtspr(SPRN_HID0, hid0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3217  		isync();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3218  		for (;;) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3219  			hid0 = mfspr(SPRN_HID0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3220  			if (hid0 & stat_bit)
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3221  				break;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3222  			cpu_relax();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3223  		}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3224  	}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3225  
7aa15842c15f8a Paul Mackerras       2018-04-20  3226  	/*
7aa15842c15f8a Paul Mackerras       2018-04-20  3227  	 * On POWER8, set RWMR register.
7aa15842c15f8a Paul Mackerras       2018-04-20  3228  	 * Since it only affects PURR and SPURR, it doesn't affect
7aa15842c15f8a Paul Mackerras       2018-04-20  3229  	 * the host, so we don't save/restore the host value.
7aa15842c15f8a Paul Mackerras       2018-04-20  3230  	 */
7aa15842c15f8a Paul Mackerras       2018-04-20  3231  	if (is_power8) {
7aa15842c15f8a Paul Mackerras       2018-04-20  3232  		unsigned long rwmr_val = RWMR_RPA_P8_8THREAD;
7aa15842c15f8a Paul Mackerras       2018-04-20  3233  		int n_online = atomic_read(&vc->online_count);
7aa15842c15f8a Paul Mackerras       2018-04-20  3234  
7aa15842c15f8a Paul Mackerras       2018-04-20  3235  		/*
7aa15842c15f8a Paul Mackerras       2018-04-20  3236  		 * Use the 8-thread value if we're doing split-core
7aa15842c15f8a Paul Mackerras       2018-04-20  3237  		 * or if the vcore's online count looks bogus.
7aa15842c15f8a Paul Mackerras       2018-04-20  3238  		 */
7aa15842c15f8a Paul Mackerras       2018-04-20  3239  		if (split == 1 && threads_per_subcore == MAX_SMT_THREADS &&
7aa15842c15f8a Paul Mackerras       2018-04-20  3240  		    n_online >= 1 && n_online <= MAX_SMT_THREADS)
7aa15842c15f8a Paul Mackerras       2018-04-20  3241  			rwmr_val = p8_rwmr_values[n_online];
7aa15842c15f8a Paul Mackerras       2018-04-20  3242  		mtspr(SPRN_RWMR, rwmr_val);
7aa15842c15f8a Paul Mackerras       2018-04-20  3243  	}
7aa15842c15f8a Paul Mackerras       2018-04-20  3244  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3245  	/* Start all the threads */
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3246  	active = 0;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3247  	for (sub = 0; sub < core_info.n_subcores; ++sub) {
516f7898ae20d9 Paul Mackerras       2017-10-16  3248  		thr = is_power8 ? subcore_thread_map[sub] : sub;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3249  		thr0_done = false;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3250  		active |= 1 << thr;
898b25b202f350 Paul Mackerras       2017-06-22  3251  		pvc = core_info.vc[sub];
ec257165082616 Paul Mackerras       2015-06-24  3252  		pvc->pcpu = pcpu + thr;
7b5f8272c792d4 Suraj Jitindar Singh 2016-08-02  3253  		for_each_runnable_thread(i, vcpu, pvc) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3254  			kvmppc_start_thread(vcpu, pvc);
ec257165082616 Paul Mackerras       2015-06-24  3255  			kvmppc_create_dtl_entry(vcpu, pvc);
3c78f78af95615 Suresh E. Warrier    2014-12-03  3256  			trace_kvm_guest_enter(vcpu);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3257  			if (!vcpu->arch.ptid)
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3258  				thr0_done = true;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3259  			active |= 1 << (thr + vcpu->arch.ptid);
2e25aa5f64b18a Paul Mackerras       2012-02-19  3260  		}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3261  		/*
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3262  		 * We need to start the first thread of each subcore
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3263  		 * even if it doesn't have a vcpu.
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3264  		 */
898b25b202f350 Paul Mackerras       2017-06-22  3265  		if (!thr0_done)
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3266  			kvmppc_start_thread(NULL, pvc);
ec257165082616 Paul Mackerras       2015-06-24  3267  	}
de56a948b9182f Paul Mackerras       2011-06-29  3268  
7f23532866f931 Gautham R. Shenoy    2015-09-02  3269  	/*
7f23532866f931 Gautham R. Shenoy    2015-09-02  3270  	 * Ensure that split_info.do_nap is set after setting
7f23532866f931 Gautham R. Shenoy    2015-09-02  3271  	 * the vcore pointer in the PACA of the secondaries.
7f23532866f931 Gautham R. Shenoy    2015-09-02  3272  	 */
7f23532866f931 Gautham R. Shenoy    2015-09-02  3273  	smp_mb();
7f23532866f931 Gautham R. Shenoy    2015-09-02  3274  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3275  	/*
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3276  	 * When doing micro-threading, poke the inactive threads as well.
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3277  	 * This gets them to the nap instruction after kvm_do_nap,
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3278  	 * which reduces the time taken to unsplit later.
c01015091a7703 Paul Mackerras       2017-10-19  3279  	 * For POWER9 HPT guest on radix host, we need all the secondary
c01015091a7703 Paul Mackerras       2017-10-19  3280  	 * threads woken up so they can do the LPCR/LPIDR change.
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3281  	 */
c01015091a7703 Paul Mackerras       2017-10-19  3282  	if (cmd_bit || hpt_on_radix) {
516f7898ae20d9 Paul Mackerras       2017-10-16  3283  		split_info.do_nap = 1;	/* ask secondaries to nap when done */
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3284  		for (thr = 1; thr < threads_per_subcore; ++thr)
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3285  			if (!(active & (1 << thr)))
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3286  				kvmppc_ipi_thread(pcpu + thr);
516f7898ae20d9 Paul Mackerras       2017-10-16  3287  	}
e0b7ec058c0eb7 Paul Mackerras       2014-01-08  3288  
2f12f03436847e Paul Mackerras       2012-10-15  3289  	vc->vcore_state = VCORE_RUNNING;
19ccb76a1938ab Paul Mackerras       2011-07-23  3290  	preempt_disable();
3c78f78af95615 Suresh E. Warrier    2014-12-03  3291  
3c78f78af95615 Suresh E. Warrier    2014-12-03  3292  	trace_kvmppc_run_core(vc, 0);
3c78f78af95615 Suresh E. Warrier    2014-12-03  3293  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3294  	for (sub = 0; sub < core_info.n_subcores; ++sub)
898b25b202f350 Paul Mackerras       2017-06-22  3295  		spin_unlock(&core_info.vc[sub]->lock);
371fefd6f2dc46 Paul Mackerras       2011-06-29  3296  
61bd0f66ff92d5 Laurent Vivier       2018-03-02  3297  	guest_enter_irqoff();
2c9097e4c13402 Paul Mackerras       2012-09-11  3298  
e0b7ec058c0eb7 Paul Mackerras       2014-01-08  3299  	srcu_idx = srcu_read_lock(&vc->kvm->srcu);
2c9097e4c13402 Paul Mackerras       2012-09-11  3300  
a4bc64d305af40 Naveen N. Rao        2018-04-19  3301  	this_cpu_disable_ftrace();
a4bc64d305af40 Naveen N. Rao        2018-04-19  3302  
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3303  	/*
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3304  	 * Interrupts will be enabled once we get into the guest,
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3305  	 * so tell lockdep that we're about to enable interrupts.
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3306  	 */
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3307  	trace_hardirqs_on();
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3308  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3309  	trap = __kvmppc_vcore_entry();
de56a948b9182f Paul Mackerras       2011-06-29  3310  
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3311  	trace_hardirqs_off();
3309bec85e60d6 Alexey Kardashevskiy 2019-03-29  3312  
a4bc64d305af40 Naveen N. Rao        2018-04-19  3313  	this_cpu_enable_ftrace();
a4bc64d305af40 Naveen N. Rao        2018-04-19  3314  
ec257165082616 Paul Mackerras       2015-06-24  3315  	srcu_read_unlock(&vc->kvm->srcu, srcu_idx);
ec257165082616 Paul Mackerras       2015-06-24  3316  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3317  	set_irq_happened(trap);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3318  
ec257165082616 Paul Mackerras       2015-06-24  3319  	spin_lock(&vc->lock);
371fefd6f2dc46 Paul Mackerras       2011-06-29  3320  	/* prevent other vcpu threads from doing kvmppc_start_thread() now */
19ccb76a1938ab Paul Mackerras       2011-07-23  3321  	vc->vcore_state = VCORE_EXITING;
371fefd6f2dc46 Paul Mackerras       2011-06-29  3322  
19ccb76a1938ab Paul Mackerras       2011-07-23  3323  	/* wait for secondary threads to finish writing their state to memory */
516f7898ae20d9 Paul Mackerras       2017-10-16  3324  	kvmppc_wait_for_nap(controlled_threads);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3325  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3326  	/* Return to whole-core mode if we split the core earlier */
516f7898ae20d9 Paul Mackerras       2017-10-16  3327  	if (cmd_bit) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3328  		unsigned long hid0 = mfspr(SPRN_HID0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3329  		unsigned long loops = 0;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3330  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3331  		hid0 &= ~HID0_POWER8_DYNLPARDIS;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3332  		stat_bit = HID0_POWER8_2LPARMODE | HID0_POWER8_4LPARMODE;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3333  		mb();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3334  		mtspr(SPRN_HID0, hid0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3335  		isync();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3336  		for (;;) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3337  			hid0 = mfspr(SPRN_HID0);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3338  			if (!(hid0 & stat_bit))
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3339  				break;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3340  			cpu_relax();
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3341  			++loops;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3342  		}
c01015091a7703 Paul Mackerras       2017-10-19  3343  	} else if (hpt_on_radix) {
c01015091a7703 Paul Mackerras       2017-10-19  3344  		/* Wait for all threads to have seen final sync */
c01015091a7703 Paul Mackerras       2017-10-19  3345  		for (thr = 1; thr < controlled_threads; ++thr) {
d2e60075a3d442 Nicholas Piggin      2018-02-14  3346  			struct paca_struct *paca = paca_ptrs[pcpu + thr];
d2e60075a3d442 Nicholas Piggin      2018-02-14  3347  
d2e60075a3d442 Nicholas Piggin      2018-02-14  3348  			while (paca->kvm_hstate.kvm_split_mode) {
c01015091a7703 Paul Mackerras       2017-10-19  3349  				HMT_low();
c01015091a7703 Paul Mackerras       2017-10-19  3350  				barrier();
c01015091a7703 Paul Mackerras       2017-10-19  3351  			}
c01015091a7703 Paul Mackerras       2017-10-19  3352  			HMT_medium();
c01015091a7703 Paul Mackerras       2017-10-19  3353  		}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3354  	}
c01015091a7703 Paul Mackerras       2017-10-19  3355  	split_info.do_nap = 0;
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3356  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3357  	kvmppc_set_host_core(pcpu);
8b24e69fc47e43 Paul Mackerras       2017-06-26  3358  
8b24e69fc47e43 Paul Mackerras       2017-06-26  3359  	local_irq_enable();
61bd0f66ff92d5 Laurent Vivier       2018-03-02 @3360  	guest_exit();
8b24e69fc47e43 Paul Mackerras       2017-06-26  3361  
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3362  	/* Let secondaries go back to the offline loop */
45c940ba490df2 Paul Mackerras       2016-11-18  3363  	for (i = 0; i < controlled_threads; ++i) {
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3364  		kvmppc_release_hwthread(pcpu + i);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3365  		if (sip && sip->napped[i])
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3366  			kvmppc_ipi_thread(pcpu + i);
a29ebeaf5575d0 Paul Mackerras       2017-01-30  3367  		cpumask_clear_cpu(pcpu + i, &vc->kvm->arch.cpu_in_guest);
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3368  	}
b4deba5c41e9f6 Paul Mackerras       2015-07-02  3369  
371fefd6f2dc46 Paul Mackerras       2011-06-29  3370  	spin_unlock(&vc->lock);
2c9097e4c13402 Paul Mackerras       2012-09-11  3371  
371fefd6f2dc46 Paul Mackerras       2011-06-29  3372  	/* make sure updates to secondary vcpu structs are visible now */
371fefd6f2dc46 Paul Mackerras       2011-06-29  3373  	smp_mb();
de56a948b9182f Paul Mackerras       2011-06-29  3374  
36ee41d161c67a Paul Mackerras       2018-01-30  3375  	preempt_enable();
36ee41d161c67a Paul Mackerras       2018-01-30  3376  
898b25b202f350 Paul Mackerras       2017-06-22  3377  	for (sub = 0; sub < core_info.n_subcores; ++sub) {
898b25b202f350 Paul Mackerras       2017-06-22  3378  		pvc = core_info.vc[sub];
ec257165082616 Paul Mackerras       2015-06-24  3379  		post_guest_process(pvc, pvc == vc);
898b25b202f350 Paul Mackerras       2017-06-22  3380  	}
de56a948b9182f Paul Mackerras       2011-06-29  3381  
913d3ff9a3c3a1 Paul Mackerras       2012-10-15  3382  	spin_lock(&vc->lock);
de56a948b9182f Paul Mackerras       2011-06-29  3383  
de56a948b9182f Paul Mackerras       2011-06-29  3384   out:
19ccb76a1938ab Paul Mackerras       2011-07-23  3385  	vc->vcore_state = VCORE_INACTIVE;
3c78f78af95615 Suresh E. Warrier    2014-12-03  3386  	trace_kvmppc_run_core(vc, 1);
371fefd6f2dc46 Paul Mackerras       2011-06-29  3387  }
371fefd6f2dc46 Paul Mackerras       2011-06-29  3388  

:::::: The code at line 3360 was first introduced by commit
:::::: 61bd0f66ff92d5ce765ff9850fd3cbfec773c560 KVM: PPC: Book3S HV: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN

:::::: TO: Laurent Vivier <lvivier@...hat.com>
:::::: CC: Paul Mackerras <paulus@...abs.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (25639 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ