From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA1BC43460 for ; Tue, 11 May 2021 08:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B62BB616EA for ; Tue, 11 May 2021 08:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbhEKIF0 (ORCPT ); Tue, 11 May 2021 04:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbhEKIFZ (ORCPT ); Tue, 11 May 2021 04:05:25 -0400 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43486C06175F for ; Tue, 11 May 2021 01:04:18 -0700 (PDT) Received: by mail-oo1-xc31.google.com with SMTP id l25-20020a4a35190000b029020a54735152so75488ooa.4 for ; Tue, 11 May 2021 01:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=RsARpI9kPbe8fGR56PQ4skYG8c9j7c835d7rOcGai/qr7PmvAFxTBwMPg0n2VNOOJ5 KkP+xqxkTWNxfq5af47pwFhxQ+gI535/8Hg4Py+5tIBUnpVpw+uUqHNdiGy1We0e6P7C U3pDYJNh9iAbAGww3qtuHQ2C6EI76iWRqwRdduT/OiYZNMX9ZOvWrl/LOZQlW9gSIr1c Lza0R/5guKEDeTbh4LO7VrsbCV1JlyXIRO9IliK93CHvkIlqHwTidtABkP6MtO1RLgI8 0futdZOP85C/BHdhcmoHGmhTFD1t2/pn5mxbgN3B6aATye6KVk+2Hm+OkS0WCKlV7WAR mPUQ== 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=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=CEF1f9V9cqTZgcKVvIQU0NgKCH+FrvfewyLRJAVkf0cqcGTPneACSOG0FVa6tZjK9i cxZW5jOLSJGh+i5Dh+kHPYHn3ReGq+F1d27VbqtuBGvRxXwmRaWSKq/j2UWBzN5VZw+u LOY8tziEfvoL8RC7fjMH2497ChdvdJg/+8Oj3QLRjXVPHa/bizNhRjZ5AYoKvqmazF4M UnRqeKcTQ6yI6/3NXiwgzln+/Fyy82OPJpLPSbGspsEvkQ6YgXAdFFKUaqak4zwy1XrS VqxOTmtK7PQn6FaC7PmS66v8fJUeJmU6R+FLI8vn24hQ8XDkdZUlXIMdbTonk+Ui3Qv3 xFow== X-Gm-Message-State: AOAM532bgGctmVyuzol1gTB9Fmg45iMV9pRmybSNZQJ6fI10RZxWyvw6 VbraPntYovp3j24Vtht2dgLPpCZ/9OQLfMq9s3uycw== X-Google-Smtp-Source: ABdhPJwiG5f14ptUggSSt+hUanG2tnouIAtbpU1JD68oO5A0s7qMCGnueWGVnCFx9fN6AZ33rumu5oXEfhtT2qh7sVs= X-Received: by 2002:a4a:ea2b:: with SMTP id y11mr285770ood.42.1620720257457; Tue, 11 May 2021 01:04:17 -0700 (PDT) MIME-Version: 1.0 References: <20210510094915.1909484-1-maz@kernel.org> <20210510094915.1909484-3-maz@kernel.org> In-Reply-To: <20210510094915.1909484-3-maz@kernel.org> From: Fuad Tabba Date: Tue, 11 May 2021 09:03:40 +0100 Message-ID: Subject: Re: [PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace To: Marc Zyngier Cc: kvm@vger.kernel.org, "open list:KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)" , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , Zenghui Yu , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Hi Marc, > KVM: arm64: Commit pending PC adjustemnts before returning to userspace s/adjustments/adjustments On Mon, May 10, 2021 at 10:49 AM Marc Zyngier wrote: > > KVM currently updates PC (and the corresponding exception state) > using a two phase approach: first by setting a set of flags, > then by converting these flags into a state update when the vcpu > is about to enter the guest. > > However, this creates a disconnect with userspace if the vcpu thread > returns there with any exception/PC flag set. In this case, the exposed > context is wrong, as userpsace doesn't have access to these flags > (they aren't architectural). It also means that these flags are > preserved across a reset, which isn't expected. > > To solve this problem, force an explicit synchronisation of the > exception state on vcpu exit to userspace. As an optimisation > for nVHE systems, only perform this when there is something pending. I've tested this with a few nvhe and vhe tests that exercise both __kvm_adjust_pc call paths (__kvm_vcpu_run and kvm_arch_vcpu_ioctl_run), and the tests ran as expected. I'll do the same for v2 when you send it out. Cheers, /fuad From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76E98C433ED for ; Tue, 11 May 2021 08:04:22 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id C96E761448 for ; Tue, 11 May 2021 08:04:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C96E761448 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3EC3C4B495; Tue, 11 May 2021 04:04:21 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U4Ntiig-mZQe; Tue, 11 May 2021 04:04:20 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 47A3B4B49A; Tue, 11 May 2021 04:04:20 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 752284B495 for ; Tue, 11 May 2021 04:04:19 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T8+mneZnRaY1 for ; Tue, 11 May 2021 04:04:18 -0400 (EDT) Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 5E8914B434 for ; Tue, 11 May 2021 04:04:18 -0400 (EDT) Received: by mail-oo1-f54.google.com with SMTP id v14-20020a4ae6ce0000b02901fe68cd377fso4028427oot.13 for ; Tue, 11 May 2021 01:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=RsARpI9kPbe8fGR56PQ4skYG8c9j7c835d7rOcGai/qr7PmvAFxTBwMPg0n2VNOOJ5 KkP+xqxkTWNxfq5af47pwFhxQ+gI535/8Hg4Py+5tIBUnpVpw+uUqHNdiGy1We0e6P7C U3pDYJNh9iAbAGww3qtuHQ2C6EI76iWRqwRdduT/OiYZNMX9ZOvWrl/LOZQlW9gSIr1c Lza0R/5guKEDeTbh4LO7VrsbCV1JlyXIRO9IliK93CHvkIlqHwTidtABkP6MtO1RLgI8 0futdZOP85C/BHdhcmoHGmhTFD1t2/pn5mxbgN3B6aATye6KVk+2Hm+OkS0WCKlV7WAR mPUQ== 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=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=iVxdT3j/Q0xB9xpx2XkZa/hN9a8dAo7eOYj/Is9IWPb9CKbIDSSUbgPwpiM0h5LF6U TBKwGk74Ke+t7Pl0Y5s8L3O7o136kbKCVq8snDN/b9cmGgE1S4KgxwG+DJC9rkRC/kai 1mR4BkFbMzZdx4hFuSFR/rDWU+aNTME9KKtmrKWqFuwEHbaZOw+TPfjH9oBMYlm/Mboj 3aT9Ic7eQJeuefRTFdv870uR0UADAmLAt7EzmWtdnyZSJ2kAuk6/6lXMvP0rC1YsvtQu R5oDgCLl1IC8VtZrflAjOUdoGaR2N94+0nzsvmincM3bKkFHXxMyLZH6FXKgQRHj615p 2JBQ== X-Gm-Message-State: AOAM530/Lo3MZQJi1ItilTZho182Dc2KYc/6xYMRE6XXFcHc86jP0skK Jl0X7r6TRO0rYkRJN2agiSzlVW00lYdGnLxxZ0ja0g== X-Google-Smtp-Source: ABdhPJwiG5f14ptUggSSt+hUanG2tnouIAtbpU1JD68oO5A0s7qMCGnueWGVnCFx9fN6AZ33rumu5oXEfhtT2qh7sVs= X-Received: by 2002:a4a:ea2b:: with SMTP id y11mr285770ood.42.1620720257457; Tue, 11 May 2021 01:04:17 -0700 (PDT) MIME-Version: 1.0 References: <20210510094915.1909484-1-maz@kernel.org> <20210510094915.1909484-3-maz@kernel.org> In-Reply-To: <20210510094915.1909484-3-maz@kernel.org> From: Fuad Tabba Date: Tue, 11 May 2021 09:03:40 +0100 Message-ID: Subject: Re: [PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace To: Marc Zyngier Cc: kvm@vger.kernel.org, kernel-team@android.com, stable@vger.kernel.org, "open list:KERNEL VIRTUAL MACHINE FOR ARM64 \(KVM/arm64\)" , "moderated list:ARM64 PORT \(AARCH64 ARCHITECTURE\)" X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Marc, > KVM: arm64: Commit pending PC adjustemnts before returning to userspace s/adjustments/adjustments On Mon, May 10, 2021 at 10:49 AM Marc Zyngier wrote: > > KVM currently updates PC (and the corresponding exception state) > using a two phase approach: first by setting a set of flags, > then by converting these flags into a state update when the vcpu > is about to enter the guest. > > However, this creates a disconnect with userspace if the vcpu thread > returns there with any exception/PC flag set. In this case, the exposed > context is wrong, as userpsace doesn't have access to these flags > (they aren't architectural). It also means that these flags are > preserved across a reset, which isn't expected. > > To solve this problem, force an explicit synchronisation of the > exception state on vcpu exit to userspace. As an optimisation > for nVHE systems, only perform this when there is something pending. I've tested this with a few nvhe and vhe tests that exercise both __kvm_adjust_pc call paths (__kvm_vcpu_run and kvm_arch_vcpu_ioctl_run), and the tests ran as expected. I'll do the same for v2 when you send it out. Cheers, /fuad _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4720AC433ED for ; Tue, 11 May 2021 12:05:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BD8A615FF for ; Tue, 11 May 2021 12:05:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BD8A615FF Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IOVMEzF7shcKEnXoIbSzy3Z84t2+bn6kZafdPmxNoj8=; b=A+ZVHY785JYmQmzKwk9lJOhXb YLUwtdomBvAjU86oIPRRiCHyjUwuNjl6sPyHEEpD1eq7R0sgx0vf3KGYjVtVMv7zUhL9eGOAlXUc2 W2ZASnSEh3si4lWXeMJFNqxrWWaGFl+CXp0dI6oSoGZ6Wk18dBLfNsRV/LoWyrW7EjPz2ZWwyGhh2 q5P8lJXvQNFnBjTdwNuepQTRZH7B46wHKqhlPE/SpePJVfKWbDu4vKSQ1w6Si0UYM0ZScawmIxUef U1px3eim7AXhytdOB3rrGYLzIiSREyapqmfl9h7sddNDAlgma8S8+d9JQdtHHFqcj0zyy3R9mxdGi 77vc6moGg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgR7J-00HHNZ-L3; Tue, 11 May 2021 12:04:02 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgNNR-00GYom-7L for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 08:04:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=iFvKqQS/DeWYVmTBycS1dUhUHs 9r+1K604FtKou1GcW6Na0POxE3L7qlfvpYXFsR6rkb8dPIEBYGV8pvj6DTl0fOCzZLOwv8ZC1Bs6+ Q4RxxCfoZmwMnUsTJzQC1j8TLSBeU6a9N1RK2RPhJKN0LQ0UyMoRipMRV7QabpJvJxsSAIPy0ZQj8 ESyYhSEUGpZEN/rxTLfnbNeMkzWsMQzNRYlFOBaxG6hzQubsoAY7pJ1nOZMYpIt5VqAuRUwNBlDRm gor76psvMCxqJsrBiIm0ccxDsnK6Ki1bYAD2Ux98K+vmO6SmLmqfTxsgclnsZm9CobC8uyVu2skhz oMG1c6mw==; Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgNNN-009NfG-BP for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 08:04:22 +0000 Received: by mail-oo1-xc2a.google.com with SMTP id p6-20020a4adc060000b02901f9a8fc324fso4037875oov.10 for ; Tue, 11 May 2021 01:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=RsARpI9kPbe8fGR56PQ4skYG8c9j7c835d7rOcGai/qr7PmvAFxTBwMPg0n2VNOOJ5 KkP+xqxkTWNxfq5af47pwFhxQ+gI535/8Hg4Py+5tIBUnpVpw+uUqHNdiGy1We0e6P7C U3pDYJNh9iAbAGww3qtuHQ2C6EI76iWRqwRdduT/OiYZNMX9ZOvWrl/LOZQlW9gSIr1c Lza0R/5guKEDeTbh4LO7VrsbCV1JlyXIRO9IliK93CHvkIlqHwTidtABkP6MtO1RLgI8 0futdZOP85C/BHdhcmoHGmhTFD1t2/pn5mxbgN3B6aATye6KVk+2Hm+OkS0WCKlV7WAR mPUQ== 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=vqWqlRo1t8unIB3Z/gPDCFXryTe+VxOxmZbywII60x4=; b=AWctxxef1o6Q6+IFeQ6P5ZEJjIe+GeNoGEI6anmxVDkF/YQ922wF9k31GQWzUFlCq+ KjFN0GL11IckHxGIcJDZ6PEuyv1pM6CKC+vaIbxLhRJz5sqBkhnSlEJ3EuvDalQvEmlI 5sdJswyU38EgJDkezF9S/cHmOLDslmzCRvcZqFyRbHcloqeMlKLxuwPl5fkJiq1OpNr1 cAQXdmp69AFOYjUy0JdXy23+pfxbjPhEbSfpxcpPHuMLl89xCfNJerWDr1qQo9tI3guw NKuZpJEEoysURhxuxBYJmCt23648v4ez1/CgtbtmUBBizBELMuMISXqy6StiMKqmKpQG D/dw== X-Gm-Message-State: AOAM5337AbS3SLaz/y1Zq/xocVnnz0OELTgQA7XF0o5ip7HYuNfvHes9 A5K6HNPY8P9/V/pSShP3ilaCasTJbXAwCAs7MQvM/CAP8h8= X-Google-Smtp-Source: ABdhPJwiG5f14ptUggSSt+hUanG2tnouIAtbpU1JD68oO5A0s7qMCGnueWGVnCFx9fN6AZ33rumu5oXEfhtT2qh7sVs= X-Received: by 2002:a4a:ea2b:: with SMTP id y11mr285770ood.42.1620720257457; Tue, 11 May 2021 01:04:17 -0700 (PDT) MIME-Version: 1.0 References: <20210510094915.1909484-1-maz@kernel.org> <20210510094915.1909484-3-maz@kernel.org> In-Reply-To: <20210510094915.1909484-3-maz@kernel.org> From: Fuad Tabba Date: Tue, 11 May 2021 09:03:40 +0100 Message-ID: Subject: Re: [PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace To: Marc Zyngier Cc: kvm@vger.kernel.org, "open list:KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)" , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , Zenghui Yu , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com, stable@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_010421_413690_7158DAAC X-CRM114-Status: GOOD ( 14.74 ) /bin/ln: failed to access 'reaver_cache/texts/20210511_010421_413690_7158DAAC': No such file or directory X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_010421_413690_7158DAAC X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, > KVM: arm64: Commit pending PC adjustemnts before returning to userspace s/adjustments/adjustments On Mon, May 10, 2021 at 10:49 AM Marc Zyngier wrote: > > KVM currently updates PC (and the corresponding exception state) > using a two phase approach: first by setting a set of flags, > then by converting these flags into a state update when the vcpu > is about to enter the guest. > > However, this creates a disconnect with userspace if the vcpu thread > returns there with any exception/PC flag set. In this case, the exposed > context is wrong, as userpsace doesn't have access to these flags > (they aren't architectural). It also means that these flags are > preserved across a reset, which isn't expected. > > To solve this problem, force an explicit synchronisation of the > exception state on vcpu exit to userspace. As an optimisation > for nVHE systems, only perform this when there is something pending. I've tested this with a few nvhe and vhe tests that exercise both __kvm_adjust_pc call paths (__kvm_vcpu_run and kvm_arch_vcpu_ioctl_run), and the tests ran as expected. I'll do the same for v2 when you send it out. Cheers, /fuad _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel