From patchwork Wed Dec 16 04:43:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11976431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD1DDC4361B for ; Wed, 16 Dec 2020 04:43:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 84FC32336D for ; Wed, 16 Dec 2020 04:43:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84FC32336D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 25F026B0075; Tue, 15 Dec 2020 23:43:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 235E38D0008; Tue, 15 Dec 2020 23:43:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FE206B007B; Tue, 15 Dec 2020 23:43:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id E97406B0075 for ; Tue, 15 Dec 2020 23:43:15 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B3AE1181AEF1E for ; Wed, 16 Dec 2020 04:43:15 +0000 (UTC) X-FDA: 77597901150.08.alley95_170107d27429 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 9B0991819E626 for ; Wed, 16 Dec 2020 04:43:15 +0000 (UTC) X-HE-Tag: alley95_170107d27429 X-Filterd-Recvd-Size: 3453 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 04:43:15 +0000 (UTC) Date: Tue, 15 Dec 2020 20:43:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1608093794; bh=Y7w6aGAqb2tNHLD8eWDBPBDwn5CftXbaJjGXC0fSgg4=; h=From:To:Subject:In-Reply-To:From; b=b8BovrCa1oUh3xD9/h73p9GKjaAqFKAx4GEMcFed0LOQt/Ir7jENMVgqWSUPpehxP AhJOKKYPFi87YSnxj/mx1+mdTtd5TVGV0VpQYn0VgfKJ+ot/xX/kOKN7a8J995IlqX 7wPYIKVEHbwreIobR98ZOpQtLM9cgxEpkugjYUJs= From: Andrew Morton To: akpm@linux-foundation.org, bigeasy@linutronix.de, khlebnikov@yandex-team.ru, linux-mm@kvack.org, mm-commits@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, torvalds@linux-foundation.org Subject: [patch 17/95] lib/test_lockup.c: minimum fix to get it compiled on PREEMPT_RT Message-ID: <20201216044313.-SpiO0P-3%akpm@linux-foundation.org> In-Reply-To: <20201215204156.f05ec694b907845bcfab5c44@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Sebastian Andrzej Siewior Subject: lib/test_lockup.c: minimum fix to get it compiled on PREEMPT_RT On PREEMPT_RT the locks are quite different so they can't be tested as it is done below. The alternative is to test for the waitlock within rtmutex. This is the bare minimun to get it compiled. Problems which exist on PREEMP_RT: - none of the locks (spinlock_t, rwlock_t, mutex_t, rw_semaphore) may be acquired with disabled preemption or interrupts. If I read the code correct the it is possible to acquire a mutex_t with disabled interrupts. I don't know how to obtain a lock pointer. Technically they are not exported to userland. - memory can not be allocated with disabled preemption or interrupts even with GFP_ATOMIC. Link: https://lkml.kernel.org/r/20201028181041.xyeothhkouc3p4md@linutronix.de Signed-off-by: Sebastian Andrzej Siewior Cc: Konstantin Khlebnikov Cc: Peter Zijlstra Cc: Thomas Gleixner Signed-off-by: Andrew Morton --- lib/test_lockup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/lib/test_lockup.c~lib-test_lockup-minimum-fix-to-get-it-compiled-on-preempt_rt +++ a/lib/test_lockup.c @@ -480,6 +480,21 @@ static int __init test_lockup_init(void) return -EINVAL; #ifdef CONFIG_DEBUG_SPINLOCK +#ifdef CONFIG_PREEMPT_RT + if (test_magic(lock_spinlock_ptr, + offsetof(spinlock_t, lock.wait_lock.magic), + SPINLOCK_MAGIC) || + test_magic(lock_rwlock_ptr, + offsetof(rwlock_t, rtmutex.wait_lock.magic), + SPINLOCK_MAGIC) || + test_magic(lock_mutex_ptr, + offsetof(struct mutex, lock.wait_lock.magic), + SPINLOCK_MAGIC) || + test_magic(lock_rwsem_ptr, + offsetof(struct rw_semaphore, rtmutex.wait_lock.magic), + SPINLOCK_MAGIC)) + return -EINVAL; +#else if (test_magic(lock_spinlock_ptr, offsetof(spinlock_t, rlock.magic), SPINLOCK_MAGIC) || @@ -494,6 +509,7 @@ static int __init test_lockup_init(void) SPINLOCK_MAGIC)) return -EINVAL; #endif +#endif if ((wait_state != TASK_RUNNING || (call_cond_resched && !reacquire_locks) ||