All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Purcareata Bogdan <b43198@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] PPC: MPIC: necessary readback after EOI?
Date: Wed, 07 Jan 2015 15:40:10 +0100	[thread overview]
Message-ID: <1420641610.5830.29.camel@kernel.crashing.org> (raw)
In-Reply-To: <54AA9C4D.3000001@freescale.com>

On Mon, 2015-01-05 at 16:14 +0200, Purcareata Bogdan wrote:
> Hello,
> 
> While doing some performance testing of a KVM guest on a PPC platform, I 
> noticed that there's a read of the CPU_WHOAMI register after each MPIC 
> EOI [1]. This has been present since the initial implementation of the 
> MPIC driver [2]. In a KVM virtualized environment, this results in an 
> additional kvm_exit.
> 
> Is the read back necessary? Is it used to provide some sort of 
> synchronization mechanism, making sure that nothing else is executed 
> until the EOI write is finished? I eliminated the mpic_cpu_read call and 
> run the kernel on hardware and noticed no anomaly, however I am not sure 
> of all the implications and race conditions it might lead to.

It was done to ensure that the store to the EOI has reached the MPIC and
been fully processed before re-enabling interrupts on the CPU. On some
implementations, the MPIC runs quite slowly (significantly slower than
the core) and the stores to it are asynchronous, so we had situation
where we would restore interrupts while the MPIC hasn't yet de-asserted
the output line.

One way to work around the performance loss for you would be to add some
DT property to indicate to the guest that the read isn't necessary.

> I was curious why the mpic_cpu_read(MPIC_INFO(CPU_WHOAMI)) was there in 
> the first place and if it's still needed. If it's still required, I 
> guess a better approach is to eliminate the call only if the kernel is 
> running on the KVM guest side, where the MPIC is emulated and no longer 
> requires a readback.
> 
> Thank you,
> Bogdan P.
> 
> [1] http://lxr.free-electrons.com/source/arch/powerpc/sysdev/mpic.c#L659
> [2] https://lkml.org/lkml/2004/10/22/483
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



  parent reply	other threads:[~2015-01-07 14:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 14:14 [RFC] PPC: MPIC: necessary readback after EOI? Purcareata Bogdan
2015-01-05 14:14 ` Purcareata Bogdan
2015-01-05 17:46 ` Andreas Mohr
2015-01-05 17:46   ` Andreas Mohr
2015-01-05 18:10   ` Scott Wood
2015-01-05 18:10     ` Scott Wood
2015-01-05 18:43     ` Andreas Mohr
2015-01-05 18:43       ` Andreas Mohr
2015-01-07  2:56       ` Scott Wood
2015-01-07  2:56         ` Scott Wood
2015-01-07 14:44     ` Benjamin Herrenschmidt
2015-01-07 14:44       ` Benjamin Herrenschmidt
2015-01-07 17:04       ` Scott Wood
2015-01-07 17:04         ` Scott Wood
2015-01-08 19:17         ` Benjamin Herrenschmidt
2015-01-08 19:17           ` Benjamin Herrenschmidt
2015-01-07 14:43   ` Benjamin Herrenschmidt
2015-01-07 14:43     ` Benjamin Herrenschmidt
2015-01-07 14:40 ` Benjamin Herrenschmidt [this message]
2015-01-08  0:49   ` Segher Boessenkool
2015-01-08  0:49     ` Segher Boessenkool

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=1420641610.5830.29.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=b43198@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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.