oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: [sean-jc:x86/gnu_source 41/42] tools/testing/selftests/kvm/rseq_test.c:223:undefined reference to `rseq_register_current_thread'
Date: Tue, 14 May 2024 16:25:18 +0800	[thread overview]
Message-ID: <202405141601.VXdtmd3C-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Edward Liaw <edliaw@google.com>
CC: Sean Christopherson <seanjc@google.com>
CC: Muhammad Usama Anjum <usama.anjum@collabora.com>

Hi Edward,

First bad commit (maybe != root cause):

tree:   https://github.com/sean-jc/linux x86/gnu_source
head:   174e2813ab91474be393ada0051bd7479a777023
commit: cc63298ca9d5d24b37a730484b8a71b359652f46 [41/42] selftests: Drop define _GNU_SOURCE
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240514/202405141601.VXdtmd3C-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/r/202405141601.VXdtmd3C-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   rseq_test.c: In function 'main':
>> rseq_test.c:223:13: warning: implicit declaration of function 'rseq_register_current_thread' [-Wimplicit-function-declaration]
     223 |         r = rseq_register_current_thread();
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> rseq_test.c:261:29: warning: implicit declaration of function 'sys_getcpu'; did you mean 'SYS_getcpu'? [-Wimplicit-function-declaration]
     261 |                         r = sys_getcpu(&cpu, NULL);
         |                             ^~~~~~~~~~
         |                             SYS_getcpu
>> rseq_test.c:264:36: warning: implicit declaration of function 'rseq_current_cpu_raw' [-Wimplicit-function-declaration]
     264 |                         rseq_cpu = rseq_current_cpu_raw();
         |                                    ^~~~~~~~~~~~~~~~~~~~
>> rseq_test.c:294:9: warning: implicit declaration of function 'rseq_unregister_current_thread' [-Wimplicit-function-declaration]
     294 |         rseq_unregister_current_thread();
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   At top level:
   cc1: note: unrecognized command-line option '-Wno-gnu-variable-sized-type-not-at-end' may have been intended to silence earlier diagnostics
--
   /usr/bin/ld: kselftest/kvm/rseq_test.o: in function `main':
>> tools/testing/selftests/kvm/rseq_test.c:223:(.text.startup+0x14f): undefined reference to `rseq_register_current_thread'
>> /usr/bin/ld: tools/testing/selftests/kvm/rseq_test.c:261:(.text.startup+0x230): undefined reference to `sys_getcpu'
>> /usr/bin/ld: tools/testing/selftests/kvm/rseq_test.c:264:(.text.startup+0x270): undefined reference to `rseq_current_cpu_raw'
>> /usr/bin/ld: tools/testing/selftests/kvm/rseq_test.c:294:(.text.startup+0x310): undefined reference to `rseq_unregister_current_thread'
   collect2: error: ld returned 1 exit status


vim +223 tools/testing/selftests/kvm/rseq_test.c

