public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: Question about interrupt enabling/disabling in kernel exit path
Date: Wed, 09 Nov 2005 22:31:33 +0000	[thread overview]
Message-ID: <20051109223133.GD4379@frankl.hpl.hp.com> (raw)
In-Reply-To: <1131559925.5214.100.camel@localhost.localdomain>

Lee,

As you may have seen there is a perfmon callback from do_notify_resume().
I am also using TIF_NOTIFY_RESUME to get back into perfmon just before
leaving the kernel.

It is not true that interrupts are always off when getting there.
Last year we ran into a issue for this reason, i.e., I was assume
interrupts were always masked when getting there. But apparentlyy,
that is not always the case. I don't recall exactly what is the path
to get to this situation but I know it exists.

On Wed, Nov 09, 2005 at 01:12:05PM -0500, Lee Schermerhorn wrote:
> Hello:
> 
> I have a question about enabling interrupts in the kernel exit path.
> Especially, in do_notify_resume_user().  I have work that I need to
> defer to this point, but it needs to run with interrupts enabled.  I
> wanted to piggy back off TIF_NOTIFY_RESUME, because that is more or less
> generic code and gets handled in a C function where I can play the usual
> header games:  static inline wrapper function when feature is
> configured;  null macro when not.
> 
> I see a comment at the beginning of ia64_leave_kernel that says that
> "work.need_resched, etc. mustn't get changed by this CPU before it
> returns to user- or fsys-mode, hence we disable interrupts early on."
> [This may be a stale comment.  I.e., we now check for resched needed in
> current task's thread_info flags.] But, then I see later that when
> CONFIG_PREEMPT is set, we do enable interrupts and then re-disable them.
> 
> Then I notice that after we return from do_notify_resume_user() we don't
> recheck TIF_NEED_RESCHED, etc. in the thread_info flags.   So, maybe
> this is the issue?  If I open an interrupt window in
> do_notify_resume_user(), 'NEED_RESCHED might get set and we wouldn't
> notice it on return to the assembly language code.  [I might even sleep
> here.  Is that a problem?]
> 
> I took a look at the x86_64 and i386 versions and they always goes back
> to check for resched after calling their version of do_notify_resume()
> [no '_user suffix on the routine].  If this were the only issue with
> enabling interrupts in do_notify_resume_user(), I could change it to
> return non-zero if recheck is needed [zero in the usual case] and then
> go back and recheck thread_info flags.
> 
> Regards,
> Lee
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

-Stephane

  reply	other threads:[~2005-11-09 22:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 18:12 Question about interrupt enabling/disabling in kernel exit path Lee Schermerhorn
2005-11-09 22:31 ` Stephane Eranian [this message]
2005-11-14 21:52 ` David Mosberger-Tang
2005-11-15 20:21 ` Lee Schermerhorn
2005-11-15 21:04 ` Chen, Kenneth W
2005-11-15 21:16 ` David Mosberger-Tang

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=20051109223133.GD4379@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=linux-ia64@vger.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