Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp727020ybc; Tue, 12 Nov 2019 08:18:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxeroYftotvyzOuKdI3QNw9THJF/QEcxUb50WXGvHt2JJscNs2E153kfRu/FP+GkBeWkx4z X-Received: by 2002:a17:906:5448:: with SMTP id d8mr28517922ejp.79.1573575483000; Tue, 12 Nov 2019 08:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573575482; cv=none; d=google.com; s=arc-20160816; b=eSQ51l5h40/G4QHM2bRFvXMXtkGC3yHwdoPtqw618x5eIPEgCUbqHrNznyIpGos/wE SHdJVrGEPV5Cx+U+cr4ZCk3pNsGl4sxCJfavMGPeqfg1D9UzTH6NM/3h5Z67jgFmDQmC 4EtYrDxftSHue1bnXu7dKCGfTU16lQz+bUDUKsusrAzKmRzdyEZb2hoa3KJwcperc+Jz PjiTEYFIEwnJir+LUsYy8KN9LbIlAo+iTfXGpvbjjXQbrk2ie9RSAD6l6cs8DklG6QXW aRof31kxpomubmDaCfIN2J5CIvxqVQXvPEj9Gsd5UOrrnEjF7hzdiGA2rUL/qlZx9tF8 jQeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:subject:cc:to:from:date:dkim-signature; bh=til87Hw17HKI7TEgbgUhu2Gk+tx9OhdI8SUQLLm8NMQ=; b=YRONj+sMPWO0SY8Sffglu6T9qO/VwwlqaahBP2/VEz1u+HqJ5kkZXMfhrRH8hEg9xj f56as27c9qNbkDHdUQpMp2q78gyQUqHpWNAkZaR1+DIOts8CyDRdE0mhcxEXaLhO+e/R RwxLHX3IQlP1A0LuLuQrzCci5F3y9C2e1GHOLJz0ejWyeL4RUrWhlWqz8t9FGXJ4oDKa duGtgUvLsW20L6Ly5I7B0C0oVZJGWp6P20lPMJ58daHzkNCE+pYo7kn58Aut8rrrCw75 mWvhOmgStFNe3BT4tQngM/7DgbIyYNCr7nvP1fol0yMMNW3C4pG2MA+E88RaX4qo3uJ7 m7fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NVDLY1pr; 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=pass (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 r9si15466030edc.101.2019.11.12.08.17.38; Tue, 12 Nov 2019 08:18:02 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NVDLY1pr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbfKLQQj (ORCPT + 99 others); Tue, 12 Nov 2019 11:16:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52379 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726994AbfKLQQi (ORCPT ); Tue, 12 Nov 2019 11:16:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573575397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=til87Hw17HKI7TEgbgUhu2Gk+tx9OhdI8SUQLLm8NMQ=; b=NVDLY1pr5WvoG6V3EzQCkt+FfuHpvmiRqWQjDz6kM2+2zucg0MaJJhLJeXmMzXrVXaju/n 1kyTZQ+LWRgAlRlIxgAGEZ3oYD9aTmm7mMjfS02rlFCcTB+QyqfDmX01ujwUvNIzXvaHCx khnmAQXluUzSOhJhYmdaAnHl8eE9bw8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-4pd-lHFHON-uapLGkhrGKQ-1; Tue, 12 Nov 2019 11:16:34 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1FE91800D63; Tue, 12 Nov 2019 16:16:32 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EA7E67E40; Tue, 12 Nov 2019 16:16:30 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id xACGGTZK018091; Tue, 12 Nov 2019 11:16:29 -0500 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id xACGGTeA018087; Tue, 12 Nov 2019 11:16:29 -0500 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 12 Nov 2019 11:16:29 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: tglx@linutronix.de, linux-rt-users@vger.kernel.org cc: Mike Snitzer , Nikos Tsironis , Scott Wood , Ilias Tsitsimpis , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Daniel Wagner , Sebastian Andrzej Siewior Subject: [PATCH RT 2/2 v2] list_bl: avoid BUG when the list is not locked Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 4pd-lHFHON-uapLGkhrGKQ-1 X-Mimecast-Spam-Score: 0 Content-Type: TEXT/PLAIN; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org list_bl would crash with BUG() if we used it without locking. dm-snapshot= =20 uses its own locking on realtime kernels (it can't use list_bl because=20 list_bl uses raw spinlock and dm-snapshot takes other non-raw spinlocks=20 while holding bl_lock). To avoid this BUG, we must set LIST_BL_LOCKMASK =3D 0. This patch is intended only for the realtime kernel patchset, not for the= =20 upstream kernel. Signed-off-by: Mikulas Patocka Index: linux-rt-devel/include/linux/list_bl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-rt-devel.orig/include/linux/list_bl.h=092019-11-07 14:01:51.00000= 0000 +0100 +++ linux-rt-devel/include/linux/list_bl.h=092019-11-08 10:12:49.000000000 = +0100 @@ -19,7 +19,7 @@ * some fast and compact auxiliary data. */ =20 -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) +#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && !defined(CO= NFIG_PREEMPT_RT_BASE) #define LIST_BL_LOCKMASK=091UL #else #define LIST_BL_LOCKMASK=090UL @@ -161,9 +161,6 @@ static inline void hlist_bl_lock(struct =09bit_spin_lock(0, (unsigned long *)b); #else =09raw_spin_lock(&b->lock); -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) -=09__set_bit(0, (unsigned long *)b); -#endif #endif } =20 @@ -172,9 +169,6 @@ static inline void hlist_bl_unlock(struc #ifndef CONFIG_PREEMPT_RT_BASE =09__bit_spin_unlock(0, (unsigned long *)b); #else -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) -=09__clear_bit(0, (unsigned long *)b); -#endif =09raw_spin_unlock(&b->lock); #endif }