Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp291350rdb; Thu, 2 Nov 2023 04:04:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9RrMhJphgWniwFOxkr77UZ+B+utNwlXoxuTVoN4IkvQvJYS0HLqbelyzdTz6e7YMjL+jH X-Received: by 2002:a17:902:ec82:b0:1cc:6acc:8fa4 with SMTP id x2-20020a170902ec8200b001cc6acc8fa4mr7350085plg.32.1698923088319; Thu, 02 Nov 2023 04:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698923088; cv=none; d=google.com; s=arc-20160816; b=NFBPzmlmFY2JgsTAlk1hSumzEUKvkZ44kHc9w81VkcVEeKHu2ZMb/LbkAlTCsSwS2L LoDmU+FQIrBHonMsgHLXJqUufWCLmN8/Bhga7HeW7ZfpS1z9WPVQgaEEiSglrsT71+at s8s+HFHj168kdONY7km9LQB2EPnHNpFPCUytJadVAypm0RnK91mHnX1Mof4jsdpoghSA QG0539g0W4/eMoHoFzcTXbqF3Q/0jWibtxR+pclwdaLAVFE+XChqsuTe4X7FJ6tj8um3 jqRnaczdmmHKVxt4jPsb0RSh163FCUKAwGFWmS6q2SqLVtx6vVRdPoTi0ATFEQVgCD+Z YC7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=o+sUvKh0Fq9LjCXdXIyTK4b/elLQxFDSaWn4T3QHjyo=; fh=fQTHhJm2RiMzxq79LPPV5BPPapkOF+GwR+lEgtz89Zw=; b=0wyFP6l4Nyy89X0h/YtEMi2f4rKT29tfavBmLOo46QJA67RfhhL0S3tiFRvFZRTGo8 mXu2ZcIZdHXURFZziuZAkWhqBE3gVDc4m+CZFYsf8OPwc9jRz8wAfiy15OTFDtIkS/dd obxa5nd6isletIGs1xGW4LBjpLUPPeWj9jIymqc2rNdIBOmftDSixGEj/Lxbr/GlkVSq HwJNkbiWX2yD63QES0Ucek1vzVN85hOOI6pR5cAZIinccbE0+7tPiSxX9xa9XAm9Icvh jTy0NByHBvhdZac3nYVb4TD6aOE0z7gV6UaVbn8gxVEYaGPpFMtXerPLPyBHBmVRVZ0N QBDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q7sseUwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d20-20020a170902f15400b001c9b2c2644bsi4596099plb.451.2023.11.02.04.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 04:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q7sseUwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DADE980F649B; Thu, 2 Nov 2023 04:04:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346709AbjKBLEh (ORCPT + 99 others); Thu, 2 Nov 2023 07:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346098AbjKBLEf (ORCPT ); Thu, 2 Nov 2023 07:04:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 657C8130 for ; Thu, 2 Nov 2023 04:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698923025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=o+sUvKh0Fq9LjCXdXIyTK4b/elLQxFDSaWn4T3QHjyo=; b=Q7sseUwtWEEI0egtOu8UQU3mCkNiq7VM/SJXS6Q575qofflvGnxctjBcnccBX7o/sJJFVf dCEv8xdgMtfhkKKf9Rz1F+upuvMRLoBzGyvndsLT5HJfZcc5p/FJakVkHLU8+Jwf/KcaCY W4PxzFg+IZ+4UW1vC2jByOrmig+yFPg= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-534-TjGyfyeeMaO8xTUE3rlNaQ-1; Thu, 02 Nov 2023 07:03:44 -0400 X-MC-Unique: TjGyfyeeMaO8xTUE3rlNaQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9d2ab03a586so54296566b.0 for ; Thu, 02 Nov 2023 04:03:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698923023; x=1699527823; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o+sUvKh0Fq9LjCXdXIyTK4b/elLQxFDSaWn4T3QHjyo=; b=AxswoYXJI7R/sxR1LaOh3UzKvt9/h9BlVc8P3ucl8Hdm1LYSiavtB+12Bp1aeT+DOQ CkcOpRyffS9KBtCpLWUpiPu4uNnr8jQlCIl5G92WG2gfkVWEjr1HHkNsnvbj0dYnY69J QUaFCcOPECpln0g7GiOMq5CMgsp+cpQUx2YMKVnKuCGaZNmXOwdBmvebfUY4Eb0fa9+8 TbAAgEy4giyf5QZevIpZnCVlpJTj20TZlodVUoc8zhIVadQev/NnSEPQraxqcix1AhiV 62aht/3BosWnkWLUeUw2GZ3jobhYrb+62jZsdz3xaRc/V6wcj5wTfBGz4I4QYqfqsEwL EMPQ== X-Gm-Message-State: AOJu0Yx+cMfwQI3QieI91Dx6zMsLvVfWtvAdnCR/nEUAViHiueZ0LcN/ DD4m9wwoztYjZINiLqXbHXbri3mtj0ojJAjBtdHgNnDYmlAmrnZQ+7sLkHkyhNJvBZoTUft6Ecg SeC5f+h2OxmNnPcHg2IAfhr8Z X-Received: by 2002:a17:907:7b99:b0:9be:30c2:b8fd with SMTP id ne25-20020a1709077b9900b009be30c2b8fdmr4830875ejc.66.1698923023225; Thu, 02 Nov 2023 04:03:43 -0700 (PDT) X-Received: by 2002:a17:907:7b99:b0:9be:30c2:b8fd with SMTP id ne25-20020a1709077b9900b009be30c2b8fdmr4830827ejc.66.1698923022777; Thu, 02 Nov 2023 04:03:42 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id hk22-20020a170906c9d600b0099cb0a7098dsm1010698ejb.19.2023.11.02.04.03.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Nov 2023 04:03:42 -0700 (PDT) Message-ID: <496b78bb-ad12-4eed-a62c-8c2fd725ec61@redhat.com> Date: Thu, 2 Nov 2023 12:03:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v13 09/35] KVM: Add KVM_EXIT_MEMORY_FAULT exit to report faults to userspace Content-Language: en-US To: "Huang, Kai" , "Christopherson,, Sean" Cc: "Li, Xiaoyao" , "kvm-riscv@lists.infradead.org" , "mic@digikod.net" , "liam.merwick@oracle.com" , "kvm@vger.kernel.org" , "Yamahata, Isaku" , "viro@zeniv.linux.org.uk" , "kirill.shutemov@linux.intel.com" , "david@redhat.com" , "linux-mips@vger.kernel.org" , "amoorthy@google.com" , "linuxppc-dev@lists.ozlabs.org" , "tabba@google.com" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "oliver.upton@linux.dev" , "michael.roth@amd.com" , "chao.p.peng@linux.intel.com" , "palmer@dabbelt.com" , "chenhuacai@kernel.org" , "aou@eecs.berkeley.edu" , "mpe@ellerman.id.au" , "Annapurve, Vishal" , "vbabka@suse.cz" , "mail@maciej.szmigiero.name" , "linux-riscv@lists.infradead.org" , "maz@kernel.org" , "willy@infradead.org" , "dmatlack@google.com" , "anup@brainfault.org" , "yu.c.zhang@linux.intel.com" , "Xu, Yilun" , "qperret@google.com" , "brauner@kernel.org" , "isaku.yamahata@gmail.com" , "ackerleytng@google.com" , "jarkko@kernel.org" , "paul.walmsley@sifive.com" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , "Wang, Wei W" , "akpm@linux-foundation.org" References: <20231027182217.3615211-1-seanjc@google.com> <20231027182217.3615211-10-seanjc@google.com> <482bfea6f54ea1bb7d1ad75e03541d0ba0e5be6f.camel@intel.com> <64e3764e36ba7a00d94cc7db1dea1ef06b620aaf.camel@intel.com> <32cb71700aedcbd1f65276cf44a601760ffc364b.camel@intel.com> From: Paolo Bonzini Autocrypt: addr=pbonzini@redhat.com; keydata= xsEhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+Z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Dz0iKmSrx8xkoXYfA3bgtFN8WJH2xgFL28XnqY4M6dLhJwV3z08tPSRqYFm4NMP dRsn0/7oymhneL8RthIvjDDQ5ktUjMe8LtHr70OZE/TT88qvEdhiIVUogHdo4qBrk41+gGQh b906Dudw5YhTJFU3nC6bbF2nrLlB4C/XSiH76ZvqzV0Z/cAMBo5NF/w= In-Reply-To: <32cb71700aedcbd1f65276cf44a601760ffc364b.camel@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 02 Nov 2023 04:04:46 -0700 (PDT) On 11/2/23 10:35, Huang, Kai wrote: > IIUC KVM can already handle the case of poisoned > page by sending signal to user app: > > static int kvm_handle_error_pfn(struct kvm_vcpu *vcpu, > struct kvm_page_fault *fault) > { > ... > > if (fault->pfn == KVM_PFN_ERR_HWPOISON) { > kvm_send_hwpoison_signal(fault->slot, fault->gfn); > return RET_PF_RETRY; > } > } EHWPOISON is not implemented by this series, so it should be left out of the documentation. > Currently as mentioned above when > vepc fault handler cannot allocate EPC page KVM returns -EFAULT to Qemu, and > Qemu prints ... > > ...: Bad address > > > ... which is nonsense. > > If we can use memory_fault.flags (or is 'fault_reason' a better name?) to carry > a specific value for EPC to let Qemu know and Qemu can then do more reasonable > things. Yes, that's a good idea that can be implemented on top. Paolo