lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1420641610.5830.29.camel@kernel.crashing.org>
Date:	Wed, 07 Jan 2015 15:40:10 +0100
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Purcareata Bogdan <b43198@...escale.com>
Cc:	linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC] PPC: MPIC: necessary readback after EOI?

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@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