Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp290106rdb; Thu, 2 Nov 2023 04:02:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhxHrGAj1o00bvgniIvV7g8yjFh+2KznO4obA7NM/vH1NySYILmCc/1dwREq+QIb/IKzCM X-Received: by 2002:a17:902:c948:b0:1cc:33e7:95f5 with SMTP id i8-20020a170902c94800b001cc33e795f5mr7281012pla.33.1698922973273; Thu, 02 Nov 2023 04:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698922973; cv=none; d=google.com; s=arc-20160816; b=PX1Nnlsk6eSvvbFNdW/BjVeZY71Ya1c/T37pEGoceCWvL0cypzxo0qrlyXvtOWKYA5 MYE7ip7Dm8NJ41zw8cIJLg7sLmjBDPBdUXopRQXhwK3JWLIrTZurPfn1RZNnlZtPdDQR fGJQyBfgCiipuFwHBFPwMQ1vECmBjRAMYjl57Rlad4neyllW1y5g44orAt4WQluviAlX +jhWHRspHON8zQQ7DJ3eNUNinT7J7EMbKIY7vRxmHETkOL+wBoWnH423AUN6+1Ms+FXv BhTQpAQswpPmdE+xTz4E3LvjB6r1Qn4UoiUriC9vVs1X7wl3Ad0wA8Vo8iyiOIb/bAsH OElQ== 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=WEsP6UmyH+BX0JZ3F1lGKvqULOvcqKbb9QU0pxprrbY=; fh=KO5LDafJDjrF2A02D2C6COXj/3Q7nJCYtyVIn8EP1NQ=; b=X1rLRItXY1mBqmed+/FVYCVAW4O+CWG8x7L5GWIArgS5vnHsEkyDvv1beCxRqZlu9M JoOvyUf3rxRt2HDzyBybl092vf5yY6AoxYvgpyBKGcfCjlCW/Cfkxq9W+/m1h+13DnhT Gg4xYY4tkx1GhnjKRZaJRPlMkfvpAnnsKhO/Ghbcw9Dk06p9t7imPllPugGx3+a+YuQP lBn+tZyDcIkjVdMpIsJc23tgZSig11hYBCZSu2WZRywLPBN+VjY8lCpOfDRYe6X2fKFk 4pRLrJ+Gc0nZMTCHnJHEpq+kkM2MS8wZK6TCrNG8RCoMKZINXIpXqFLpmnzPJoaaSq5o yIZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JSQ8ZzZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id be10-20020a656e4a000000b005b93eb7d322si1846771pgb.481.2023.11.02.04.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 04:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JSQ8ZzZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 147268149711; Thu, 2 Nov 2023 04:02:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347152AbjKBLCm (ORCPT + 99 others); Thu, 2 Nov 2023 07:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346098AbjKBLCk (ORCPT ); Thu, 2 Nov 2023 07:02:40 -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 B6636187 for ; Thu, 2 Nov 2023 04:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698922908; 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=WEsP6UmyH+BX0JZ3F1lGKvqULOvcqKbb9QU0pxprrbY=; b=JSQ8ZzZRgLWbzhfCdaUcHK/rzyB19nqEoQFs4/2y4V5ys3awZbhIH8BNDepeMEPt+8tFSk Fi3oQZcmFiu3eR1EIq9NbXrQwgG0baZqr/JYUrKA2TMGoxhNNs2JXCkj+18sdeUMm1uZjI LcPrqAVKQQw1YrJpq2fTGWr6/NqlBno= 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-592-lwVS1Zt9M9KpUEvGq7Ljlg-1; Thu, 02 Nov 2023 07:01:47 -0400 X-MC-Unique: lwVS1Zt9M9KpUEvGq7Ljlg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9d8603d2b00so54542966b.1 for ; Thu, 02 Nov 2023 04:01:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698922906; x=1699527706; 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=WEsP6UmyH+BX0JZ3F1lGKvqULOvcqKbb9QU0pxprrbY=; b=XZabDV9hrMkA16ElWMPte0wM7oGHEs0vWsNDmiB3IDXsENgf6S5DiFNMA8Mox/6V8q ylAzkcXTVETzMKiclPzJNnqmTv3uBsvlTwCiQSrwMsG/XGJK4/II3zyWTVYlQ3N7Ky9h AKzHyrceVUctpbFdxrxDInEqKYbDqsxJp+Ava3fPTqOzInvQJkqr1txh0XbpEh8CbxIu lOGkjfqf8X1ppIJWim2VlJ0lWfrCLosYklfD/IdOa8FYBCaEBqLoogGqerTUMwS12rGx s/fnxKIxRiK/U8ycwWtvEc+tjYJgzkYOq4uoUsB73uysrYzTJHe7WYUFwE1OJ1Vs1xqz j/Mw== X-Gm-Message-State: AOJu0YyAifDaZ0EaVW8sCjBnFjzB0zOygVXQ8xT4+AhupHGrFFPr1rZR 8MUff5Co3WeQzZ0Yi53sMNzZ1PMF0ae8sRgTCP+A+m/oId2VmEMHcW70b9cs+vwBC0AkQ9WbA14 an9Snj3KStmG8+rjbJOfismXe X-Received: by 2002:a17:906:d90:b0:9ba:a38:531e with SMTP id m16-20020a1709060d9000b009ba0a38531emr3519642eji.52.1698922905991; Thu, 02 Nov 2023 04:01:45 -0700 (PDT) X-Received: by 2002:a17:906:d90:b0:9ba:a38:531e with SMTP id m16-20020a1709060d9000b009ba0a38531emr3519582eji.52.1698922905598; Thu, 02 Nov 2023 04:01:45 -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 a8-20020a170906684800b00993a37aebc5sm983006ejs.50.2023.11.02.04.01.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Nov 2023 04:01:44 -0700 (PDT) Message-ID: Date: Thu, 2 Nov 2023 12:01:41 +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: Sean Christopherson , Kai Huang Cc: "viro@zeniv.linux.org.uk" , "aou@eecs.berkeley.edu" , "brauner@kernel.org" , "oliver.upton@linux.dev" , "chenhuacai@kernel.org" , "paul.walmsley@sifive.com" , "palmer@dabbelt.com" , "maz@kernel.org" , "mpe@ellerman.id.au" , "willy@infradead.org" , "anup@brainfault.org" , "akpm@linux-foundation.org" , Xiaoyao Li , "kvm-riscv@lists.infradead.org" , "mic@digikod.net" , "liam.merwick@oracle.com" , "kvm@vger.kernel.org" , Isaku Yamahata , "kirill.shutemov@linux.intel.com" , "david@redhat.com" , "tabba@google.com" , "amoorthy@google.com" , "linuxppc-dev@lists.ozlabs.org" , "michael.roth@amd.com" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "chao.p.peng@linux.intel.com" , "linux-mips@vger.kernel.org" , Vishal Annapurve , "vbabka@suse.cz" , "mail@maciej.szmigiero.name" , "yu.c.zhang@linux.intel.com" , "qperret@google.com" , "dmatlack@google.com" , Yilun Xu , "isaku.yamahata@gmail.com" , "ackerleytng@google.com" , "jarkko@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , Wei W Wang References: <20231027182217.3615211-1-seanjc@google.com> <20231027182217.3615211-10-seanjc@google.com> <482bfea6f54ea1bb7d1ad75e03541d0ba0e5be6f.camel@intel.com> From: Paolo Bonzini Autocrypt: addr=pbonzini@redhat.com; keydata= xsEhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY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JFU3nC6bbF2nrLlB4C/XSiH76ZvqzV0Z/cAMBo5NF/w= In-Reply-To: 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 02 Nov 2023 04:02:49 -0700 (PDT) On 11/1/23 18:36, Sean Christopherson wrote: > A good example is KVM_RUN with -EINTR; if KVM were to return something other than > -EINTR on a pending signal or vcpu->run->immediate_exit, userspace would fall over. And dually if KVM were to return KVM_EXIT_INTR together with something other than -EINTR. > And purging exit_reason super early is subtly tricky because KVM's > (again, poorly documented) ABI is that *some* exit reasons are preserved > across KVM_RUN with vcpu->run->immediate_exit (or with a pending > signal). https://lore.kernel.org/all/ZFFbwOXZ5uI%2Fgdaf@google.com vcpu->run->immediate_exit preserves all exit reasons, but it's not a good idea that immediate_exit behaves different from a pending signal on entry to KVM_RUN (remember that immediate_exit was meant to be a better performing alternative to KVM_SET_SIGNAL_MASK). In principle, vcpu->run->immediate_exit could return KVM_EXIT_INTR (perhaps even _should_, except that breaks selftests so at this point it is ABI). Paolo