Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3232732imu; Sat, 24 Nov 2018 00:41:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UE7vxTTD8duFXdzrAbcnPAbkTYyhlESvO0GlTInFYbM9SS/Qm4xrYoy5ubgJR7Np64cpUq X-Received: by 2002:a63:82c6:: with SMTP id w189mr17321389pgd.344.1543048883472; Sat, 24 Nov 2018 00:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048883; cv=none; d=google.com; s=arc-20160816; b=cyHglLC9X/3E7E4NBdyLazRRY+Jzp/3oWsFfKjBTvDMmDc8pU24KV75gx1VZPOgMMm Cz1NkkAIOCS6YH0BqhpC1pZ1gs1OtQVFwDsKqiJxcZ3W+CgqeDcCEvQRoY+zQfGVTgip AuvOZQ3eB8dGaTmFoIU8bSnf4tmmBOUfG9fFNHOnrP/QGx7bfc4m5h/VV+kwkjUnm4Wj nyCPJ3WhWG5QRcYqJ8WKR+53Un8HGjy0A3sCZDv6pg4bZoEu4SApGL66VTkHSO/cWYtA PHahAV2OzN6kQ0S4vIbPtL6diYBd5PNScIQrl5keziUZWOGXXP1CCqkK+WtjA/21SgT6 7xxQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=TaHYmmmWjw9ZWI7sHVxb4SMhG4ius5zt1FPDTT5zY2U=; b=kIhJTxn/9pbxOeJ62NhnrZSSDJT8jkJ5uP8hHa8ffA4YtvSTl2KEPpdLp45Z/1GTmb Sa+K346xh0dwz0lWqCF/QOQfADvtmIULSHtm57JQeBPGHakY1Rh17dTGuxP0kaECN0bF Ixgc7dS5M19mJuCzUuq/MjjGcXOGOcWuqsFaET4gQdPM4MS2bSICDf+S3d6iKLBMWw+N dRte2WTQAqmf3waSAWPbiecOjE5aEa49D/09ZqL27zibavDIyQcCw+iDqM/2+Sefx3Ws fcNJYR7TWQ5CN22+86F8YmYmc7YnxztRnnIZIbGWUaKkAXRKV/hZe/OYisuQtBnj0Ohc eYHg== ARC-Authentication-Results: i=1; mx.google.com; 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 b10si33712417plr.196.2018.11.24.00.41.09; Sat, 24 Nov 2018 00:41:23 -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; 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 S2395062AbeKXCgT (ORCPT + 99 others); Fri, 23 Nov 2018 21:36:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:34734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391042AbeKXCgT (ORCPT ); Fri, 23 Nov 2018 21:36:19 -0500 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 763DF205C9; Fri, 23 Nov 2018 15:51:34 +0000 (UTC) Date: Fri, 23 Nov 2018 10:51:32 -0500 From: Steven Rostedt To: Catalin Marinas Cc: Sebastian Andrzej Siewior , Andrea Parri , Peter Zijlstra , zhe.he@windriver.com, tglx@linutronix.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, boqun.feng@gmail.com Subject: Re: [PATCH v2] kmemleak: Turn kmemleak_lock to raw spinlock on RT Message-ID: <20181123105132.47ee57ad@vmware.local.home> In-Reply-To: <20181123113130.GA3360@arrakis.emea.arm.com> References: <1542877459-144382-1-git-send-email-zhe.he@windriver.com> <20181123095314.hervxkxtqoixovro@linutronix.de> <20181123110226.GA5125@andrea> <20181123110611.s2gmd237j7docrxt@linutronix.de> <20181123113130.GA3360@arrakis.emea.arm.com> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Nov 2018 11:31:31 +0000 Catalin Marinas wrote: > With qwrlocks, the readers will normally block if there is a pending > writer (to avoid starving the writer), unless in_interrupt() when the > readers are allowed to starve a pending writer. > > TLA+/PlusCal model here: ;) > > https://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/kernel-tla.git/tree/qrwlock.tla > And the code appears to confirm it too: void queued_read_lock_slowpath(struct qrwlock *lock) { /* * Readers come here when they cannot get the lock without waiting */ if (unlikely(in_interrupt())) { /* * Readers in interrupt context will get the lock immediately * if the writer is just waiting (not holding the lock yet), * so spin with ACQUIRE semantics until the lock is available * without waiting in the queue. */ atomic_cond_read_acquire(&lock->cnts, !(VAL & _QW_LOCKED)); return; } atomic_sub(_QR_BIAS, &lock->cnts); /* * Put the reader into the wait queue */ arch_spin_lock(&lock->wait_lock); atomic_add(_QR_BIAS, &lock->cnts); -- Steve