20ecf595b513b4 Zide Chen           2024-05-02  195  
61e52f1630f547 Sean Christopherson 2021-09-01  196  int main(int argc, char *argv[])
61e52f1630f547 Sean Christopherson 2021-09-01  197  {
20ecf595b513b4 Zide Chen           2024-05-02  198  	bool skip_sanity_check = false;
61e52f1630f547 Sean Christopherson 2021-09-01  199  	int r, i, snapshot;
61e52f1630f547 Sean Christopherson 2021-09-01  200  	struct kvm_vm *vm;
2494a6d80fb58c Sean Christopherson 2022-02-15  201  	struct kvm_vcpu *vcpu;
61e52f1630f547 Sean Christopherson 2021-09-01  202  	u32 cpu, rseq_cpu;
20ecf595b513b4 Zide Chen           2024-05-02  203  	int opt;
20ecf595b513b4 Zide Chen           2024-05-02  204  
20ecf595b513b4 Zide Chen           2024-05-02  205  	while ((opt = getopt(argc, argv, "hu")) != -1) {
20ecf595b513b4 Zide Chen           2024-05-02  206  		switch (opt) {
20ecf595b513b4 Zide Chen           2024-05-02  207  		case 'u':
20ecf595b513b4 Zide Chen           2024-05-02  208  			skip_sanity_check = true;
20ecf595b513b4 Zide Chen           2024-05-02  209  			break;
20ecf595b513b4 Zide Chen           2024-05-02  210  		case 'h':
20ecf595b513b4 Zide Chen           2024-05-02  211  		default:
20ecf595b513b4 Zide Chen           2024-05-02  212  			help(argv[0]);
20ecf595b513b4 Zide Chen           2024-05-02  213  			break;
20ecf595b513b4 Zide Chen           2024-05-02  214  		}
20ecf595b513b4 Zide Chen           2024-05-02  215  	}
61e52f1630f547 Sean Christopherson 2021-09-01  216  
61e52f1630f547 Sean Christopherson 2021-09-01  217  	r = sched_getaffinity(0, sizeof(possible_mask), &possible_mask);
61e52f1630f547 Sean Christopherson 2021-09-01  218  	TEST_ASSERT(!r, "sched_getaffinity failed, errno = %d (%s)", errno,
61e52f1630f547 Sean Christopherson 2021-09-01  219  		    strerror(errno));
61e52f1630f547 Sean Christopherson 2021-09-01  220  
7ed397d107d461 Sean Christopherson 2022-05-27  221  	calc_min_max_cpu();
61e52f1630f547 Sean Christopherson 2021-09-01  222  
66d42ac73fc680 Gavin Shan          2022-08-10 @223  	r = rseq_register_current_thread();
66d42ac73fc680 Gavin Shan          2022-08-10  224  	TEST_ASSERT(!r, "rseq_register_current_thread failed, errno = %d (%s)",
66d42ac73fc680 Gavin Shan          2022-08-10  225  		    errno, strerror(errno));
61e52f1630f547 Sean Christopherson 2021-09-01  226  
61e52f1630f547 Sean Christopherson 2021-09-01  227  	/*
61e52f1630f547 Sean Christopherson 2021-09-01  228  	 * Create and run a dummy VM that immediately exits to userspace via
61e52f1630f547 Sean Christopherson 2021-09-01  229  	 * GUEST_SYNC, while concurrently migrating the process by setting its
61e52f1630f547 Sean Christopherson 2021-09-01  230  	 * CPU affinity.
61e52f1630f547 Sean Christopherson 2021-09-01  231  	 */
2494a6d80fb58c Sean Christopherson 2022-02-15  232  	vm = vm_create_with_one_vcpu(&vcpu, guest_code);
61e52f1630f547 Sean Christopherson 2021-09-01  233  
e923b0537d28e1 Gavin Shan          2022-07-19  234  	pthread_create(&migration_thread, NULL, migration_worker,
561cafebb2cf97 Jinrong Liang       2022-08-02  235  		       (void *)(unsigned long)syscall(SYS_gettid));
61e52f1630f547 Sean Christopherson 2021-09-01  236  
61e52f1630f547 Sean Christopherson 2021-09-01  237  	for (i = 0; !done; i++) {
768e9a61856b75 Sean Christopherson 2022-06-02  238  		vcpu_run(vcpu);
768e9a61856b75 Sean Christopherson 2022-06-02  239  		TEST_ASSERT(get_ucall(vcpu, NULL) == UCALL_SYNC,
61e52f1630f547 Sean Christopherson 2021-09-01  240  			    "Guest failed?");
61e52f1630f547 Sean Christopherson 2021-09-01  241  
61e52f1630f547 Sean Christopherson 2021-09-01  242  		/*
61e52f1630f547 Sean Christopherson 2021-09-01  243  		 * Verify rseq's CPU matches sched's CPU.  Ensure migration
0fcc102923dee9 Gavin Shan          2022-08-10  244  		 * doesn't occur between getcpu() and reading the rseq cpu_id
0fcc102923dee9 Gavin Shan          2022-08-10  245  		 * by rereading both if the sequence count changes, or if the
0fcc102923dee9 Gavin Shan          2022-08-10  246  		 * count is odd (migration in-progress).
61e52f1630f547 Sean Christopherson 2021-09-01  247  		 */
61e52f1630f547 Sean Christopherson 2021-09-01  248  		do {
61e52f1630f547 Sean Christopherson 2021-09-01  249  			/*
61e52f1630f547 Sean Christopherson 2021-09-01  250  			 * Drop bit 0 to force a mismatch if the count is odd,
61e52f1630f547 Sean Christopherson 2021-09-01  251  			 * i.e. if a migration is in-progress.
61e52f1630f547 Sean Christopherson 2021-09-01  252  			 */
61e52f1630f547 Sean Christopherson 2021-09-01  253  			snapshot = atomic_read(&seq_cnt) & ~1;
61e52f1630f547 Sean Christopherson 2021-09-01  254  
61e52f1630f547 Sean Christopherson 2021-09-01  255  			/*
0fcc102923dee9 Gavin Shan          2022-08-10  256  			 * Ensure calling getcpu() and reading rseq.cpu_id complete
0fcc102923dee9 Gavin Shan          2022-08-10  257  			 * in a single "no migration" window, i.e. are not reordered
0fcc102923dee9 Gavin Shan          2022-08-10  258  			 * across the seq_cnt reads.
61e52f1630f547 Sean Christopherson 2021-09-01  259  			 */
61e52f1630f547 Sean Christopherson 2021-09-01  260  			smp_rmb();
68efe8f7a1c516 Mark Brown          2023-01-06 @261  			r = sys_getcpu(&cpu, NULL);
68efe8f7a1c516 Mark Brown          2023-01-06  262  			TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)",
68efe8f7a1c516 Mark Brown          2023-01-06  263  				    errno, strerror(errno));
66d42ac73fc680 Gavin Shan          2022-08-10 @264  			rseq_cpu = rseq_current_cpu_raw();
61e52f1630f547 Sean Christopherson 2021-09-01  265  			smp_rmb();
61e52f1630f547 Sean Christopherson 2021-09-01  266  		} while (snapshot != atomic_read(&seq_cnt));
61e52f1630f547 Sean Christopherson 2021-09-01  267  
61e52f1630f547 Sean Christopherson 2021-09-01  268  		TEST_ASSERT(rseq_cpu == cpu,
250e138d876838 Andrew Jones        2023-12-06  269  			    "rseq CPU = %d, sched CPU = %d", rseq_cpu, cpu);
61e52f1630f547 Sean Christopherson 2021-09-01  270  	}
61e52f1630f547 Sean Christopherson 2021-09-01  271  
61e52f1630f547 Sean Christopherson 2021-09-01  272  	/*
61e52f1630f547 Sean Christopherson 2021-09-01  273  	 * Sanity check that the test was able to enter the guest a reasonable
61e52f1630f547 Sean Christopherson 2021-09-01  274  	 * number of times, e.g. didn't get stalled too often/long waiting for
0fcc102923dee9 Gavin Shan          2022-08-10  275  	 * getcpu() to stabilize.  A 2:1 migration:KVM_RUN ratio is a fairly
0fcc102923dee9 Gavin Shan          2022-08-10  276  	 * conservative ratio on x86-64, which can do _more_ KVM_RUNs than
0fcc102923dee9 Gavin Shan          2022-08-10  277  	 * migrations given the 1us+ delay in the migration task.
20ecf595b513b4 Zide Chen           2024-05-02  278  	 *
20ecf595b513b4 Zide Chen           2024-05-02  279  	 * Another reason why it may have small migration:KVM_RUN ratio is that,
20ecf595b513b4 Zide Chen           2024-05-02  280  	 * on systems with large low power mode wakeup latency, it may happen
20ecf595b513b4 Zide Chen           2024-05-02  281  	 * quite often that the scheduler is not able to wake up the target CPU
20ecf595b513b4 Zide Chen           2024-05-02  282  	 * before the vCPU thread is scheduled to another CPU.
61e52f1630f547 Sean Christopherson 2021-09-01  283  	 */
20ecf595b513b4 Zide Chen           2024-05-02  284  	TEST_ASSERT(skip_sanity_check || i > (NR_TASK_MIGRATIONS / 2),
20ecf595b513b4 Zide Chen           2024-05-02  285  		    "Only performed %d KVM_RUNs, task stalled too much?\n\n"
20ecf595b513b4 Zide Chen           2024-05-02  286  		    "  Try disabling deep sleep states to reduce CPU wakeup latency,\n"
20ecf595b513b4 Zide Chen           2024-05-02  287  		    "  e.g. via cpuidle.off=1 or setting /dev/cpu_dma_latency to '0',\n"
20ecf595b513b4 Zide Chen           2024-05-02  288  		    "  or run with -u to disable this sanity check.", i);
61e52f1630f547 Sean Christopherson 2021-09-01  289  
61e52f1630f547 Sean Christopherson 2021-09-01  290  	pthread_join(migration_thread, NULL);
61e52f1630f547 Sean Christopherson 2021-09-01  291  
61e52f1630f547 Sean Christopherson 2021-09-01  292  	kvm_vm_free(vm);
61e52f1630f547 Sean Christopherson 2021-09-01  293  
66d42ac73fc680 Gavin Shan          2022-08-10 @294  	rseq_unregister_current_thread();

:::::: The code at line 223 was first introduced by commit
:::::: 66d42ac73fc680dbd7a1402f8b44967426522d0f KVM: selftests: Make rseq compatible with glibc-2.35

:::::: TO: Gavin Shan <gshan@redhat.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

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

                 reply	other threads:[~2024-05-14  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202405141601.VXdtmd3C-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).