Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1989983rwb; Mon, 7 Nov 2022 08:00:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM50nqO7R67Xd4qXswNl2T8xxSVLXvxOC5h0G2f/P2CqiuxbF5TyOphQwzokrffspGkl7tYI X-Received: by 2002:a17:907:2c42:b0:7ad:d798:f2d5 with SMTP id hf2-20020a1709072c4200b007add798f2d5mr39443575ejc.386.1667836802741; Mon, 07 Nov 2022 08:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667836802; cv=none; d=google.com; s=arc-20160816; b=YUtrzMnMTR7sXQYP+hvIfJWDkIXWYfS7qJckrB1V2p+43VPwGtx7UYz3pFNX5ecKDi bkfRlOh+oEKtueJL9nkIT7TM486nJwjNcuYJsvS+QbEaF+ExxBue4iISBPcnnMFPw39/ VilMRrPwS2/EbTUks/W2K16TYXNgLCfFIoLsCO399W36aAkeo8IoBudn4FKtC0dcATiv gjVWeiT5Y0qpESL1HnsqmIDtK6SV8xps0egDJx6MUP0l4jmhl0n4igOctzM9B22oMrFk cAQk1VKG6QvKH1qBqj8E+as3IA93qv8wHb13MRbwiU4NNWrG3Hd496WQinKWrdBGfajJ QgHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=dxahy4MUlQGdZAiwUootSdpPQQmTuITFh2KW+Ggp0P4=; b=OZZjfrw+zfLKZ8nJoVIf/18fa0MU/KeNxbeAAkZ8XeiSCl11G1PQZpnZ8gWJiP3oqf cXxL45kuCUY2ne8R505mnS6Q5waoxXKWpev/ceBeZjgh8Kp53+ad5nMm+i13NDspFSOV tIZNmozUCIfr0XQ8DrvTVNOkgGv4CrIcNyHoKZhiRE7QtHOw2Sp/XzOIXolsge6apXos wZUaWfw1xevGQMYJY5bkNYXObJ/dMx8cssu+WCOk3TWmmfAnd5u8uxcz6ElF7kyhuSUD jOXKvyysz4orhT8pVRp0Ohn8rHdTtWI7+b6YF6yiOqONanMPXHmr+izMhEM5KWMwI9q2 O/AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zZN4uPxR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv14-20020a17090710ce00b007a087ccd275si7086180ejb.384.2022.11.07.07.59.39; Mon, 07 Nov 2022 08:00:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zZN4uPxR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232764AbiKGPKk (ORCPT + 93 others); Mon, 7 Nov 2022 10:10:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232598AbiKGPKi (ORCPT ); Mon, 7 Nov 2022 10:10:38 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77991DA6F for ; Mon, 7 Nov 2022 07:10:37 -0800 (PST) Date: Mon, 7 Nov 2022 16:10:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667833836; 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: in-reply-to:in-reply-to:references:references; bh=dxahy4MUlQGdZAiwUootSdpPQQmTuITFh2KW+Ggp0P4=; b=zZN4uPxRUSJhni6VwYnJbJeRxq5/VSSrOO+7qqhdQVXQLagFpDyfxGfvh4mapMEreFdYLs drBA4t3nwscD8A5FbCL2tNdJVRkM+6SR9nL+poFMPJhbMfunF40EawvdHVflKNJpCfW42Y EQkWeYqZAHNvVsqTq6vlN1KNQ9LMJTeQecGiMRy6UJSqpHF5vOs9Kl0+m/yMojmXZ8drw/ FdJ8T70NNQA1aOf6pxPraG5QglrTM925SX8dArWixKeozV5OGxt0bGJHR92ICU3Ao4BBV8 I8DM2kLVuRxNPvQhUajh8xuwQdOlcWUe7KaE35EdcmyEzMgwZ8mKvxPT24T4aQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667833836; 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: in-reply-to:in-reply-to:references:references; bh=dxahy4MUlQGdZAiwUootSdpPQQmTuITFh2KW+Ggp0P4=; b=wHFjQXHG5/PTHlPPZ/eqlfZ4qw6X0XP6KRdlCwyZCygmYqoqs4jY8xznt6ew7Zm2PGowBr OJY2UY43JxK74ABg== From: Sebastian Andrzej Siewior To: Jan Kara Cc: LKML , Thomas Gleixner , Steven Rostedt , Mel Gorman , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Catalin Marinas Subject: Re: Crash with PREEMPT_RT on aarch64 machine Message-ID: References: <20221103115444.m2rjglbkubydidts@quack3> <20221107135636.biouna36osqc4rik@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221107135636.biouna36osqc4rik@quack3> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + locking, arm64 On 2022-11-07 14:56:36 [+0100], Jan Kara wrote: > > spinlock_t and raw_spinlock_t differ slightly in terms of locking. > > rt_spin_lock() has the fast path via try_cmpxchg_acquire(). If you > > enable CONFIG_DEBUG_RT_MUTEXES then you would force the slow path which > > always acquires the rt_mutex_base::wait_lock (which is a raw_spinlock_t) > > while the actual lock is modified via cmpxchg. > > So I've tried enabling CONFIG_DEBUG_RT_MUTEXES and indeed the corruption > stops happening as well. So do you suspect some bug in the CPU itself? If it is only enabling CONFIG_DEBUG_RT_MUTEXES (and not whole lockdep) then it looks very suspicious. CONFIG_DEBUG_RT_MUTEXES enables a few additional checks but the main part is that rt_mutex_cmpxchg_acquire() + rt_mutex_cmpxchg_release() always fail (and so the slowpath under a raw_spinlock_t is done). So if it is really the fast path (rt_mutex_cmpxchg_acquire()) then it somehow smells like the CPU is misbehaving. Could someone from the locking/arm64 department check if the locking in RT-mutex (rtlock_lock()) is correct? rtmutex locking uses try_cmpxchg_acquire(, ptr, ptr) for the fastpath (and try_cmpxchg_release(, ptr, ptr) for unlock). Now looking at it again, I don't see much difference compared to what queued_spin_trylock() does except the latter always operates on 32bit value instead a pointer. > Honza > Sebastian