Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6009744ybv; Wed, 12 Feb 2020 04:27:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxzE7d52qDvdTtv4MinurxvtQmz0SFX1Fl0HfdJtS6iWoxNohYKLNeWlOcrnTtD/ehcCVE4 X-Received: by 2002:a9d:7757:: with SMTP id t23mr9490349otl.315.1581510448874; Wed, 12 Feb 2020 04:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581510448; cv=none; d=google.com; s=arc-20160816; b=yzPm/8OCj36U/V0wOMxNawwbkTiwflyTfc9yjO5mqbezIGYeOuDe1l4k2Z57Av+Y5A qAmiWXaQFQ2GeqYMgdaKujUNVBnz+SIftAygdETAMYsVQGgVwFekRlqi35Gn7w6KtVRe hY74Yl8ILmY5U1+ArVPGwChV9YE/nRv7o2Y8i7uc0gsbChd3RuN9SJEtG/ASTrcOZwW4 Rx8wUko18oBsyIbNO5kArP5TBm9USszPGgVumigkm+tzeJTv9XxlGRrtN1cY1MMKCEZ4 HEV3K8cB2MjKv0D+hWfN+vTelmdR2oQBHdv3q6valvlB6opnjJWtz3VMVwofB4Ve1bpr yXaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=v7SHYl6d5ReTOaQmbSZgfq/qRRUXKZndS7RBXf8LMdk=; b=IJ2h/gvn7GchLFQXI1f48gXdC4mF/gZGzHHdI9nR11llCPOZrENaSwX9BwmKituy3S PlhIdbO3xda9RAd2lRFQ5ETgXdM4OsL7THjF+PPnPXrgERVMpNhEPjUcTQr19+a6oUov c1JO2as8wYVf4bh5yKTFAlMy3Hvz7RLnd6Y7s09LB1rkawUDciIq1MKSCmnwLp8FSVaP POufcsg2gPKRyrPnPdZACwObc+ux1jnLNj8kMqpAph+9mDvSf3BxVRariyWD0TYY66nt fTEl97Upj4WgzX6SYAlzLWEmc2UvyZqVxYfaIJ9M73kuHYZpDY/Ft0FUeuxwZyH9og/Y VWKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AeBPc7Rg; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f194si3415216oig.243.2020.02.12.04.27.16; Wed, 12 Feb 2020 04:27:28 -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=@redhat.com header.s=mimecast20190719 header.b=AeBPc7Rg; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727970AbgBLMZp (ORCPT + 99 others); Wed, 12 Feb 2020 07:25:45 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:30078 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727429AbgBLMZp (ORCPT ); Wed, 12 Feb 2020 07:25:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581510344; 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; bh=v7SHYl6d5ReTOaQmbSZgfq/qRRUXKZndS7RBXf8LMdk=; b=AeBPc7RgVLedsh804rYNTuNH74qq6ttTHLfsc/71mgMugnb00ZP35rPWMai/rYQI0z1dw7 PO4zDDEF8OeD/gcmIhsoEXB/xb28mv8d3brpV3O4W124CQqSll3rkfNER6lg0ZEt4MPdYb eMz/yWq9tmLxZTVQeVE8XBx1+bkGVyA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-0HYYvo-PMLeHlauKIDnAng-1; Wed, 12 Feb 2020 07:25:33 -0500 X-MC-Unique: 0HYYvo-PMLeHlauKIDnAng-1 Received: by mail-wr1-f69.google.com with SMTP id d8so737594wrq.12 for ; Wed, 12 Feb 2020 04:25:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=v7SHYl6d5ReTOaQmbSZgfq/qRRUXKZndS7RBXf8LMdk=; b=r0hqVRGGr5xka43+pXxXhkcZ0PVg8xwzrp1e51Clzj1yJNoLpHmW6C/PuyVbo/6cKa 9HkhsTqwOIrHu3beC5tn5NjzZKt2Z9RlQkGqIgQeWkM7CT5Eq7+xI/l0DmwSuz22PpHq vKdDgQV6jsbiXXNmW8eQVUkAyZML5JM5RIVzQ1eOiKghYx12f8dTmeAxMDJ1s6w6uOcj NbjECG+4UXIAEjZWT1hOeueTMtHejeT09fw85F7tSY3lEaac38cbDArKyh7KJCnsR0Nt b10Mr4e8LSC90iQhoSVNpFIXclDqvugLzmRo3w5xotZOaiF+CQS7OQz4no2/7jzOZyFK utcQ== X-Gm-Message-State: APjAAAWCC8NubhyVnprdHB13/YOtAS/PaffZiRERIxCAAbmtOV3lEO6h C0zKoKK3BK1D5Z8eQV4xIxUxyxeKecO0aVeKR+Xjf6Jixq3k9yr6ZR1J9WdegvKStDospzxSgYg Q4hJL30IbEt3niJ9vqy3H/aLB X-Received: by 2002:a5d:6191:: with SMTP id j17mr14382621wru.427.1581510332378; Wed, 12 Feb 2020 04:25:32 -0800 (PST) X-Received: by 2002:a5d:6191:: with SMTP id j17mr14382327wru.427.1581510328245; Wed, 12 Feb 2020 04:25:28 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:652c:29a6:517b:66d9? ([2001:b07:6468:f312:652c:29a6:517b:66d9]) by smtp.gmail.com with ESMTPSA id z11sm388108wrv.96.2020.02.12.04.25.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 04:25:24 -0800 (PST) Subject: Re: [PATCH RFC 0/4] KVM: MIPS: Provide arch-specific kvm_flush_remote_tlbs() To: Peter Xu , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , linux-mips@vger.kernel.org, Vitaly Kuznetsov References: <20200207223520.735523-1-peterx@redhat.com> From: Paolo Bonzini Message-ID: <44ba59d6-39a5-4221-1ae6-41e5a305d316@redhat.com> Date: Wed, 12 Feb 2020 13:25:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20200207223520.735523-1-peterx@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/02/20 23:35, Peter Xu wrote: > [This series is RFC because I don't have MIPS to compile and test] > > kvm_flush_remote_tlbs() can be arch-specific, by either: > > - Completely replace kvm_flush_remote_tlbs(), like ARM, who is the > only user of CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL so far > > - Doing something extra before kvm_flush_remote_tlbs(), like MIPS VZ > support, however still wants to have the common tlb flush to be part > of the process. Could refer to kvm_vz_flush_shadow_all(). Then in > MIPS it's awkward to flush remote TLBs: we'll need to call the mips > hooks. > > It's awkward to have different ways to specialize this procedure, > especially MIPS cannot use the genenal interface which is quite a > pity. It's good to make it a common interface. > > This patch series removes the 2nd MIPS usage above, and let it also > use the common kvm_flush_remote_tlbs() interface. It should be > suggested that we always keep kvm_flush_remote_tlbs() be a common > entrance for tlb flushing on all archs. > > This idea comes from the reading of Sean's patchset on dynamic memslot > allocation, where a new dirty log specific hook is added for flushing > TLBs only for the MIPS code [1]. With this patchset, logically the > new hook in that patch can be dropped so we can directly use > kvm_flush_remote_tlbs(). > > TODO: We can even extend another common interface for ranged TLB, but > let's see how we think about this series first. > > Any comment is welcomed, thanks. > > Peter Xu (4): > KVM: Provide kvm_flush_remote_tlbs_common() > KVM: MIPS: Drop flush_shadow_memslot() callback > KVM: MIPS: Replace all the kvm_flush_remote_tlbs() references > KVM: MIPS: Define arch-specific kvm_flush_remote_tlbs() > > arch/mips/include/asm/kvm_host.h | 7 ------- > arch/mips/kvm/Kconfig | 1 + > arch/mips/kvm/mips.c | 22 ++++++++++------------ > arch/mips/kvm/trap_emul.c | 15 +-------------- > arch/mips/kvm/vz.c | 14 ++------------ > include/linux/kvm_host.h | 1 + > virt/kvm/kvm_main.c | 10 ++++++++-- > 7 files changed, 23 insertions(+), 47 deletions(-) > Compile-tested and queued. MIPS folks, I see that arch/mips/kvm/mmu.c uses pud_index, so it's not clear to me if it's meant to only work if CONFIG_PGTABLE_LEVELS=4 or it's just bit rot. Should I add a "depends on PGTABLE_LEVEL=4" to arch/mips/Kconfig? Paolo