Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1924396ybe; Tue, 3 Sep 2019 05:40:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz36BfpRr3mGXO7Wcr/OfwQMzjF7BhZWBon+9CKhZTyTUH+sO0QuqMbRHjoXrfDsS5/9L4s X-Received: by 2002:a17:90a:2ec3:: with SMTP id h3mr18506613pjs.121.1567514441230; Tue, 03 Sep 2019 05:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567514441; cv=none; d=google.com; s=arc-20160816; b=Rd5/9GKDNrdKkxdxA28RQAkJlu2u6Rc5FVXgLcmjaab3g70M35LkwjPUD69ZbqxiHU +7mToJYQu4wOw/ZSnGEhBXnXmzB+rszPKkoWTbge/fV1TyAosgYxzwIgo/qB3kZkwhYY QUYukRvaZoS/uvarmK27T92BQdyTARMQpJA9NwT/L2MlccJLVPIYt361dVfwwno34MuX 6b1kTDWiEz/ohQ6W1TtUWHlublVXvLk2Ax7laSlBWR6Z/kqr/BVrmTZSeUat6rlZT4ti 634rwa2eQGOfRZwcAHPvbiDhGPeofAw48ZoWcVJKCsDtXP2adMawKojfWB+rLTgfZZ3M I26w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=3lwcJdd0F3CZu8SY9hlpWt556lqjZP1JxTP+9aUcGt0=; b=mviwPSUXE0fnsjxOYiz9dNLagpfmuKZs4GTLPkH7wE2V8gRnHqEnP8L2klYM/Mzdl4 PQpEZzvy4NaUWq9kT0eL9nJN2Au/63Gf46QlS5ijlHHShjh3DtVRE0GFJ9jNTzFrlbyh be/766BIaHrGJ72Wl0hhjnTPgQ/Xt+RDejHOi1xthX2q20QJDoPZm3FEl3JO8m7j3tr/ IUWosC/13lD4n9KY9WyfDbG1+Iq63AZ1Ea4+G3nWgXFGwffAS+fZhkvUZ1xFM+e9HeR+ dO6RSWNgFbEsUTGvxo5tvMbot/BAxAakhpdoL49vXPuF/7toa3oRuNg7sAjPeU5DY1GA E8TQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si6674876pju.10.2019.09.03.05.40.24; Tue, 03 Sep 2019 05:40:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbfICMhv (ORCPT + 99 others); Tue, 3 Sep 2019 08:37:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:58450 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728994AbfICMhv (ORCPT ); Tue, 3 Sep 2019 08:37:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CF030B028; Tue, 3 Sep 2019 12:37:49 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id D3BB9DA8CD; Tue, 3 Sep 2019 14:38:09 +0200 (CEST) Date: Tue, 3 Sep 2019 14:38:09 +0200 From: David Sterba To: Abdul Haleem Cc: linuxppc-dev , mpe , Brian King , chandan , sachinp , David Sterba , Nikolay Borisov , josef@toxicpanda.com, linux-btrfs@vger.kernel.org, linux-kernel Subject: Re: [mainline][BUG][PPC][btrfs][bisected 00801a] kernel BUG at fs/btrfs/locking.c:71! Message-ID: <20190903123809.GC2752@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Abdul Haleem , linuxppc-dev , mpe , Brian King , chandan , sachinp , David Sterba , Nikolay Borisov , josef@toxicpanda.com, linux-btrfs@vger.kernel.org, linux-kernel References: <1567500907.5082.12.camel@abdul> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567500907.5082.12.camel@abdul> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 02:25:07PM +0530, Abdul Haleem wrote: > Greeting's > > Mainline kernel panics with LTP/fs_fill-dir tests for btrfs file system on my P9 box running mainline kernel 5.3.0-rc5 > > BUG_ON was first introduced by below commit Well, technically the bug_on was there already the only change is the handling of the updates of the value. > commit 00801ae4bb2be5f5af46502ef239ac5f4b536094 > Author: David Sterba > Date: Thu May 2 16:53:47 2019 +0200 > > btrfs: switch extent_buffer write_locks from atomic to int > > The write_locks is either 0 or 1 and always updated under the lock, > so we don't need the atomic_t semantics. Assuming the code was correct before the patch, if this got broken one of the above does not hold anymore: * 0/1 updates -- this can be verified in code that all the state transitions are valid, ie. initial 0, locked update to 1, locked update 1->0 * atomic_t -> int behaves differently and the changes of the value get mixed up, eg. on the instruction level where intel architecture does 'inc' while p9 does I-don't-know-what a RMW update? But even with a RMW, this should not matter due to write_lock/write_unlock around all the updates.