Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6849766imu; Thu, 31 Jan 2019 00:19:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN4utI4XRAFm2r1u1DCh5ICdU/ZxkQGo0xuJIOkcToEv4uKLVyw2QLPK90IAIXZh4aKhzowf X-Received: by 2002:a62:a1a:: with SMTP id s26mr34150860pfi.31.1548922784505; Thu, 31 Jan 2019 00:19:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548922784; cv=none; d=google.com; s=arc-20160816; b=aWle+fhSaBhYFX0ljOqZIEcjx05yPWicpvVLfCejdR5MWRLx4t3dFKAgErLhhKkEJv SrElPYZi7oTFcrZzi5Z3Cto7P+rZ00h1CjEcc1BhgNa/8O0Pf/w3dxNvjUCnJ9mquUkL Z3C5+FyXYP7N/j79/ejuelE//4/6rh26m1YFvsS+z28930Gq3ABONea70LRc3v3OQNls y0UF4TnahNBl+ZfqgMgJWPDTOIRu3VxhRIMBN7t1L1S78XVXLxnksqSptHYfZwRHJkJw k4obcaK7enrMO8ORe0Wa/q8AUceLey9A/wWLTMWv1Q7S8ZoFwF7ryq2qqHpEzpakxZg1 yfXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LzrosuDfjIO/Yl0z4dOSHs8Dd7xJAPFg9c6LZu+XyHw=; b=HcozsA+Nihus2hFEMxFJsAAq470yLlVsitbqFS+3Q/Psb1TwVnid8acDxUyILa+wn0 8DxOlPbuaL1Gbj2wLTFl9y65jqaNbaN1gSHAwrd5v5/RYxM8wf7O5pNq7O9YFa/dOiB6 J5dcwyy+Swpfu8DY0LfPqXQvNhuXQrXPyXBW+7t18/OwpYV03CnrnVLCKKkoOSH3ER2J A+WEUuqDlWoqzfdDStQZ6WID61uTnZBUOnccsJHb2gsuXqhspZxSVNMXC9HzBMCKilSR 8jehlthJOVqBwTvDg+FH5OVkHiacqpqfUIdG+Dgh8zF4CRKZPhpqIGyApHMcar0iO055 eYWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si3886267pfx.102.2019.01.31.00.19.29; Thu, 31 Jan 2019 00:19:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731016AbfAaITE (ORCPT + 99 others); Thu, 31 Jan 2019 03:19:04 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38956 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbfAaITD (ORCPT ); Thu, 31 Jan 2019 03:19:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8AEF80D; Thu, 31 Jan 2019 00:19:02 -0800 (PST) Received: from localhost (e113682-lin.copenhagen.arm.com [10.32.144.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 393D33F589; Thu, 31 Jan 2019 00:19:02 -0800 (PST) Date: Thu, 31 Jan 2019 09:19:00 +0100 From: Christoffer Dall To: Julien Thierry Cc: James Morse , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, Arnd Bergmann , linux-arch@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v9 01/26] arm64: Fix HCR.TGE status for NMI contexts Message-ID: <20190131081900.GM13482@e113682-lin.lund.arm.com> References: <1548084825-8803-1-git-send-email-julien.thierry@arm.com> <1548084825-8803-2-git-send-email-julien.thierry@arm.com> <8e8c4f5b-5b83-7bbc-1b84-36d68e210968@arm.com> <847c54ef-ea41-eea5-8aff-72e0cea465f8@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <847c54ef-ea41-eea5-8aff-72e0cea465f8@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 03:42:42PM +0000, Julien Thierry wrote: > Hi James, > > On 28/01/2019 11:48, James Morse wrote: > > Hi Julien, > > > > On 21/01/2019 15:33, Julien Thierry wrote: > >> When using VHE, the host needs to clear HCR_EL2.TGE bit in order > >> to interract with guest TLBs, switching from EL2&0 translation regime > > > > (interact) > > > > > >> to EL1&0. > >> > >> However, some non-maskable asynchronous event could happen while TGE is > >> cleared like SDEI. Because of this address translation operations > >> relying on EL2&0 translation regime could fail (tlb invalidation, > >> userspace access, ...). > >> > >> Fix this by properly setting HCR_EL2.TGE when entering NMI context and > >> clear it if necessary when returning to the interrupted context. > > > > Yes please. This would not have been fun to debug! > > > > Reviewed-by: James Morse > > > > > > Thanks. > > > > > I was looking for why we need core code to do this, instead of updating the > > arch's call sites. Your 'irqdesc: Add domain handlers for NMIs' patch (pointed > > to from the cover letter) is the reason: core-code calls nmi_enter()/nmi_exit() > > itself. > > > > Yes, that's the main reason. > I wondered the same thing, but I don't understand the explanation :( Why can't we do a local_daif_mask() around the (very small) calls that clear TGE instead? Thanks, Christoffer