All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: "Chen, Hongzhan" <hongzhan.chen@intel.com>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: gdb test failure issue on xenomai 3.2
Date: Fri, 05 Mar 2021 11:56:34 +0100	[thread overview]
Message-ID: <87k0qlyil9.fsf@xenomai.org> (raw)
In-Reply-To: <CY4PR11MB1703AFA86C561954ECFE93BAF2969@CY4PR11MB1703.namprd11.prod.outlook.com>


Hi Hongzhan,

Sorry for the lag in replying.

Chen, Hongzhan <hongzhan.chen@intel.com> writes:

> Hi Philippe,
>
> I think I already found the root cause and almost fix it but still need time to validate it.
>
> Temporary patch like following:
>
> diff --git a/kernel/cobalt/dovetail/sched.c b/kernel/cobalt/dovetail/sched.c
> index de7c43b70..846b571b6 100644
> --- a/kernel/cobalt/dovetail/sched.c
> +++ b/kernel/cobalt/dovetail/sched.c
> @@ -56,9 +56,22 @@ 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 both clear XNCONTHI and disable
> +        * the user return notifier again.
> +        */
> +       if (xnthread_test_state(curr, XNSSTEP)) {
> +               xnthread_set_info(curr, XNCONTHI);
> +               suspmask |= XNDBGSTOP;
> +       }
> +       return suspmask;
>  }

Yes, that part was definitely missing. I guess I dropped it mistakenly
due to the condition on the obsolete IPIPE_KEVT_USERINTRET check.

>
>  void pipeline_leave_oob_finish(void)
> intel@intel-Z97X-UD5H:~/iotg/dovetail/xenomaioverdovetail/cobalt-dovetail/upstream/xenomai-rpm$ git diff kernel/cobalt/dovetail/kevents.c
> diff --git a/kernel/cobalt/dovetail/kevents.c b/kernel/cobalt/dovetail/kevents.c
> index 966a63ce0..9bceffaac 100644
> --- a/kernel/cobalt/dovetail/kevents.c
> +++ b/kernel/cobalt/dovetail/kevents.c
>         if (xnthread_test_info(thread, XNCONTHI)) {
>                 xnlock_get_irqsave(&nklock, s);
>                 xnthread_clear_info(thread, XNCONTHI);
> @@ -492,6 +494,8 @@ static void handle_ptrace_cont(void)
>                         unregister_debugged_thread(curr);
>
>                 xnthread_set_localinfo(curr, XNHICCUP);
> +
> +               dovetail_request_ucall(current);
>         }
>

Looks good to me too. Once the ptrace core tells us that current is
resuming from a stopped state, this is the right place to ask for
switching back to oob mode.

> After validation is done , I would submit clean patch to review.

Thanks for looking at this one. This is quite tricky stuff.

-- 
Philippe.


      reply	other threads:[~2021-03-05 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 11:20 gdb test failure issue on xenomai 3.2 Chen, Hongzhan
2021-03-05  1:15 ` Chen, Hongzhan
2021-03-05 10:56   ` 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=87k0qlyil9.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.