From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 04C72C4332E for ; Thu, 19 Mar 2020 08:52:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF0BB2072D for ; Thu, 19 Mar 2020 08:52:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726902AbgCSIwT (ORCPT ); Thu, 19 Mar 2020 04:52:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:35642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgCSIwT (ORCPT ); Thu, 19 Mar 2020 04:52:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 25E85B117; Thu, 19 Mar 2020 08:52:16 +0000 (UTC) Date: Thu, 19 Mar 2020 01:51:09 -0700 From: Davidlohr Bueso To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Linus Torvalds , Ingo Molnar , Will Deacon , "Paul E . McKenney" , Joel Fernandes , Steven Rostedt , Randy Dunlap , Sebastian Andrzej Siewior , Logan Gunthorpe , Kurt Schwemmer , Bjorn Helgaas , linux-pci@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Oleg Nesterov , Michael Ellerman , Arnd Bergmann , linuxppc-dev@lists.ozlabs.org Subject: Re: [patch V2 08/15] Documentation: Add lock ordering and nesting documentation Message-ID: <20200319085109.vrvmpesytul3ek3e@linux-p48b> References: <20200318204302.693307984@linutronix.de> <20200318204408.211530902@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200318204408.211530902@linutronix.de> User-Agent: NeoMutt/20180716 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 18 Mar 2020, Thomas Gleixner wrote: >+Owner semantics >+=============== >+ >+Most lock types in the Linux kernel have strict owner semantics, i.e. the >+context (task) which acquires a lock has to release it. >+ >+There are two exceptions: >+ >+ - semaphores >+ - rwsems >+ >+semaphores have no strict owner semantics for historical reasons. They are I would rephrase this to: semaphores have no owner semantics for historical reason, and as such trylock and release operations can be called from interrupt context. They are ... >+often used for both serialization and waiting purposes. That's generally >+discouraged and should be replaced by separate serialization and wait >+mechanisms. ^ , such as mutexes or completions. >+ >+rwsems have grown interfaces which allow non owner release for special >+purposes. This usage is problematic on PREEMPT_RT because PREEMPT_RT >+substitutes all locking primitives except semaphores with RT-mutex based >+implementations to provide priority inheritance for all lock types except >+the truly spinning ones. Priority inheritance on ownerless locks is >+obviously impossible. >+ >+For now the rwsem non-owner release excludes code which utilizes it from >+being used on PREEMPT_RT enabled kernels. In same cases this can be >+mitigated by disabling portions of the code, in other cases the complete >+functionality has to be disabled until a workable solution has been found. Thanks, Davidlohr From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 A2E23C4332D for ; Thu, 19 Mar 2020 08:54:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22CC82071C for ; Thu, 19 Mar 2020 08:54:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22CC82071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=stgolabs.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48jggz54V7zDr69 for ; Thu, 19 Mar 2020 19:54:23 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=stgolabs.net (client-ip=195.135.220.15; helo=mx2.suse.de; envelope-from=dave@stgolabs.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=stgolabs.net Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48jgdk00MXzDr5D for ; Thu, 19 Mar 2020 19:52:21 +1100 (AEDT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 25E85B117; Thu, 19 Mar 2020 08:52:16 +0000 (UTC) Date: Thu, 19 Mar 2020 01:51:09 -0700 From: Davidlohr Bueso To: Thomas Gleixner Subject: Re: [patch V2 08/15] Documentation: Add lock ordering and nesting documentation Message-ID: <20200319085109.vrvmpesytul3ek3e@linux-p48b> References: <20200318204302.693307984@linutronix.de> <20200318204408.211530902@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200318204408.211530902@linutronix.de> User-Agent: NeoMutt/20180716 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Randy Dunlap , Peter Zijlstra , linux-pci@vger.kernel.org, Sebastian Andrzej Siewior , Oleg Nesterov , Joel Fernandes , Will Deacon , Ingo Molnar , Arnd Bergmann , Logan Gunthorpe , "Paul E . McKenney" , linuxppc-dev@lists.ozlabs.org, Steven Rostedt , Bjorn Helgaas , Kurt Schwemmer , Kalle Valo , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, LKML , netdev@vger.kernel.org, Linus Torvalds , "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 18 Mar 2020, Thomas Gleixner wrote: >+Owner semantics >+=============== >+ >+Most lock types in the Linux kernel have strict owner semantics, i.e. the >+context (task) which acquires a lock has to release it. >+ >+There are two exceptions: >+ >+ - semaphores >+ - rwsems >+ >+semaphores have no strict owner semantics for historical reasons. They are I would rephrase this to: semaphores have no owner semantics for historical reason, and as such trylock and release operations can be called from interrupt context. They are ... >+often used for both serialization and waiting purposes. That's generally >+discouraged and should be replaced by separate serialization and wait >+mechanisms. ^ , such as mutexes or completions. >+ >+rwsems have grown interfaces which allow non owner release for special >+purposes. This usage is problematic on PREEMPT_RT because PREEMPT_RT >+substitutes all locking primitives except semaphores with RT-mutex based >+implementations to provide priority inheritance for all lock types except >+the truly spinning ones. Priority inheritance on ownerless locks is >+obviously impossible. >+ >+For now the rwsem non-owner release excludes code which utilizes it from >+being used on PREEMPT_RT enabled kernels. In same cases this can be >+mitigated by disabling portions of the code, in other cases the complete >+functionality has to be disabled until a workable solution has been found. Thanks, Davidlohr