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.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 E56E0C04AA7 for ; Mon, 13 May 2019 16:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C22CF20578 for ; Mon, 13 May 2019 16:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730755AbfEMQmU (ORCPT ); Mon, 13 May 2019 12:42:20 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:39806 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729741AbfEMQmU (ORCPT ); Mon, 13 May 2019 12:42:20 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::3d8]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 19DB514E25407; Mon, 13 May 2019 09:42:19 -0700 (PDT) Date: Mon, 13 May 2019 09:42:18 -0700 (PDT) Message-Id: <20190513.094218.1962516460150696760.davem@davemloft.net> To: jasowang@redhat.com Cc: mst@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, hch@infradead.org, James.Bottomley@HansenPartnership.com, aarcange@redhat.com, tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org, dvhart@infradead.org Subject: Re: [PATCH net] vhost: don't use kmap() to log dirty pages From: David Miller In-Reply-To: <1557725265-63525-1-git-send-email-jasowang@redhat.com> References: <1557725265-63525-1-git-send-email-jasowang@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 13 May 2019 09:42:19 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Wang Date: Mon, 13 May 2019 01:27:45 -0400 > Vhost log dirty pages directly to a userspace bitmap through GUP and > kmap_atomic() since kernel doesn't have a set_bit_to_user() > helper. This will cause issues for the arch that has virtually tagged > caches. The way to fix is to keep using userspace virtual > address. Fortunately, futex has arch_futex_atomic_op_inuser() which > could be used for setting a bit to user. > > Note there're several cases that futex helper can fail e.g a page > fault or the arch that doesn't have the support. For those cases, a > simplified get_user()/put_user() pair protected by a global mutex is > provided as a fallback. The fallback may lead false positive that > userspace may see more dirty pages. > > Cc: Christoph Hellwig > Cc: James Bottomley > Cc: Andrea Arcangeli > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Darren Hart > Fixes: 3a4d5c94e9593 ("vhost_net: a kernel-level virtio server") > Signed-off-by: Jason Wang I want to see a review from Michael for this change before applying.