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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 70744C07E95 for ; Sat, 10 Jul 2021 15:45:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3973C6120D for ; Sat, 10 Jul 2021 15:45:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3973C6120D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lechnology.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tgxtcuOgo+1H/qubtRnTUXcN+vDoimksR5gqCcqAXEI=; b=yK1ZGceGOxttiNOZyPyOhpmOaI SR9o60dba3DWfJcekPhuN9zA9+XUtepKJPvS3KvERArGk6f6mVXaWxAYBxaQPeW+hGqDviLO+u3MQ 0OpwPc+r/pwVkfKqliDTeFvKVM8kzBIEiDJcsqTH221xS+daxeYpsAYLHsVozxGsiGPDS20V46IBn 5bZaUEs+EkUZg428F1TS4QMh1fIoDZojMFh4K3BglATD2fg1jBo1c05/LENcp3gH+PherRqozhR34 OWagIncDWqGPTMwpRe7lS0spbSY4B6lH/qMGLHrEW3E+YBAs/KjU+ba8YRQYEIY0AqKzlQ8guLpIF flotFhlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2F8g-003pjH-H3; Sat, 10 Jul 2021 15:43:34 +0000 Received: from vern.gendns.com ([98.142.107.122]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2F8d-003pin-4l for linux-arm-kernel@lists.infradead.org; Sat, 10 Jul 2021 15:43:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MkQ/Slfts7ACEfWSN/fpQzxSSjabaiQStVowDOxpxEc=; b=z+zONT8Jj4Iy/OXEkcL3LY6jcM eRSGZXlyfS6KcTgQ8SnUBI17hNj7oee+zC2i4wlxfLlfi4HM5/DyLDDrsTSVJG859csv8B4zuy5+l c4sBVP1GFnYYhXHiPpB5A3sqJkte1gStaqRnZpQPUrVj6Xux27LU+nMVlOIu9qFVwCqyca/iWFiZC 6yvBdcV22zxsJmTSKIDxLRiD1s53g9byv8i1OYhZZXiY+6lMVEXHkLZSI4pp+b6B5gvMT8FVFbyiF Z7tEn+7fjLw+XY7dLTIE5MhSZ8vvlqC3wimHuEt+BLkVdpZA0axXnxhp89t9pqmBVUtjBTQhXkNLo 8KuWrxLg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:45586 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1m2F8J-00GUFW-Jv; Sat, 10 Jul 2021 11:43:26 -0400 Subject: Re: [PATCH v12 15/17] counter: Implement events_queue_size sysfs attribute To: William Breathitt Gray , Jarkko Nikula Cc: jic23@kernel.org, linux-stm32@st-md-mailman.stormreply.com, kernel@pengutronix.de, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de References: <1a624011-0b43-ac42-be53-a42f81923e5a@linux.intel.com> From: David Lechner Message-ID: Date: Sat, 10 Jul 2021 10:43:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210710_084331_406384_B51CA05C X-CRM114-Status: GOOD ( 10.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 7/10/21 5:25 AM, William Breathitt Gray wrote: >> and after that >> >> [ 16.564403] ================================================ >> [ 16.570725] WARNING: lock held when returning to user space! >> [ 16.577044] 5.13.0-next-20210706+ #4 Not tainted >> [ 16.582198] ------------------------------------------------ >> [ 16.588507] cat/331 is leaving the kernel with locks still held! >> [ 16.595214] 1 lock held by cat/331: >> [ 16.599103] #0: ffff888102bb3630 >> (&counter->chrdev_lock){+.+.}-{3:3}, at: counter_chrdev_open+0x21/0x60 >> [counter] >> >> Jarkko > I'm not sure how to resolve this warning. The purpose of this lock is to > limit chrdev to a single open at a time. To accomplish this I grab this > lock in counter_chrdev_open() and hold it until counter_chrdev_release() > is called. Is there a better way to accomplish this? How about using an atomic flag, e.g test_and_set_bit()? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel