Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1719072ybc; Wed, 13 Nov 2019 03:18:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzvVYa2ac1gn71hGVvxFuraimzx7eDvFlNHzo5qMiANLOLz1ixGK4yOebYSh8PRRSCKEb2t X-Received: by 2002:a17:906:1611:: with SMTP id m17mr2182405ejd.281.1573643920571; Wed, 13 Nov 2019 03:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573643920; cv=none; d=google.com; s=arc-20160816; b=EJIitHkiHp4tRe+6D6Jh4Zpz6UCEpGMIi0TJ0HUhX7dWSbefkCQWG2B/E/566uPPRH +xoSIKlnVLL2jXFQb3qNk70HQt2U2tfu7PlwiLo0LYmjV2Uyv6D/5r/0EKrlclaJLhoZ 75Th/PYvAfA8+nSJwYHNJlpk8I6VwLb+sLD6yajQtiBCcdXIEa7g+2ih9PeEIHysXaku XjthGs14y2doYgK6xtV9Tm8Xo17Z6fTpwUCQK3wdxf0lmlFNWkiUgUtp8lPiWU970QOx FPzWu0SjQnaX+bOwHN7mFUKDNf+CBG4iFbie2//Wjuv641CScGtG6J+boGU8IvM4tcoL mhfw== 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:references:message-id:in-reply-to:subject:cc:to:from :date:dkim-signature; bh=9TgWHtedewyYVeKMWggk8MUBoMaDILcq3YknTA2TqKo=; b=nnmihGfADWdI9TvlKraft9Oc2RKUF/rObMGc3wHkjftXOW1x+yMhoVD+3d3+VzEYfv BdfOoBJkwItxfelWdYMEEUd3v/ShZrQox4ZZfbybZW7ZWgqE9u/fU/B6AIK99e1T9A4z /7ZNzK/bnzPJz9fgMUzilr8OtCXWaQTG/KFDuCzCj0NOZ4/kV2v9KToxzxTVWMZGfhHZ svtxI3fCtX5VDy+QchUHT43iikJ4+DINEEr8bBSlJrV+nVQ8nNGOdABNP9ruGfy+iTqD 0Pc0NVMzCWm4ew3cfBoQV0pmNStKHJPNf/pMOu0yxiSYPqfGEDgvZFYm99gcamWr1ba/ TGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A7Vh6R9R; 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 u12si1333186eda.319.2019.11.13.03.18.15; Wed, 13 Nov 2019 03:18:40 -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=A7Vh6R9R; 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 S1727834AbfKMLQv (ORCPT + 99 others); Wed, 13 Nov 2019 06:16:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42545 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727693AbfKMLQv (ORCPT ); Wed, 13 Nov 2019 06:16:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573643809; 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: in-reply-to:in-reply-to:references:references; bh=9TgWHtedewyYVeKMWggk8MUBoMaDILcq3YknTA2TqKo=; b=A7Vh6R9RPaIan9AJcLtD1tT68Mx9G4Uf/WVp26Y3rSvGqj9RgT1fNuw3EKI/PHgtcuTYLd pWfm03gD12NkgshD63d2+rMcgurGXIoIG/JtwC7kxQuLmDLrFT2KQygpdeemBnAHuKIY6w yRN5cr4BSjfEaPK62QV/xEf6ve9JyqM= 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-386-4VVjEkysN62eAxhJRTDr2w-1; Wed, 13 Nov 2019 06:16:46 -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 56AAA18B5FA6; Wed, 13 Nov 2019 11:16:45 +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 C2A0750FC7; Wed, 13 Nov 2019 11:16:42 +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 xADBGgKS023444; Wed, 13 Nov 2019 06:16:42 -0500 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id xADBGfRf023440; Wed, 13 Nov 2019 06:16:41 -0500 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 13 Nov 2019 06:16:41 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Nikos Tsironis cc: tglx@linutronix.de, linux-rt-users@vger.kernel.org, Mike Snitzer , Scott Wood , Ilias Tsitsimpis , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Daniel Wagner , Sebastian Andrzej Siewior Subject: Re: [PATCH RT 2/2 v2] list_bl: avoid BUG when the list is not locked In-Reply-To: <335dafcb-5e07-63ed-b288-196516170bde@arrikto.com> Message-ID: References: <335dafcb-5e07-63ed-b288-196516170bde@arrikto.com> 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: 4VVjEkysN62eAxhJRTDr2w-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 On Wed, 13 Nov 2019, Nikos Tsironis wrote: > On 11/12/19 6:16 PM, Mikulas Patocka wrote: > > list_bl would crash with BUG() if we used it without locking. dm-snapsh= ot=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). > >=20 > > To avoid this BUG, we must set LIST_BL_LOCKMASK =3D 0. > >=20 > > This patch is intended only for the realtime kernel patchset, not for t= he=20 > > upstream kernel. > >=20 > > Signed-off-by: Mikulas Patocka > >=20 > > 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.0= 00000000 +0100 > > +++ linux-rt-devel/include/linux/list_bl.h=092019-11-08 10:12:49.000000= 000 +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)) && !define= d(CONFIG_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 >=20 > Hi Mikulas, >=20 > I think removing __set_bit()/__clear_bit() breaks hlist_bl_is_locked(), > which is used by the RCU variant of list_bl. >=20 > Nikos OK. so I can remove this part of the patch. Mikulas > > @@ -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 > > } > >=20 >=20