Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5450730imu; Wed, 19 Dec 2018 11:22:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xpmikp/utwcLjUcov1nYWvk64lWyvL6Z/d3HMNLVqbKwAHGApLZeZ5jce8Nxz4Rc/wm8pM X-Received: by 2002:a17:902:5a0b:: with SMTP id q11mr21658570pli.186.1545247345594; Wed, 19 Dec 2018 11:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545247345; cv=none; d=google.com; s=arc-20160816; b=vhpX4nB1PBDD3vlUC1GDTp0B6neNA3/3lt0uGIKzXev3a1jIHdU+6IKS54tk3lHni/ 2+CEpqG+2eDP5D6gnquchWKJU6CFIjglLGFbfCt2F3eUMpJaSUEf8nJ2SE8DyPdxMnp6 nSeU0EeuxOdqDc7ba2SbrHSZyuiAyvFzm7VutycPwKCGHZKO2CdjKF7vz80wnu7XffTe opDpGQcOYnfFw66cnQfn6WA3l/Vnbc4RL5puHTciNVlp7DUZ5Nvx+fD3Z7X/iSVpBR1p cJt+XVBjRxhFI4vLSmZ2neShpwekK97tdpf5ff0lHnVhJ+9xHTSzcbgqWi+8OG7wN/60 jYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YBSayooM6cyUUAhkVTY2kepW7RV6B37vyFu72FXyP+c=; b=VBQB5Rz7YRRkqBm3we+ym8hGxoHZHZZ26hqngo5u/le3N9R4vCr25A16Qhmr3Ar04D U9kctyOfnGtPtipl8s8ODHOO4aYv0AjqTGcq3EtYlmL9dcKDGAOiLl4uJ6nQzKRYEZQ7 BXnQE1JmnSfwf0277p2Rm7M8Z8vJwVSrv1fjxNQYuhOPwuIehFn/44VYrt66P35+rjLo 0IEofkRvIN2Hcb3cvyKnSt1Y1d+yQYbm64Gs+JVgx5JCfVt5VAWcjvDfWwKTRBpg+iFM cNMBwTdmsCwhVWQNGvLxCPMuNrV5TdovX4oLn5QXxzm65bS1DI6UyoxDNiS/FKx4WETj TypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hdAPwFpB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si16122835pfi.271.2018.12.19.11.22.10; Wed, 19 Dec 2018 11:22:25 -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; dkim=pass header.i=@linaro.org header.s=google header.b=hdAPwFpB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730185AbeLSTDM (ORCPT + 99 others); Wed, 19 Dec 2018 14:03:12 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:38197 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730166AbeLSTDL (ORCPT ); Wed, 19 Dec 2018 14:03:11 -0500 Received: by mail-ot1-f66.google.com with SMTP id e12so20125864otl.5 for ; Wed, 19 Dec 2018 11:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YBSayooM6cyUUAhkVTY2kepW7RV6B37vyFu72FXyP+c=; b=hdAPwFpBqxaXmX5hBBlSPmZvWs62lWea89VdWbbydwIXg4SswU2MxcLxstsiH38I4o kp9urJ64nCyqlUKklIFLjCz19yVVx3Sz8QqzoytG13yev7Sz0TfpjL+gDerD7CUp6jqL mXEc7zyT6IqE3IphmzwqDhWfdvsD0HDYWm/Zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YBSayooM6cyUUAhkVTY2kepW7RV6B37vyFu72FXyP+c=; b=ImaIl+jdyktf3T4xQzLbVYjlgJlzcp1X1fi3y/f4QKDF3lPZIGc8ZJaXxFFIEFLaim kDJZ2zG552fpcyry4r0MoaSYM4tUohBN2STVwbo4FrBPSRtR/RvEQX8HB2vyk+UtAUhM od0ifSHgy3h4UidisX7K+YI33HNFW7UogNLCZebnZL0EUOskrQhAgOCvTEE9Is2pFO6l x4XfUfwloa9BcB3YVomeoUkH22QGEiZrJukkLZ7VrZ4QaFfRpxM/db40yiF3AjriZtbh 7gQXsoB4KMMiSGKdbCYGV4EGG+FD52R77AS0Z9T9Fu9z2fN9hI4wtjFeim0IyZCCqBzK jvbw== X-Gm-Message-State: AA+aEWY476F7CQiaCUdh3puGbtjKFWiLBP6vV9aEUwEarwcqqXtFRxiZ 3swtwmdS67WzMbeRvTJxQmN3UzUg5lY3GGcRgciCBQ== X-Received: by 2002:a9d:5a81:: with SMTP id w1mr893126oth.317.1545246189690; Wed, 19 Dec 2018 11:03:09 -0800 (PST) MIME-Version: 1.0 References: <0184EA26B2509940AA629AE1405DD7F201FFC21E@dggema523-mbx.china.huawei.com> In-Reply-To: From: Peter Maydell Date: Wed, 19 Dec 2018 19:02:58 +0000 Message-ID: Subject: Re: [RFC RESEND PATCH] kvm: arm64: export memory error recovery capability to user space To: James Morse Cc: gengdongjiu , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Jonathan Corbet , Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , kvm-devel , "open list:DOCUMENTATION" , lkml - Kernel Mailing List , arm-mail-list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Dec 2018 at 15:56, James Morse wrote: > I think the root issue here is the name of the cpufeature 'RAS Extensions', this > doesn't mean RAS is new, or even requires these features. It's just standardised > records, classification and a barrier. > Not only is it possible to build a platform that supports RAS without this > extensions: there are at least three platforms out there that do! > > > On 15/12/2018 00:12, gengdongjiu wrote: > >> On Fri, 14 Dec 2018 at 13:56, James Morse wrote: > >>> On 14/12/2018 10:15, Dongjiu Geng wrote: > >>>> When user space do memory recovery, it will check whether KVM and > >>>> guest support the error recovery, only when both of them support, > >>>> user space will do the error recovery. This patch exports this > >>>> capability of KVM to user space. > >>> > >>> I can understand user-space only wanting to do the work if host and > >>> guest support the feature. But 'error recovery' isn't a KVM feature, > >>> its a Linux kernel feature. > > [...] > > > Thanks Peter's explanation. Frankly speaking, I agree Peter's suggestion. > > > > To James, I explain more to you, as peter said QEMU needs to check whether > > the guest CPU is a type which can handle the error though guest ACPI table. > > I don't think this really matters. Its only the NMIlike notifications that the > guest doesn't have to register or poll. The ones we support today extend the > architectures existing behaviour: you would have taken an external-abort on a > real system, whether you know about the additional metadata doesn't matter to Qemu. Consider the case where we booted the guest using a DTB and no ACPI table at all -- we certainly can't just call QEMU code that tries to add entries to a nonexistent table. My main point is that there needs to be logic in Dongjiu's QEMU patches that checks more than just "does this KVM feature exist". I'm not sufficiently familiar with all this RAS stuff to be certain what those checks should be and what the right choices are; I just know we need to check *something*... > > Let us see the X86's QEMU logic: > > 1. Before the vCPU created, it will set a default env->mcg_cap value with > > > MCE_CAP_DEF flag, MCG_SER_P means it expected the guest CPU model supports > > RAS error recovery.[1] 2. when the vCPU initialize, it will check whether host > > kernel support this feature[2]. Only when host kernel and default env->mcg_cap > > value all expected this feature, then it will setup vCPU support RAS error > > recovery[3]. > > This looks like KVM exposing a CPU capability to Qemu, which then configures the > behaviour KVM gives to the guest. This doesn't tell you anything about what the > guest supports. It tells you what the *guest CPU* supports, which for x86 is a combination of (a) what did the user/machine model ask for and (b) what can KVM actually implement. I don't much care whether the guest OS supports anything or not, that's its business... but it does seem odd to me that the equivalent Arm code is not similarly saying "what were we asked for, and what can we do?". I think one question here which it would be good to answer is: if we are modelling a guest and we haven't specifically provided it an ACPI table to tell it about memory errors, what do we do when we get a sigbus from the host? We have basically two choices: (1) send the guest an SError (aka asynchronous external abort) anyway (with no further info about what the memory error is) (2) just stop QEMU (as we would for a memory error in QEMU's own memory) thanks -- PMM