Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp322019ybb; Thu, 28 Mar 2019 03:18:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzpf3kOj4X4MdA0dJaMmcLOOLFJq2BbHsm5jYljOKHpb+wP+nhjq4o/QydydL1tuZt2sh1 X-Received: by 2002:a65:6150:: with SMTP id o16mr9133498pgv.285.1553768307288; Thu, 28 Mar 2019 03:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553768307; cv=none; d=google.com; s=arc-20160816; b=Gu/OHk2YGkROLVLsW2bTKMuS+H6Onb+5O4fRNNhHe6VrnBMUCZ5DDHFbw2mfy9sSdh tA+KMQEScUbIkJqTKsl+nNak3z9kUPHBgFbylm+jAB4/QFvksL2IKbPrc1ZJJmwHorp+ gOgzP5iOEGPEXXlLVGNi+Ivokx+TQhWeedSqzrt8jIt5Yj/nWH1TbEVcIJ6+YhkCsgOu u0+AUbABVCulygbQl0Z2qtHTUlfTqzPsy/FVQaCV3l1vJeQ+yBEI9qJKlVDuQpv2riTi oTBA9vzPytnztSDb3/otQec5jULu/Ud2zS/hlF/r8lxyVOdG1kSydnIa3G76QlYiIDYp ui+w== 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-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=DIiGSTjFPAf5GXSy9Y1cEW8j++hKOnwW/XNTp1y9Dio=; b=O2q57vDUitetM/z/RtU8EgwgsZorsH3y5Wj5YebNDPLaC8ZAQUJjznDSgV35KQW7HR /uyrqVEc8+f7TRFWMRoxDcp6O3wguNDSje56kY+fQf7EgsKiCkM1Ftu95UfTQKqQFQB6 iY1Ktot8nuh/x9fJ46RfwxkMhzKRRNKqMVAPhcjWkhbNhQ3lyz16Q289YJhL0VRqZUks oQ0jrtmUpYsWLXx2/adaKb1h8Ra6Ja6KZNCkNitoadjmOBZhKZNaB/yIBtSPgDS6CASQ 946zIl8rYIfitrj5ZkHc96/hvitdI7gCTTCppTHTxemznPIB+RoVyO+sGd3nyUi7Lb28 qYng== 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 q11si20304174pgh.548.2019.03.28.03.18.11; Thu, 28 Mar 2019 03:18:27 -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 S1726879AbfC1KRa convert rfc822-to-8bit (ORCPT + 99 others); Thu, 28 Mar 2019 06:17:30 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:52697 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbfC1KRa (ORCPT ); Thu, 28 Mar 2019 06:17:30 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1h9S6A-0001wj-QL; Thu, 28 Mar 2019 11:17:26 +0100 Date: Thu, 28 Mar 2019 11:17:26 +0100 From: Sebastian Andrzej Siewior To: Juri Lelli , Peter Zijlstra Cc: linux-rt-users , LKML , Thomas Gleixner , Daniel Bristot de Oliveira , Clark Williams Subject: Re: [RT WARNING] DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current) with fsfreeze (4.19.25-rt16) Message-ID: <20190328101726.u2y7v46mo66i5aoi@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20190326093421.GA29508@localhost.localdomain> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-03-26 10:34:21 [+0100], Juri Lelli wrote: > Hi, Hi, … > # for I in `seq 10`; do fsfreeze -f ./testmount; sleep 1; fsfreeze -u ./testmount; done > > ------------[ cut here ]------------ > DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current) > WARNING: CPU: 10 PID: 1226 at kernel/locking/rtmutex-debug.c:145 debug_rt_mutex_unlock+0x9b/0xb0 > Modules linked in: xfs [...] > CPU: 10 PID: 1226 Comm: fsfreeze Not tainted 4.19.25-rt16 #2 > Hardware name: LENOVO 30B6S2F900/1030, BIOS S01KT61A 09/28/2018 > RIP: 0010:debug_rt_mutex_unlock+0x9b/0xb0 … > __rt_mutex_unlock+0x45/0x80 > percpu_up_write+0x4b/0x60 > thaw_super_locked+0xdb/0x110 … > AFAIU, this is a legit warning, since > > fsfreeze -f ./testmount grabs rt_mutexes embedded into > sb->s_writers.rw_sem[SB_FREEZE_LEVELS] (rt-rwsem) as part of executing > sb_wait_write() (for each FREEZE_LEVEL) in freeze_super(). > > We then return to userspace. > > fsfreeze -u ./testmount unlocks the rt_mutexes while doing > sb_freeze_unlock() in thaw_super_locked(). This is a different process > w.r.t. the one that did the freeze above. > > I noticed that a very similar problem was fixed (for !rt rwsem) by > 5a817641f68a ("locking/percpu-rwsem: Annotate rwsem ownership transfer > by setting RWSEM_OWNER_UNKNOWN"). However, RT has of course to deal with > PI, so I wonder if there is an easy fix for this problem. > > Suggestions? So we leave to userland with an acquired rtmutex. And lockdep doesn't complain because lockdep_sb_freeze_release() / lockdep_sb_freeze_acquire() informs that everything is okay. I have no idea, PeterZ? The rwsem is not ownerless afaik. > Thanks, > > - Juri Sebastian