Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp430360ybc; Tue, 12 Nov 2019 03:47:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx5dzN9DG+gEem0ALT2GVaHCrzXjJbR1I1BZaKm81JD2kaATlvAzfjg3T4uulZrt6pS/yfW X-Received: by 2002:a17:906:cb2:: with SMTP id k18mr25636068ejh.49.1573559276638; Tue, 12 Nov 2019 03:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573559276; cv=none; d=google.com; s=arc-20160816; b=osAffGiF1fer86MDza5+uJdST+uFksYj2b+0mCJe/qPQ5e0IkZF+HKJOiSZDxGPiQl bI42aPaMC4WQdvmF43ozCtnOCruC5ASFHRw+rjC1ZTewXAU8rGDSyQS5GvhrGdNsks9t E83Tk04UvSZGTEqRbO2dxOty2qrLLeenMfO++7+jVxG4WvkBNWlf3MgphApGfUGpJLJU xRHfPPELKqqWsk+8pT31a16x3SSdsPCFttsIDEVp7E6GsN3y0ktyz4AUYgG88sn5lIdy +uXPgfp75+tJxMW1mEi7PwqRtLXKXEargBVKbKAQ10RYvh4ZL5EXUhByOfwTFBzBZS7O rWnA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=OKVAcfxje194zRFNg/njiwM3RXKHmEbB7kwF9f13aU4=; b=SnYm0anz5dxRJQGfhhiFM/AqyUgBD+Hd7JuuPWoKMtykc7np8qkn529Lelm3O99ZAo I+VR8L2lnPwTkiRgEUF6Je4U/NmT1X6hYwCS2i2AiHcGLxEDUPJ7otsP910+iA9NSKzG QeMityN/RNCST2kzF/Hed9yrT7qrLkFAcBZBxi2c4KzhpyVJNxoFRzrQ8us+0TYYMrP3 sgvMEaDBWAqACvsqbYgS8LzN1evSgWBZhxxUeuDhxDOxAyqMQrW0HueaUROrJUxprYks zpr6CPIUl8mH0QROH+rdOsxuzkCD6eKUrjiWdFUjYHwyCejnQr7gYbx2resew5ZMoKmG qi3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arrikto-com.20150623.gappssmtp.com header.s=20150623 header.b=rrGAgDcw; 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 q44si13817868eda.242.2019.11.12.03.47.31; Tue, 12 Nov 2019 03:47:56 -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=@arrikto-com.20150623.gappssmtp.com header.s=20150623 header.b=rrGAgDcw; 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 S1727083AbfKLLpp (ORCPT + 99 others); Tue, 12 Nov 2019 06:45:45 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33037 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbfKLLpp (ORCPT ); Tue, 12 Nov 2019 06:45:45 -0500 Received: by mail-lj1-f195.google.com with SMTP id t5so17454435ljk.0 for ; Tue, 12 Nov 2019 03:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arrikto-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OKVAcfxje194zRFNg/njiwM3RXKHmEbB7kwF9f13aU4=; b=rrGAgDcw0hfIi1JObttZLe7eSMRBkVLgtX1HFB+GTOIJDlG98i7klpUyDW6/AD0qvI wusLVhTISByponZeeV5EiUAV2APBQH6To55cCSLjNUXwNOsG7W2ow/J9KD2r+d6Tvbkx a503poAcuEagiwRTbGjoZILmfRjuNzfN8b49NdX9EBOJ6ZePIZkJlyv+irvfbIa4BwSL oQN584YsQmTTBY4HnXZIW6ln7V8hiiI88LvPdwhVT6yLxSdILXGCG4MnFUHk/sIDENQv suVkNbS4tfz32YR88A1bFY4Rrm3Ul0WXww0tZPnFx0DUjRvCKh4YKOoJVtUnhJemwkrL 6afQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OKVAcfxje194zRFNg/njiwM3RXKHmEbB7kwF9f13aU4=; b=RuPPreF1G2VbZgwL2Az4DspWMjUch2/0oeKnxy3bnd6F5fg3ht9hzvJ1JmCBZL6V+C rcxKOv4wRzhRXdUPeXx94o9009yEXpc9tgHvTtFh888Tyr5zJAu8EhK4iPYCaiZhAZKs eF1eHt3EzRHKKl6AmJvy7triWLH+EfbG0nKv5ek5M3+x0IhWjt5/JAPFlhkUrUFOJ+iU bMi4wIiNMmwq+pdDKIOFX0WL1HDTnUgJmXf5r/U3oZ8ykOlLQOsH0L7phCBl6+ipw7ya QbptdEzyWFsgkNxdJDQ4qQrqtapb/+QwedASwqQSZ1lsPs0PnaECKiN+KrpwveF+H2+O XHIg== X-Gm-Message-State: APjAAAVONdoZ7nk5jFdTafE4PxnIaZ02Fad5V03NNfIUcdGdtADb5uQe TZ7aHHc9D7HOj5eZyZhpTkzv3g== X-Received: by 2002:a2e:98c1:: with SMTP id s1mr20538408ljj.215.1573559141877; Tue, 12 Nov 2019 03:45:41 -0800 (PST) Received: from [10.94.250.118] ([31.177.62.212]) by smtp.gmail.com with ESMTPSA id t17sm8138112ljc.88.2019.11.12.03.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Nov 2019 03:45:41 -0800 (PST) Subject: Re: [PATCH 1/2] dm-snapshot: fix crash with the realtime kernel To: Mikulas Patocka , Mike Snitzer Cc: Scott Wood , Ilias Tsitsimpis , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20191112011444.GA32220@redhat.com> From: Nikos Tsironis Message-ID: Date: Tue, 12 Nov 2019 13:45:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/12/19 9:50 AM, Mikulas Patocka wrote: > > > On Mon, 11 Nov 2019, Mike Snitzer wrote: > >> On Mon, Nov 11 2019 at 11:37am -0500, >> Nikos Tsironis wrote: >> >>> On 11/11/19 3:59 PM, Mikulas Patocka wrote: >>>> Snapshot doesn't work with realtime kernels since the commit f79ae415b64c. >>>> hlist_bl is implemented as a raw spinlock and the code takes two non-raw >>>> spinlocks while holding hlist_bl (non-raw spinlocks are blocking mutexes >>>> in the realtime kernel, so they couldn't be taken inside a raw spinlock). >>>> >>>> This patch fixes the problem by using non-raw spinlock >>>> exception_table_lock instead of the hlist_bl lock. >>>> >>>> Signed-off-by: Mikulas Patocka >>>> Fixes: f79ae415b64c ("dm snapshot: Make exception tables scalable") >>>> >>> >>> Hi Mikulas, >>> >>> I wasn't aware that hlist_bl is implemented as a raw spinlock in the >>> real time kernel. I would expect it to be a standard non-raw spinlock, >>> so everything works as expected. But, after digging further in the real >>> time tree, I found commit ad7675b15fd87f1 ("list_bl: Make list head >>> locking RT safe") which suggests that such a conversion would break >>> other parts of the kernel. >> >> Right, the proper fix is to update list_bl to work on realtime (which I >> assume the referenced commit does). I do not want to take this >> dm-snapshot specific workaround that open-codes what should be done >> within hlist_{bl_lock,unlock}, etc. > > If we change list_bl to use non-raw spinlock, it fails in dentry lookup > code. The dentry code takes a seqlock (which is implemented as preempt > disable in the realtime kernel) and then takes a list_bl lock. > > This is wrong from the real-time perspective (the chain in the hash could > be arbitrarily long, so using non-raw spinlock could cause unbounded > wait), however we can't do anything with it. > > I think that fixing dm-snapshot is way easier than fixing the dentry code. > If you have an idea how to fix the dentry code, tell us. > I too think that it would be better to fix list_bl. dm-snapshot isn't really broken. One should be able to acquire a spinlock while holding another spinlock. Moreover, apart from dm-snapshot, anyone ever using list_bl is at risk of breaking the realtime kernel, if he or she is not aware of that particular limitation of list_bl's implementation in the realtime tree. But, I agree that it's a lot easier "fixing" dm-snapshot than fixing the dentry code. >> I'm not yet sure which realtime mailing list and/or maintainers should >> be cc'd to further the inclussion of commit ad7675b15fd87f1 -- Nikos do >> you? No, unfortunately, I don't know for sure either. [1] and [2] suggest that the relevant mailing lists are LKML and linux-rt-users and the maintainers are Sebastian Siewior, Thomas Gleixner and Steven Rostedt. I believe they are already Cc'd in the other thread regarding Mikulas' "realtime: avoid BUG when the list is not locked" patch (for some reason the thread doesn't properly appear in dm-devel archives and also my mails to dm-devel have being failing since yesterday - Could there be an issue with the mailing list?), so maybe we should Cc them in this thread too. Nikos [1] https://wiki.linuxfoundation.org/realtime/communication/mailinglists [2] https://wiki.linuxfoundation.org/realtime/communication/send_rt_patches >> >> Thanks, >> Mike > > Mikulas >