All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: hongzha1 <hongzhan.chen@intel.com>
Cc: xenomai@xenomai.org
Subject: Re: [PATCH] cobalt/sched: dovetail: fix missed switching to OOB opportunities
Date: Wed, 10 Mar 2021 17:51:37 +0100	[thread overview]
Message-ID: <874khjhrza.fsf@xenomai.org> (raw)
In-Reply-To: <20210309044520.28816-1-hongzhan.chen@intel.com>


hongzha1 via Xenomai <xenomai@xenomai.org> writes:

> Ask for switching back to oob mode once ptrace core tell that
> current is resuming from a stopped state, leaving space for
> other runnable RT threads of the process to take over.
>
> Signed-off-by: hongzha1 <hongzhan.chen@intel.com>
>
> diff --git a/kernel/cobalt/dovetail/kevents.c b/kernel/cobalt/dovetail/kevents.c
> index 966a63ce0..a640c4d9e 100644
> --- a/kernel/cobalt/dovetail/kevents.c
> +++ b/kernel/cobalt/dovetail/kevents.c
> @@ -492,6 +492,8 @@ static void handle_ptrace_cont(void)
>  			unregister_debugged_thread(curr);
>  
>  		xnthread_set_localinfo(curr, XNHICCUP);
> +
> +		dovetail_request_ucall(current);
>  	}
>  
>  	xnlock_put_irqrestore(&nklock, s);
> diff --git a/kernel/cobalt/dovetail/sched.c b/kernel/cobalt/dovetail/sched.c
> index de7c43b70..2bdddfeef 100644
> --- a/kernel/cobalt/dovetail/sched.c
> +++ b/kernel/cobalt/dovetail/sched.c
> @@ -56,9 +56,21 @@ int pipeline_leave_inband(void)
>  
>  int pipeline_leave_oob_prepare(void)
>  {
> -	dovetail_leave_oob();
> +	int suspmask = XNRELAX;
> +	struct xnthread *curr = xnthread_current();
>  
> -	return XNRELAX;
> +	dovetail_leave_oob();
> +	/*
> +	 * If current is being debugged, record that it should migrate
> +	 * back in case it resumes in userspace. If it resumes in
> +	 * kernel space, i.e.  over a restarting syscall, the
> +	 * associated hardening will clear XNCONTHI.
> +	 */
> +	if (xnthread_test_state(curr, XNSSTEP)) {
> +		xnthread_set_info(curr, XNCONTHI);
> +		suspmask |= XNDBGSTOP;
> +	}
> +	return suspmask;
>  }
>  
>  void pipeline_leave_oob_finish(void)

Merged, thanks.

-- 
Philippe.


      parent reply	other threads:[~2021-03-10 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  4:45 [PATCH] cobalt/sched: dovetail: fix missed switching to OOB opportunities hongzha1
2021-03-10 16:15 ` Jan Kiszka
2021-03-10 16:49   ` Philippe Gerum
2021-03-10 17:53     ` Jan Kiszka
2021-03-10 16:51 ` Philippe Gerum [this message]

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=874khjhrza.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=hongzhan.chen@intel.com \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.