Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1385866pxb; Fri, 21 Jan 2022 17:14:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQ9zzyDajjnx6TYsHlrbXSw7HyYSIv4uiZlrkQHQG2fBiT5In77DkTQIdkct8HWhvAJy1V X-Received: by 2002:a17:902:b495:b0:14a:bea2:24e4 with SMTP id y21-20020a170902b49500b0014abea224e4mr5848718plr.79.1642814077563; Fri, 21 Jan 2022 17:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642814077; cv=none; d=google.com; s=arc-20160816; b=E8uQFSh0WkIskmKVi8SgudkPgUdvd7sDrY5GVHhFIeJGyU9EnPRjswz+RLlqwz9rhy AENUr8iJnWYNx4K5Ql+aIXZhOrPDvm/t6YuutNahMrq3SaSvR5+MnEzo9mwm+3+5/uLK AdrXD09vboR89TMlxS5WTWd3FluV1X9KDFUguNA6TtOoyluTLphjpA+vjs5UKuG0M0yH 7TPUIra4ECqQWbaAqYkNOIfFWTvJ7ESkduxWQ4hmiXdi3EIYXcNZ2OOOVgBn8OoNKhmr 2N6v2NtjnJ2bFx1Ny74KKKxfAyO/16DYQY/4ZKkoqBNTCFfmSK2kvXYaEAJQUoNjtcfe f3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=HaYcy+RTerx8o2FxKdMrIDfIWJqrTTw7VrV/vp6B9Bw=; b=CIj1fUmmsFI7maGaXjd8cxkcW5N2dtsMtcZAqk6mwJA65f7xLgyxBdCZOpMQ9DM3wC f944IW6SP9mwG5eZBjdZqX0Sb0jRhPjDuVVEzZWoAm9ewkK6Fi0FXkS0xAsOESf6MytF 1odQTkJELmmn1YiNagdBocCD1AtEOx9H1T/eMKgLjr0E/EpewfaUXAXbjZwVlcJ4tgBU CJod0RInSH1qHhKabj0hGZYMb2OZ6fifqaURejM7aglDOCHTpK/aJyNXoRBxHP1WJnBt dNBX1/m7XBdEQXDAfYHKgBRlTkhcxf+blE0qTgVOlen03l44LBGsiiiLhUckN6V/4/uG +98w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh5si17871509pjb.155.2022.01.21.17.14.25; Fri, 21 Jan 2022 17:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380453AbiAUMoZ (ORCPT + 99 others); Fri, 21 Jan 2022 07:44:25 -0500 Received: from foss.arm.com ([217.140.110.172]:51012 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380431AbiAUMoU (ORCPT ); Fri, 21 Jan 2022 07:44:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 196AA1FB; Fri, 21 Jan 2022 04:44:18 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.1.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB1F53F766; Fri, 21 Jan 2022 04:44:12 -0800 (PST) Date: Fri, 21 Jan 2022 12:44:05 +0000 From: Mark Rutland To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, aleksandar.qemu.devel@gmail.com, alexandru.elisei@arm.com, anup.patel@wdc.com, aou@eecs.berkeley.edu, atish.patra@wdc.com, borntraeger@linux.ibm.com, bp@alien8.de, catalin.marinas@arm.com, chenhuacai@kernel.org, dave.hansen@linux.intel.com, frankja@linux.ibm.com, frederic@kernel.org, gor@linux.ibm.com, hca@linux.ibm.com, james.morse@arm.com, jmattson@google.com, joro@8bytes.org, luto@kernel.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, nsaenzju@redhat.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, seanjc@google.com, suzuki.poulose@arm.com, svens@linux.ibm.com, tglx@linutronix.de, tsbogend@alpha.franken.de, vkuznets@redhat.com, wanpengli@tencent.com, will@kernel.org Subject: Re: [PATCH v2 4/7] kvm/mips: rework guest entry logic Message-ID: References: <20220119105854.3160683-1-mark.rutland@arm.com> <20220119105854.3160683-5-mark.rutland@arm.com> <20220120164455.GA15464@C02TD0UTHF1T.local> <20220120171551.GB15464@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 20, 2022 at 06:29:25PM +0100, Paolo Bonzini wrote: > On 1/20/22 18:15, Mark Rutland wrote: > > As above, we'll also need the guest_state_{enter,exit}() calls > > surrounding this (e.g. before that local_irq_enable() at the start of > > kvm_mips_handle_exit(), > > Oh, indeed. And there is also an interrupt-enabled area similar to s390's, > in both vcpu_run and the exception handler entry point (which falls through > to the exit handler created by kvm_mips_build_exit). For example: > > /* Setup status register for running guest in UM */ > uasm_i_ori(&p, V1, V1, ST0_EXL | KSU_USER | ST0_IE); > UASM_i_LA(&p, AT, ~(ST0_CU0 | ST0_MX | ST0_SX | ST0_UX)); > uasm_i_and(&p, V1, V1, AT); > uasm_i_mtc0(&p, V1, C0_STATUS); > uasm_i_ehb(&p); > > I'd rather get rid altogether of the EQS for MIPS. Ok; I'm not immediately sure how to do that without invasive changes around the context tracking bits. Did you have a specific approach in mind, or was that just a general statement? > > and that needs to happen in noinstr code, etc. > > There are bigger problems with instrumentation, because the > runtime-generated code as far as I can tell is not noinstr. The generated sequences themselves are not a problem -- they're not compiler-instrumented, and kprobes will reject them since they live in a kzalloc()'d buffer which is outside of kernel text. Those call tlbmiss_handler_setup_pgd(), but that itself is runtime-generated, and AFAICT doesn't call anything. It is placed within the kernel text, but it could be blacklisted from kprobes. Have I missed something there? Thanks, Mark.