From: Gautham R Shenoy <ego@linux.vnet.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org,
Michael Ellerman <mpe@ellerman.id.au>,
Mahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>
Subject: Re: [PATCH 7/7] powerpc/64s: idle POWER8 avoid full state loss recovery where possible
Date: Mon, 20 Mar 2017 22:01:15 +0530 [thread overview]
Message-ID: <20170320163115.GA20610@in.ibm.com> (raw)
In-Reply-To: <20170320202605.304b33ad@roar.ozlabs.ibm.com>
Hi Nick,
On Mon, Mar 20, 2017 at 08:26:05PM +1000, Nicholas Piggin wrote:
> On Mon, 20 Mar 2017 15:41:39 +0530
> Gautham R Shenoy <ego@linux.vnet.ibm.com> wrote:
>
> > Hi Nick,
> >
> > On Mon, Mar 20, 2017 at 04:01:52PM +1000, Nicholas Piggin wrote:
> > > If not all threads were in winkle, full state loss recovery is not
> > > necessary and can be avoided. A previous patch removed this optimisation
> > > due to some complexity with the implementation. Re-implement it by
> > > counting the number of threads in winkle with the per-core idle state.
> > > Only restore full state loss if all threads were in winkle.
> > >
> > > This has a small window of false positives right before threads execute
> > > winkle and just after they wake up, when the winkle count does not
> > > reflect the true number of threads in winkle. This is not a significant
> > > problem in comparison with even the minimum winkle duration. For
> > > correctness, a false positive is not a problem (only false negatives
> > > would be).
> >
> > The patch looks good. Just a minor comment.
> >
> >
> > > BEGIN_FTR_SECTION
> > > + /*
> > > + * Were we in winkle?
> > > + * If yes, check if all threads were in winkle, decrement our
> > > + * winkle count, set all thread winkle bits if all were in winkle.
> > > + * Check if our thread has a winkle bit set, and set cr4 accordingly
> > > + * (to match ISA300, above). Pseudo-code for core idle state
> > > + * transitions for ISA207 is as follows (everything happens atomically
> > > + * due to store conditional and/or lock bit):
> > > + *
> > > + * nap_idle() { }
> > > + * nap_wake() { }
> > > + *
> > > + * sleep_idle()
> > > + * {
> > > + * core_idle_state &= ~thread_in_core
> > > + * }
> > > + *
> > > + * sleep_wake()
> > > + * {
> > > + * bool first_in_core, first_in_subcore;
> > > + *
> > > + * first_in_core = (core_idle_state & IDLE_THREAD_BITS) == 0;
> > > + * first_in_subcore = (core_idle_state & SUBCORE_SIBLING_MASK) == 0;
> > > + *
> > > + * core_idle_state |= thread_in_core;
> > > + * }
> > > + *
> > > + * winkle_idle()
> > > + * {
> > > + * core_idle_state &= ~thread_in_core;
> > > + * core_idle_state += 1 << WINKLE_COUNT_SHIFT;
> > > + * }
> > > + *
> > > + * winkle_wake()
> > > + * {
> > > + * bool first_in_core, first_in_subcore, winkle_state_lost;
> > > + *
> > > + * first_in_core = (core_idle_state & IDLE_THREAD_BITS) == 0;
> > > + * first_in_subcore = (core_idle_state & SUBCORE_SIBLING_MASK) == 0;
> > > + *
> > > + * core_idle_state |= thread_in_core;
> > > + *
> > > + * if ((core_idle_state & WINKLE_MASK) == (8 << WINKLE_COUNT_SIHFT))
> > > + * core_idle_state |= THREAD_WINKLE_BITS;
> >
> > We also do the following decrement. I forgot this in the pseudo-code in my
> > earlier reply.
> >
> > core_idle_state -= 1 << WINKLE_COUNT_SHIFT;
>
> Lucky somebody is paying attention. Yes, this is needed. I won't resend
> a patch if mpe can make the change.
>
>
> > Looks good other wise.
> >
> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
>
> Thank you.
>
> What do you want to do about your DD1 fix? I think there are some minor
> clashes between them. I'm happy to rebase on top of yours if you prefer
> it to go in first.
I have sent an updated version of the DD1 fix today rebasing on
v4.11-rc3.
I applied your series on top of that and noticed some minor conflict
with patches 1,2,3 and 7.
If you are ok with it, I would like the DD1 Hotplug fixes to go in
first.
>
> Thanks,
> Nick
>
next prev parent reply other threads:[~2017-03-20 16:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 6:01 [PATCH 0/7][v3] idle fixes and changes for POWER8 and POWER9 Nicholas Piggin
2017-03-20 6:01 ` [PATCH 1/7] powerpc/64s: move remaining system reset idle code into idle_book3s.S Nicholas Piggin
2017-03-20 6:01 ` [PATCH 2/7] powerpc/64s: stop using bit in HSPRG0 to test winkle Nicholas Piggin
2017-03-20 6:01 ` [PATCH 3/7] powerpc/64s: use alternative feature patching Nicholas Piggin
2017-03-20 6:01 ` [PATCH 4/7] powerpc/64s: fix POWER9 machine check handler from stop state Nicholas Piggin
2017-03-20 14:51 ` Nicholas Piggin
2017-03-20 6:01 ` [PATCH 5/7] powerpc/64s: idle expand core idle state bits Nicholas Piggin
2017-03-20 6:01 ` [PATCH 6/7] powerpc/64s: idle do not hold reservation longer than required Nicholas Piggin
2017-03-20 6:01 ` [PATCH 7/7] powerpc/64s: idle POWER8 avoid full state loss recovery where possible Nicholas Piggin
2017-03-20 10:11 ` Gautham R Shenoy
2017-03-20 10:26 ` Nicholas Piggin
2017-03-20 16:31 ` Gautham R Shenoy [this message]
2017-03-20 17:19 ` Nicholas Piggin
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=20170320163115.GA20610@in.ibm.com \
--to=ego@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/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.