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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=unavailable 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 5B3C1C43381 for ; Thu, 7 Mar 2019 15:47:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32DB920652 for ; Thu, 7 Mar 2019 15:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfCGPr1 (ORCPT ); Thu, 7 Mar 2019 10:47:27 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:42703 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfCGPr1 (ORCPT ); Thu, 7 Mar 2019 10:47:27 -0500 Received: by mail-qk1-f194.google.com with SMTP id y140so9273109qkb.9 for ; Thu, 07 Mar 2019 07:47:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BhTxD3ySC1uQNcQaurRgNi8lE2OWakmfxk2tvcIPUn4=; b=bxu+YtS/5OMGpVtfGVvxF947SGpS2LIWU9NytOol3Y7TswV+b1m9rzcVPtbsrm7pOl Lf+1K+h/ee9h6TeeAKkv+0a2p66YMYLV59rjaw4i72I3e6r/vK01xrazZEiljJkf8W86 4/r3600UF/eCftEk3+mr2xIAPC774HWdytuccJGFIeytHq8TX3ETliVYfJNeXXk6Liv/ UNzzrC2ojl6HBKcD34+KQr1pQ88cFvRWb8Nv5FJOVyWsOtGODTwiP7K+356dkMgyPlcX 65KCQ2r9hb7w+uQBcM8rAZZOq/rwG03joYJSFBe89BuyX5OPAfxicT5GHAu2jdFtTSZX X0sQ== X-Gm-Message-State: APjAAAXl8jPPuNr4iHW9feuePIeRMuGvf4zf52Lo/xinlDHPz+OKXWfG 6w4qEYDMNZNcoFRxMwWizPXTlg== X-Google-Smtp-Source: APXvYqwmzGcW5lj5Q8CC2/neDVhy2nmaELi4a1GVCRW653iKSH/SbNxUxxC4uElvkGE3ZhcVB5QJ0g== X-Received: by 2002:a05:620a:148a:: with SMTP id w10mr10023352qkj.172.1551973646133; Thu, 07 Mar 2019 07:47:26 -0800 (PST) Received: from redhat.com (pool-173-76-246-42.bstnma.fios.verizon.net. [173.76.246.42]) by smtp.gmail.com with ESMTPSA id s49sm3115748qtk.7.2019.03.07.07.47.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Mar 2019 07:47:25 -0800 (PST) Date: Thu, 7 Mar 2019 10:47:22 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, peterx@redhat.com, linux-mm@kvack.org, aarcange@redhat.com Subject: Re: [RFC PATCH V2 5/5] vhost: access vq metadata through kernel virtual address Message-ID: <20190307103503-mutt-send-email-mst@kernel.org> References: <1551856692-3384-1-git-send-email-jasowang@redhat.com> <1551856692-3384-6-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1551856692-3384-6-git-send-email-jasowang@redhat.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Mar 06, 2019 at 02:18:12AM -0500, Jason Wang wrote: > +static const struct mmu_notifier_ops vhost_mmu_notifier_ops = { > + .invalidate_range = vhost_invalidate_range, > +}; > + > void vhost_dev_init(struct vhost_dev *dev, > struct vhost_virtqueue **vqs, int nvqs, int iov_limit) > { I also wonder here: when page is write protected then it does not look like .invalidate_range is invoked. E.g. mm/ksm.c calls mmu_notifier_invalidate_range_start and mmu_notifier_invalidate_range_end but not mmu_notifier_invalidate_range. Similarly, rmap in page_mkclean_one will not call mmu_notifier_invalidate_range. If I'm right vhost won't get notified when page is write-protected since you didn't install start/end notifiers. Note that end notifier can be called with page locked, so it's not as straight-forward as just adding a call. Writing into a write-protected page isn't a good idea. Note that documentation says: it is fine to delay the mmu_notifier_invalidate_range call to mmu_notifier_invalidate_range_end() outside the page table lock. implying it's called just later. -- MST