From patchwork Fri Jan 1 14:04:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 7939491 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D0FD9F88A for ; Fri, 1 Jan 2016 14:55:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AD2B20553 for ; Fri, 1 Jan 2016 14:55:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6E70E204CF for ; Fri, 1 Jan 2016 14:55:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B5886E3C0; Fri, 1 Jan 2016 06:55:10 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0E6B6E068 for ; Fri, 1 Jan 2016 06:04:28 -0800 (PST) Received: from fsav302.sakura.ne.jp (fsav302.sakura.ne.jp [153.120.85.133]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id u01E4MBi069069; Fri, 1 Jan 2016 23:04:22 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav302.sakura.ne.jp (F-Secure/fsigk_smtp/522/fsav302.sakura.ne.jp); Fri, 01 Jan 2016 23:04:21 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/522/fsav302.sakura.ne.jp) Received: from AQUA (softbank126072091035.bbtec.net [126.72.91.35]) (authenticated bits=0) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id u01E4L3n069061; Fri, 1 Jan 2016 23:04:21 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) To: thellstrom@vmware.com, syeh@vmware.com, charmainel@vmware.com, brianp@vmware.com Subject: Re: [4.4-rc7 / vmwgfx] debugging bug or driver bug? From: Tetsuo Handa References: <201601011414.FBH43224.OFOVMOFFLQtSHJ@I-love.SAKURA.ne.jp> <56865581.4080802@vmware.com> In-Reply-To: <56865581.4080802@vmware.com> Message-Id: <201601012304.GEB18211.FHVOOQMtJLOSFF@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Fri, 1 Jan 2016 23:04:20 +0900 Mime-Version: 1.0 X-Mailman-Approved-At: Fri, 01 Jan 2016 06:55:07 -0800 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Thomas Hellstrom wrote: > Most likely the spin_is_locked() function is not working on non - SMP > systems (well how could it?). An oversight from my side. You are right. I found a description in Documentation/scsi/ChangeLog.megaraid . there are several checks present in the kernel where somebody does a variation on the following: BUG_ON(!spin_is_locked(&some_lock)); so what's wrong about that? nothing, unless you compile the code with CONFIG_DEBUG_SPINLOCK but without CONFIG_SMP ... in which case the BUG() will kill your kernel ... > We should change the BUG_ON line to a lockdep_assert_held(). static __always_inline int spin_is_locked(spinlock_t *lock) { return raw_spin_is_locked(&lock->rlock); } #define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock) include/linux/spinlock_up.h: /* !DEBUG_SPINLOCK */ #define arch_spin_is_locked(lock) ((void)(lock), 0) So, BUG_ON(!spin_is_locked(&man->lock)) was BUG_ON(!0) in my config, and below change fixed this problem. Regards. diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c index 6377e81..4d26de4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c @@ -247,7 +247,7 @@ static void __vmw_cmdbuf_header_free(struct vmw_cmdbuf_header *header) { struct vmw_cmdbuf_man *man = header->man; - BUG_ON(!spin_is_locked(&man->lock)); + lockdep_assert_held(&man->lock); if (header->inline_space) { vmw_cmdbuf_header_inline_free(header);