public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ahmed Ehab <bottaawesome633@gmail.com>, linux-kernel@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] Refactor switch_mm_cid() to avoid unnecessary checks
Date: Tue, 27 Aug 2024 04:32:49 +0800	[thread overview]
Message-ID: <202408270455.R85TrPfw-lkp@intel.com> (raw)
In-Reply-To: <20240824223132.11925-1-bottaawesome633@gmail.com>

Hi Ahmed,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/sched/core]
[also build test ERROR on linus/master v6.11-rc5 next-20240826]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ahmed-Ehab/Refactor-switch_mm_cid-to-avoid-unnecessary-checks/20240826-153216
base:   tip/sched/core
patch link:    https://lore.kernel.org/r/20240824223132.11925-1-bottaawesome633%40gmail.com
patch subject: [PATCH] Refactor switch_mm_cid() to avoid unnecessary checks
config: arm-ep93xx_defconfig (https://download.01.org/0day-ci/archive/20240827/202408270455.R85TrPfw-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408270455.R85TrPfw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408270455.R85TrPfw-lkp@intel.com/

All errors (new ones prefixed by >>):

>> kernel/sched/core.c:5232:4: error: implicit declaration of function 'switch_mm_cid_from_user_to_kernel' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           switch_mm_cid_from_user_to_kernel(rq, prev, next);
                           ^
>> kernel/sched/core.c:5257:4: error: implicit declaration of function 'switch_mm_cid_from_kernel_to_user' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           switch_mm_cid_from_kernel_to_user(rq, prev, next);
                           ^
>> kernel/sched/core.c:5259:4: error: implicit declaration of function 'switch_mm_cid_from_user_to_user' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           switch_mm_cid_from_user_to_user(rq, prev, next);
                           ^
   3 errors generated.


vim +/switch_mm_cid_from_user_to_kernel +5232 kernel/sched/core.c

  5199	
  5200	/*
  5201	 * context_switch - switch to the new MM and the new thread's register state.
  5202	 */
  5203	static __always_inline struct rq *
  5204	context_switch(struct rq *rq, struct task_struct *prev,
  5205		       struct task_struct *next, struct rq_flags *rf)
  5206	{
  5207		prepare_task_switch(rq, prev, next);
  5208	
  5209		/*
  5210		 * For paravirt, this is coupled with an exit in switch_to to
  5211		 * combine the page table reload and the switch backend into
  5212		 * one hypercall.
  5213		 */
  5214		arch_start_context_switch(prev);
  5215	
  5216		/*
  5217		 * kernel -> kernel   lazy + transfer active
  5218		 *   user -> kernel   lazy + mmgrab_lazy_tlb() active
  5219		 *
  5220		 * kernel ->   user   switch + mmdrop_lazy_tlb() active
  5221		 *   user ->   user   switch
  5222		 *
  5223		 * switch_mm_cid() needs to be updated if the barriers provided
  5224		 * by context_switch() are modified.
  5225		 */
  5226		if (!next->mm) {                                // to kernel
  5227			enter_lazy_tlb(prev->active_mm, next);
  5228	
  5229			next->active_mm = prev->active_mm;
  5230			if (prev->mm) {                           // from user
  5231				mmgrab_lazy_tlb(prev->active_mm);
> 5232				switch_mm_cid_from_user_to_kernel(rq, prev, next);
  5233			}
  5234			else
  5235				/*
  5236				 * kernel -> kernel transition does not change rq->curr->mm
  5237				 * state. It stays NULL.
  5238				 */
  5239				prev->active_mm = NULL;
  5240		} else {                                        // to user
  5241			membarrier_switch_mm(rq, prev->active_mm, next->mm);
  5242			/*
  5243			 * sys_membarrier() requires an smp_mb() between setting
  5244			 * rq->curr / membarrier_switch_mm() and returning to userspace.
  5245			 *
  5246			 * The below provides this either through switch_mm(), or in
  5247			 * case 'prev->active_mm == next->mm' through
  5248			 * finish_task_switch()'s mmdrop().
  5249			 */
  5250			switch_mm_irqs_off(prev->active_mm, next->mm, next);
  5251			lru_gen_use_mm(next->mm);
  5252	
  5253			if (!prev->mm) {                        // from kernel
  5254				/* will mmdrop_lazy_tlb() in finish_task_switch(). */
  5255				rq->prev_mm = prev->active_mm;
  5256				prev->active_mm = NULL;
> 5257				switch_mm_cid_from_kernel_to_user(rq, prev, next);
  5258			} else
> 5259				switch_mm_cid_from_user_to_user(rq, prev, next);
  5260		}
  5261	
  5262		prepare_lock_switch(rq, next, rf);
  5263	
  5264		/* Here we just switch the register state and the stack. */
  5265		switch_to(prev, next, prev);
  5266		barrier();
  5267	
  5268		return finish_task_switch(prev);
  5269	}
  5270	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2024-08-26 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24 22:31 [PATCH] Refactor switch_mm_cid() to avoid unnecessary checks Ahmed Ehab
2024-08-26 20:32 ` kernel test robot [this message]
2024-08-26 20:53 ` kernel test robot

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=202408270455.R85TrPfw-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bottaawesome633@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox