Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Vishal Chourasia <vishalc@linux.ibm.com>
To: tj@kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: selftests/sched_ext: enq_last_no_enq_fails testcase fails
Date: Wed, 23 Oct 2024 22:13:19 +0530	[thread overview]
Message-ID: <Zxknp7RAVNjmdJSc@linux.ibm.com> (raw)

Hi,

===== START =====
TEST: enq_last_no_enq_fails
DESCRIPTION: Verify we fail to load a scheduler if we specify the SCX_OPS_ENQ_LAST flag without defining ops.enqueue()
OUTPUT:
ERR: enq_last_no_enq_fails.c:35
Incorrectly succeeded in to attaching scheduler
not ok 2 enq_last_no_enq_fails #
=====  END  =====


Above selftest fails even when BPF scheduler is not loaded into the kernel. 

Below is snippet from the dmesg verifing bpf program was not loaded:
sched_ext: enq_last_no_enq_fails: SCX_OPS_ENQ_LAST requires ops.enqueue() to be implemented
   scx_ops_enable.isra.0+0xde8/0xe30
   bpf_struct_ops_link_create+0x1ac/0x240
   link_create+0x178/0x400
   __sys_bpf+0x7ac/0xd50
   sys_bpf+0x2c/0x70
   system_call_exception+0x148/0x310
   system_call_vectored_common+0x15c/0x2ec
sched_ext: "enq_select_cpu_fails" does not implement cgroup cpu.weight
sched_ext: BPF scheduler "enq_select_cpu_fails" enabled
sched_ext: BPF scheduler "enq_select_cpu_fails" disabled (runtime error)



static int scx_ops_enable(struct sched_ext_ops *ops, struct bpf_link *link)
{
...
         ret = validate_ops(ops);
          if (ret)
                  goto err_disable;
...
  err_disable:
          mutex_unlock(&scx_ops_enable_mutex);
          /*
           * Returning an error code here would not pass all the error information
           * to userspace. Record errno using scx_ops_error() for cases
           * scx_ops_error() wasn't already invoked and exit indicating success so
           * that the error is notified through ops.exit() with all the details.
           *
           * Flush scx_ops_disable_work to ensure that error is reported before
           * init completion.
           */
          scx_ops_error("scx_ops_enable() failed (%d)", ret);
          kthread_flush_work(&scx_ops_disable_work);
          return 0;
  }

validate_ops() correctly reports the error, but err_disable path ultimately
returns with a value of zero

from: enq_last_no_enq_fails.c
static enum scx_test_status run(void *ctx)
{
        struct enq_last_no_enq_fails *skel = ctx;
        struct bpf_link *link;

        link = bpf_map__attach_struct_ops(skel->maps.enq_last_no_enq_fails_ops);
        if (link) {
                SCX_ERR("Incorrectly succeeded in to attaching scheduler");
                return SCX_TEST_FAIL;
        }

        bpf_link__destroy(link);

        return SCX_TEST_PASS;
}



             reply	other threads:[~2024-10-23 16:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 16:43 Vishal Chourasia [this message]
2024-10-23 21:46 ` selftests/sched_ext: enq_last_no_enq_fails testcase fails Tejun Heo

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=Zxknp7RAVNjmdJSc@linux.ibm.com \
    --to=vishalc@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=tj@kernel.org \
    /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