Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1716881pxj; Wed, 19 May 2021 12:12:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvMBUh7rQvJMwWLcK8Hgwy9sfDK5l6GOxvNHTmhvhu10o5ND4DyQV3UaB++xpV3B1wBk89 X-Received: by 2002:a05:6402:19b9:: with SMTP id o25mr594187edz.192.1621451568944; Wed, 19 May 2021 12:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621451568; cv=none; d=google.com; s=arc-20160816; b=SyepBzoVZQ9FK82Z8GI8UnEvbcJ2GU6Msz4vgjcorcO5Z9BuuGNLDvDLPUYC3EzdQz PjKv5YWviwGU/Qx+Bf0cb+iKQUIApN5yn1AmnCEN3GJfAGYov0+mDkn+Zb7fXz7b9Z47 a8VVYAvRtdFzTJD9oUmuyZ7Hs8cj8Z8b8bYahEc6QeS50gBXFpl7QQccXmsqqHNqdGpW I1YcrjvqVuUUc0qZbx1FhWisAyGN5gNwp/04y8wthgltnpJRht7dnxxwsWfrQKWXmkSo MRcOSRIA10WHf8702ZG0EuAmY/P50r+Ohfr45L+MG40uKl9Q3uRLVzSoNPdm9s8A/ZwN Zwjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=WisXtde/q10+/mSfq+TvmzKeq51FFU/gkFOYMyuAJoo=; b=KEhQ7Ya6oHb2s9MqWN9m3N0frE5UR9CygRz927tFkgmLpT3CRTn1/Cplbb5qy47lIJ TA0XWAyXoCS7j87CRGRhrG/HO+sRTaUvF5uVo/qtxkpcYAAEshXeB1aPwB49XJ7d8g5I CpXFYtF0+KKOBUnAFibkFQ2hlsLGekHTi5yA5G1FYs8jBQ6T/FxFMW6RFAgU3xWE1OhX fOfsKNTFUhVXumoTjDglYMPKglAbVQk/Ednm0ksRmdH5v68dbWpQLz8YkUvNhiSWaR7D 3ohYow9qe+f6MKB0v/ZplLKjSSwA7Fh0jfFk8OLr7eJGu6b5ey32gedtOfh1VLRPty0C 1NuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si126627edt.42.2021.05.19.12.12.24; Wed, 19 May 2021 12:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbhESFLc (ORCPT + 99 others); Wed, 19 May 2021 01:11:32 -0400 Received: from mga18.intel.com ([134.134.136.126]:53831 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbhESFLb (ORCPT ); Wed, 19 May 2021 01:11:31 -0400 IronPort-SDR: SRczaqCZ8cDW24OGELxYBGkU2ba72VKe6Q0pOOm6F5ksm2lfoT79nkTa8bpJNFif99GEL87uXM QbFITeh1vJFQ== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="188302708" X-IronPort-AV: E=Sophos;i="5.82,311,1613462400"; d="scan'208";a="188302708" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 22:10:12 -0700 IronPort-SDR: CXRD1DRSQUGsL/YALgRnMnL3+AeRmzLgYV3ZfiQNUPiG3W09hZ5apStdfTZsXX4aMRE/OzbjIA nzPi3g0v9dTw== X-IronPort-AV: E=Sophos;i="5.82,311,1613462400"; d="scan'208";a="473309301" Received: from xsang-optiplex-9020.sh.intel.com (HELO xsang-OptiPlex-9020) ([10.239.159.140]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 22:10:08 -0700 Date: Wed, 19 May 2021 13:27:00 +0800 From: Oliver Sang To: Peter Zijlstra Cc: Frederic Weisbecker , "Paul E. McKenney" , Ingo Molnar , LKML , lkp@lists.01.org, lkp@intel.com, ying.huang@intel.com, feng.tang@intel.com, zhengjun.xing@intel.com Subject: Re: [entry] 47b8ff194c: will-it-scale.per_process_ops -3.0% regression Message-ID: <20210519052700.GC29704@xsang-OptiPlex-9020> References: <20210428071653.GC13086@xsang-OptiPlex-9020> <20210513174636.GB975577@paulmck-ThinkPad-P17-Gen-1> <20210513231127.GA165500@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hi, Peter Zijlstra, On Fri, May 14, 2021 at 12:13:22PM +0200, Peter Zijlstra wrote: > On Fri, May 14, 2021 at 01:11:27AM +0200, Frederic Weisbecker wrote: > > > That sounds good, but two things: > > > > 1) Even if context tracking is not running, we still need to handle > > deferred wakeups on idle. But all user/guest/idle currently use the > > same function. > > > > 2) Context tracking may be running even when full nohz is not. But here only > > full nohz is concerned. > > > > So the change should rather be as follows (completely untested!). > > I rather put the static key check in tick.h in order not to involve > > deep dependencies inside rcupdate.h (especially rcupdate.h -> tick.h -> sched.h) > > Compiles and boots for me, 0day folks, could you please test this makes > the reported regression go away? sorry for late. on which base should we apply below patch? we tried to apply upon 4ae7dc97f726e ("entry/kvm: Explicitly flush pending rcuog wakeup before last rescheduling point") and v5.12, but both build failed like below: ERROR: modpost: "tick_nohz_full_mask" [arch/x86/kvm/kvm.ko] undefined! or is there any particular kconfig need to enable? (the kconfig which we used to build 47b8ff194c is in original report which maybe you could help have a look what we may miss) Thanks > > > diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h > > index 8b2b1d68b954..136b8d97d8c0 100644 > > --- a/include/linux/entry-kvm.h > > +++ b/include/linux/entry-kvm.h > > @@ -3,6 +3,7 @@ > > #define __LINUX_ENTRYKVM_H > > > > #include > > +#include > > > > /* Transfer to guest mode work */ > > #ifdef CONFIG_KVM_XFER_TO_GUEST_WORK > > @@ -57,7 +58,7 @@ int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu); > > static inline void xfer_to_guest_mode_prepare(void) > > { > > lockdep_assert_irqs_disabled(); > > - rcu_nocb_flush_deferred_wakeup(); > > + tick_nohz_user_enter_prepare(); > > } > > > > /** > > diff --git a/include/linux/tick.h b/include/linux/tick.h > > index 0bb80a7f05b9..bfd571f18cfd 100644 > > --- a/include/linux/tick.h > > +++ b/include/linux/tick.h > > @@ -11,6 +11,7 @@ > > #include > > #include > > #include > > +#include > > > > #ifdef CONFIG_GENERIC_CLOCKEVENTS > > extern void __init tick_init(void); > > @@ -304,4 +305,10 @@ static inline void tick_nohz_task_switch(void) > > __tick_nohz_task_switch(); > > } > > > > +static inline void tick_nohz_user_enter_prepare(void) > > +{ > > + if (tick_nohz_full_cpu(smp_processor_id())) > > + rcu_nocb_flush_deferred_wakeup(); > > +} > > + > > #endif > > diff --git a/kernel/entry/common.c b/kernel/entry/common.c > > index a0b3b04fb596..bf16395b9e13 100644 > > --- a/kernel/entry/common.c > > +++ b/kernel/entry/common.c > > @@ -5,6 +5,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "common.h" > > > > @@ -186,7 +187,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, > > local_irq_disable_exit_to_user(); > > > > /* Check if any of the above work has queued a deferred wakeup */ > > - rcu_nocb_flush_deferred_wakeup(); > > + tick_nohz_user_enter_prepare(); > > > > ti_work = READ_ONCE(current_thread_info()->flags); > > } > > @@ -202,7 +203,7 @@ static void exit_to_user_mode_prepare(struct pt_regs *regs) > > lockdep_assert_irqs_disabled(); > > > > /* Flush pending rcuog wakeup before the last need_resched() check */ > > - rcu_nocb_flush_deferred_wakeup(); > > + tick_nohz_user_enter_prepare(); > > > > if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK)) > > ti_work = exit_to_user_mode_loop(regs, ti_work);