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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 5EC2AC76186 for ; Wed, 24 Jul 2019 18:25:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 357062190F for ; Wed, 24 Jul 2019 18:25:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bXFAT299" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 357062190F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2mFOicrGFb5SSpiFBQ6ye3EVnGuo818VGdw0JqcLdxU=; b=bXFAT299Mwhb1W yR9reZwGdoG245ng7Kitb3RbKVpPfCnbfoCIGvlufP5D4ostzOJaWlT1YnfogndOBd5KorjAas6dJ 1yzReQUrlZ/9VOI3BW5NaOQU6qigg/0ILm416lfE6zJpyfs5eVrW8US54pSlq77nKmNn/bdWrXjAF be8AkoWu6ZLTgvWXbmQO4wapKNOqMm3Sp4Tl1SaJG0+AJ7/eQV3tPG7ETOSCPjOUCJ9n0DZMYnmhL BKWXCXYvp+nK4ElKj3v6yTFaXSaEKHIWRXM+TvOotvDk+Fyf3EycXDcmq24YC2lCxpcDQEY+pu2nU j0SlaSYBRgFw/nFEAKQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hqLxE-0004ZE-4n; Wed, 24 Jul 2019 18:25:32 +0000 Received: from mail-qt1-f194.google.com ([209.85.160.194]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hqLxA-0004Xw-Cq for linux-arm-kernel@lists.infradead.org; Wed, 24 Jul 2019 18:25:30 +0000 Received: by mail-qt1-f194.google.com with SMTP id x22so41537180qtp.12 for ; Wed, 24 Jul 2019 11:25:25 -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:in-reply-to; bh=/8SpAXACt/H0ZjS+gW4ox0Hhxo1Ofk7o0k1709Jn7z0=; b=kBMdt7mhl6Ee0RybYGHb4nNiEH4KO3l/Y278/GL7PUUW83W5DV8eh18xHLXiNDrhGu o7IfKsU5lcW/OdhDIJZmy2rGhT/Vgt9Cb92r/FnHh/O7rmvSyTl07Nx1iwFkjGuYMCRo P+yrp+3qxsuUle2BfH3eKKiaDlrL9p4/rV8GYa5B2xxo/7J4xTw1U1iPjVR9RvjT/PKN 9OBSKoHpHkfpINo4nr2Yb6h94nueDOVRFhUMtvCv9PX8nnekVhV1uw6aXklfxXgLVTom RDTdthuc6V9XyVZ2Wkt9boGl2/b2l7I8nwCuvg4RHZukkqOGrhkmTCzFdncsYKJ97lF3 nduw== X-Gm-Message-State: APjAAAWzqJPy96JwBjJh46jqMrKjzy+V4nQCKIahNF+PjVm8POSZkPwX JB9mQiV/GfqoEouEwkFCqHUzFg== X-Google-Smtp-Source: APXvYqxChd/0aII9lYKOFDT2kMgtEOZZfG9pHDvB+TKQrkk+gyvE7N4AF8TKeYtvP4hnErvwYvbJPQ== X-Received: by 2002:ac8:74cb:: with SMTP id j11mr54557383qtr.67.1563992725087; Wed, 24 Jul 2019 11:25:25 -0700 (PDT) Received: from redhat.com (bzq-79-181-91-42.red.bezeqint.net. [79.181.91.42]) by smtp.gmail.com with ESMTPSA id z19sm22080696qkg.28.2019.07.24.11.25.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 11:25:24 -0700 (PDT) Date: Wed, 24 Jul 2019 14:25:15 -0400 From: "Michael S. Tsirkin" To: Jason Gunthorpe Subject: Re: WARNING in __mmdrop Message-ID: <20190724142417-mutt-send-email-mst@kernel.org> References: <20190723010156-mutt-send-email-mst@kernel.org> <124be1a2-1c53-8e65-0f06-ee2294710822@redhat.com> <20190723032800-mutt-send-email-mst@kernel.org> <20190723062221-mutt-send-email-mst@kernel.org> <9baa4214-67fd-7ad2-cbad-aadf90bbfc20@redhat.com> <20190723110219-mutt-send-email-mst@kernel.org> <20190724040238-mutt-send-email-mst@kernel.org> <20190724165317.GD28493@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190724165317.GD28493@ziepe.ca> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190724_112528_438819_EEE3D953 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, peterz@infradead.org, Jason Wang , ldv@altlinux.org, james.bottomley@hansenpartnership.com, linux-mm@kvack.org, namit@vmware.com, mingo@kernel.org, elena.reshetova@intel.com, keescook@chromium.org, aarcange@redhat.com, davem@davemloft.net, hch@infradead.org, christian@brauner.io, syzbot , syzkaller-bugs@googlegroups.com, jglisse@redhat.com, viro@zeniv.linux.org.uk, linux-arm-kernel@lists.infradead.org, wad@chromium.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, luto@amacapital.net, ebiederm@xmission.com, akpm@linux-foundation.org, guro@fb.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 24, 2019 at 01:53:17PM -0300, Jason Gunthorpe wrote: > On Wed, Jul 24, 2019 at 04:05:17AM -0400, Michael S. Tsirkin wrote: > > On Wed, Jul 24, 2019 at 10:17:14AM +0800, Jason Wang wrote: > > > So even PTE is read speculatively before reading invalidate_count (only in > > > the case of invalidate_count is zero). The spinlock has guaranteed that we > > > won't read any stale PTEs. > > > > I'm sorry I just do not get the argument. > > If you want to order two reads you need an smp_rmb > > or stronger between them executed on the same CPU. > > No, that is only for unlocked algorithms. > > In this case the spinlock provides all the 'or stronger' ordering > required. > > For invalidate_count going 0->1 the spin_lock ensures that any > following PTE update during invalidation does not order before the > spin_lock() > > While holding the lock and observing 1 in invalidate_count the PTE > values might be changing, but are ignored. C's rules about sequencing > make this safe. > > For invalidate_count going 1->0 the spin_unlock ensures that any > preceeding PTE update during invalidation does not order after the > spin_unlock > > While holding the lock and observing 0 in invalidating_count the PTE > values cannot be changing. > > Jason Oh right. So prefetch holds the spinlock the whole time. Sorry about the noise. -- MST _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel