From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754356AbdIGHcR (ORCPT ); Thu, 7 Sep 2017 03:32:17 -0400 Received: from twin.jikos.cz ([89.185.236.188]:37744 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752315AbdIGHcQ (ORCPT ); Thu, 7 Sep 2017 03:32:16 -0400 Date: Thu, 7 Sep 2017 09:31:07 +0200 (CEST) From: Jiri Kosina X-X-Sender: jikos@twin.jikos.cz To: Andy Lutomirski cc: X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Linus Torvalds Subject: Re: [PATCH 1/2] x86/mm: Reinitialize TLB state on hotplug and resume In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Sep 2017, Andy Lutomirski wrote: > When Linux brings a CPU down and back up, it switches to init_mm and then > loads swapper_pg_dir into CR3. With PCID enabled, this has the side effect > of masking off the ASID bits in CR3. > > This can result in some confusion in the TLB handling code. If we > bring a CPU down and back up with any ASID other than 0, we end up > with the wrong ASID active on the CPU after resume. This could > cause our internal state to become corrupt, although major > corruption is unlikely because init_mm doesn't have any user pages. > More obviously, if CONFIG_DEBUG_VM=y, we'll trip over an assertion > in the next context switch. The result of *that* is a failure to > resume from suspend with probability 1 - 1/6^(cpus-1). > > Fix it by reinitializing cpu_tlbstate on resume and CPU bringup. > > Reported-by: Linus Torvalds > Reported-by: Jiri Kosina > Fixes: 10af6235e0d3 ("x86/mm: Implement PCID based optimization: try to preserve old TLB entries using PCID") > Signed-off-by: Andy Lutomirski Tested-by: Jiri Kosina Thanks, -- Jiri Kosina SUSE Labs