Received: by 2002:a17:90a:37a3:0:0:0:0 with SMTP id v32csp13122974pjb; Fri, 26 Jul 2019 05:40:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9qlu0OIfhncBUyQ/5xnGtl4yZRQf8GDwL/cr5nwPQ/ud0FCUHZX2m7krFL7OGH06VStwe X-Received: by 2002:a17:90a:9903:: with SMTP id b3mr97232113pjp.80.1564144832163; Fri, 26 Jul 2019 05:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564144832; cv=none; d=google.com; s=arc-20160816; b=aeMB+44lgq45Fen8rDSjA05E9vv3f9sLJaa179TIqPfPsEWl60bF3DERg3JY8EpW+D oONTM6/sKH82VwfYHlaTwResHTlW+PjrUoVKL3HRhSw97t67a/SXqjot3xks3acqsj5F UmeRstMdLtykSUWwkHt+hZ7Dm/A35ZgRfZbk84Dm+XMW8YDFy32ZkUs6Ar3pGJORgG5v v71/BpxBcbG+ItIO5Ed25IE1Qx1wHzLSD3/d5tDwWEaF/2wTSBl84VAOWr7D0peVspNu oJok3Lvy0FqDRAJ3r+3GZ753TQOhL3xPTz9hhkBsUFsqSgH1JQZ7KgTu/lD5GSl3aHta wprw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7AAahzA3S5OmAp3WHwhPen11x5qmdYBmT/Y66i6DKGs=; b=lLKBFlWKM7RzF2dBJzG46BJw+0y5GCmsHsHlpln3+ZZJvja73/z70H8LxQ87RlLR8S sHmUdjASdMN8g5DnYnuY15HEzDLkS8XqoQjeOQDoLFUtfSY22+z9z0VNdRePqbBT+cFN UqGLXxw//T5X0aOe6R32HHB6fgddoCc4sBhjN8yN/zoNiIRtjY+Mc60dxX1ZXHyifv+/ rwOc7LvzeMWFwWfsHIh4RvoGWQ9RGsBsGuZ9HuRZV9t+q53Wa8WIq6cA2fhNSaqm9HkU bUcxcq/BtPJ2enBwengBHV4cxLIUrkYLfSb0qIzaeEU8BK+F7CxAwWKZ6bj8ejJkHV7b DeWQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 q39si17925328pjc.55.2019.07.26.05.40.14; Fri, 26 Jul 2019 05:40:32 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727368AbfGZMiZ (ORCPT + 99 others); Fri, 26 Jul 2019 08:38:25 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41124 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbfGZMiZ (ORCPT ); Fri, 26 Jul 2019 08:38:25 -0400 Received: by mail-qt1-f195.google.com with SMTP id d17so52304013qtj.8 for ; Fri, 26 Jul 2019 05:38:24 -0700 (PDT) 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:content-transfer-encoding :in-reply-to; bh=7AAahzA3S5OmAp3WHwhPen11x5qmdYBmT/Y66i6DKGs=; b=YYkQH+I2kXeXP8QCpr6wYUOhl9Px++oLGsWWWHll8Z1D21N8du1wnVss4IB1hzSEGu dnc//vP8AJVLBliI5LkOq82awWx1S4Hp8wEmOwIudjrIPjkepphE4tfcFDhiocAJjbXy lDR9lOyb6urinbe1Gjk6QAzghyAylYjRok2/YhVGyVipHOS/XN8y7jy9+pkWFdktUFJU GAIAktK34o2et/pN33eqaz41yn6fNkIrol4VesfDWF7UWA0cb4B2ZlzlNf5Y+EBqZM0g IvCTPQ0Pe1o0sakBfH0bBnczhDxstoxkM5y/eqDWNRWhl9SCh3tp9TJEbvydURSR/c7J PsQA== X-Gm-Message-State: APjAAAWqctKFU8pPIZD14/amALXFYXXEd3x5DMaWcPtuOk7ZeFBd7gdW JeuLRDw7sUdpE6iBIZWXL9YfZf+5CoFf7A== X-Received: by 2002:ac8:37b8:: with SMTP id d53mr65290476qtc.227.1564144703827; Fri, 26 Jul 2019 05:38:23 -0700 (PDT) Received: from redhat.com ([212.92.104.165]) by smtp.gmail.com with ESMTPSA id v7sm25082729qte.86.2019.07.26.05.38.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 05:38:23 -0700 (PDT) Date: Fri, 26 Jul 2019 08:38:13 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: syzbot , aarcange@redhat.com, akpm@linux-foundation.org, christian@brauner.io, davem@davemloft.net, ebiederm@xmission.com, elena.reshetova@intel.com, guro@fb.com, hch@infradead.org, james.bottomley@hansenpartnership.com, jglisse@redhat.com, keescook@chromium.org, ldv@altlinux.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, luto@amacapital.net, mhocko@suse.com, mingo@kernel.org, namit@vmware.com, peterz@infradead.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk, wad@chromium.org Subject: Re: WARNING in __mmdrop Message-ID: <20190726082837-mutt-send-email-mst@kernel.org> References: <20190723051828-mutt-send-email-mst@kernel.org> <20190725012149-mutt-send-email-mst@kernel.org> <55e8930c-2695-365f-a07b-3ad169654d28@redhat.com> <20190725042651-mutt-send-email-mst@kernel.org> <84bb2e31-0606-adff-cf2a-e1878225a847@redhat.com> <20190725092332-mutt-send-email-mst@kernel.org> <11802a8a-ce41-f427-63d5-b6a4cf96bb3f@redhat.com> <20190726074644-mutt-send-email-mst@kernel.org> <5cc94f15-b229-a290-55f3-8295266edb2b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5cc94f15-b229-a290-55f3-8295266edb2b@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 26, 2019 at 08:00:58PM +0800, Jason Wang wrote: > > On 2019/7/26 下午7:49, Michael S. Tsirkin wrote: > > On Thu, Jul 25, 2019 at 10:25:25PM +0800, Jason Wang wrote: > > > On 2019/7/25 下午9:26, Michael S. Tsirkin wrote: > > > > > Exactly, and that's the reason actually I use synchronize_rcu() there. > > > > > > > > > > So the concern is still the possible synchronize_expedited()? > > > > I think synchronize_srcu_expedited. > > > > > > > > synchronize_expedited sends lots of IPI and is bad for realtime VMs. > > > > > > > > > Can I do this > > > > > on through another series on top of the incoming V2? > > > > > > > > > > Thanks > > > > > > > > > The question is this: is this still a gain if we switch to the > > > > more expensive srcu? If yes then we can keep the feature on, > > > > > > I think we only care about the cost on srcu_read_lock() which looks pretty > > > tiny form my point of view. Which is basically a READ_ONCE() + WRITE_ONCE(). > > > > > > Of course I can benchmark to see the difference. > > > > > > > > > > if not we'll put it off until next release and think > > > > of better solutions. rcu->srcu is just a find and replace, > > > > don't see why we need to defer that. can be a separate patch > > > > for sure, but we need to know how well it works. > > > > > > I think I get here, let me try to do that in V2 and let's see the numbers. > > > > > > Thanks > > > It looks to me for tree rcu, its srcu_read_lock() have a mb() which is too > expensive for us. I will try to ponder using vq lock in some way. Maybe with trylock somehow ... > If we just worry about the IPI, With synchronize_rcu what I would worry about is that guest is stalled because system is busy because of other guests. With expedited it's the IPIs... > can we do something like in > vhost_invalidate_vq_start()? > >         if (map) { >                 /* In order to avoid possible IPIs with >                  * synchronize_rcu_expedited() we use call_rcu() + >                  * completion. > */ > init_completion(&c.completion); >                 call_rcu(&c.rcu_head, vhost_finish_vq_invalidation); > wait_for_completion(&c.completion); >                 vhost_set_map_dirty(vq, map, index); > vhost_map_unprefetch(map); >         } > > ? Why would that be faster than synchronize_rcu? > > > There's one other thing that bothers me, and that is that > > for large rings which are not physically contiguous > > we don't implement the optimization. > > > > For sure, that can wait, but I think eventually we should > > vmap large rings. > > > Yes, worth to try. But using direct map has its own advantage: it can use > hugepage that vmap can't > > Thanks Sure, so we can do that for small rings. -- MST