Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp50903rdb; Tue, 16 Jan 2024 14:45:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeuvUcP7UHQ0WB8srx69z4Jn96i2Gr8digyIuWtGRk8YE3i72WOPBYUujyvg9L6PVnIavA X-Received: by 2002:ac2:4c41:0:b0:50e:2d00:4d32 with SMTP id o1-20020ac24c41000000b0050e2d004d32mr4333952lfk.86.1705445129786; Tue, 16 Jan 2024 14:45:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705445129; cv=pass; d=google.com; s=arc-20160816; b=f8+g/rBqirqR/24kHw4m3M0k/Din9BWeCjKSN4HUk6qy1wszYxq5K/Ga0CXauNn5aI fYLjn90hli/vIZ5U7U68ynrP5yH1UkKBNnNaQCKOFfN0JorYDbZThCntzybFKI4IU3Xx AyEj4nZBNzOmiBoAWtrOk1NItDKWaVvbd0iuID0EKfFlCy+CiIyo3FRG1ueogU0Iiifv Z7dBXqFgNH1PdBd+fJlbu/aRYhbM3da2kgCPHRWWi5f7EK2yzb4hQIcIh+gJ8MRg42kj 5e4j68O2rYvNmd0GIeBzArDUc2+cOaxR46fIUtbcPNFOiT+6DrRWlpRxdltZJqEDiMX2 feNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=2ObGmy+ZDmOiEep2qeMUG0WYfwliEG3p7QfyY5yhTY4=; fh=iLDkmedw0axggtiRYIjPtJnR/Xzf7Lc2TCxM3imwXK0=; b=cZLxpOn6WJQ4pbBH+yAmcNzK043DLC+IU07Axf1uV0BaRqMdiqRYefC4G1fGB5Xv1J 8qI0cT63Jj5I3qLJnXXU4DVOzaw3GhaaolYX44Gg5q6tYDohnai5SpdS5d9+ndBggXK5 0PwMnnYFQNRCGjFoiD+I8BRukbl3ISdjOT1UaI1lwIZjLcrQPqnyF8p26vjy8D0lBgyR B3JiV6qqEX6TAYIPmZYQ12lTtI3zzOaiCd2Iw7duj5rwO8erXHP2awTW0+CMvWc6Gd9C LtqafNxFamkmKNTy2C5w0pDqJlXOoN10fkGi2rI5bd/BqQg5V79GdBcIPCxya8/IL4CW tqSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mwPDuRJX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-28355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28355-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d3-20020a1709067f0300b00a2c29dde73dsi4914994ejr.542.2024.01.16.14.45.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:45:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mwPDuRJX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-28355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28355-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 21E4E1F2A3D4 for ; Tue, 16 Jan 2024 22:45:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CD60208AD; Tue, 16 Jan 2024 22:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mwPDuRJX" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 580081D6BD; Tue, 16 Jan 2024 22:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705444500; cv=none; b=sqA3c37nmpakeo3M8pZAd4kULBceqm6fxubR/nvesZScCBIjuVGKDm52Px9H0g6EKTjVzgBSR2E71TfOLqkzqxxEoQW0JKcn24ailEPfSJOseWTY+FAXpC2Mr4dcfF3HBjI5oFHagUlD2/3hyfXOE0rCCqcHFVyCy58qEJFBvYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705444500; c=relaxed/simple; bh=dmGaxNFM9Z9co81GnDP7HWWiN/PTrKhRDUIvIXynA4s=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received:Sender: Message-ID:Date:MIME-Version:User-Agent:Subject:Content-Language: To:Cc:References:From:Autocrypt:In-Reply-To:Content-Type: Content-Transfer-Encoding; b=FJMnl7V4xYvBnIGnppKiLolCJrF5AQhUVdesbxxI6Vo9CQ2BAZDXoeDGDplaILuOqUwgr4GqT9UsKq9An/wneVNdcdWClUd1Udayyc1aLEXuZ78jacCguep+PqkROXJ5Ka9ejvHLa9v+HtWT5lOph8uvAj5b0gc9q9Q4UKkf3OE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mwPDuRJX; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d5cdb4a444so20436995ad.1; Tue, 16 Jan 2024 14:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705444498; x=1706049298; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=2ObGmy+ZDmOiEep2qeMUG0WYfwliEG3p7QfyY5yhTY4=; b=mwPDuRJXim4Ua3Zs6+7bOgYaXDoe0gYPLQghRv7IDFcL+h5vSmZ5xHA2Y+ve2YJu8n sD79/KJFIHmptMMxCqs6BXtKl7Kw4JPZvtB/3HdloR1S9KAVViiXH2KOATV1QVpFRah9 FWwzpSpHooVlpBwo1eQI/ZH6A/nco4FoW2bKawNJxKAtmJVaeaY701hmD978KHCwHevJ 4oAePACXQF3t3++F4O2AwUtSphL5OwwHunhXpXgPQSPwvv80imWdlf/xedQNFSJYuB6D aawGoFpUTVXOA7iKZQR2WzhK2D55OqrMDClbv1ubSJ4ozX4S0Ier5oT1H3wfwHCZgV48 +2bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705444498; x=1706049298; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2ObGmy+ZDmOiEep2qeMUG0WYfwliEG3p7QfyY5yhTY4=; b=tLNAQy/xicxsQWo9l+lIWKVcTEr0qvKQk66yyrw9jc/CAMXK0OoNE5tvCGwRJa9cOZ domn8zz51CQ3XN6a7/8ZlPhLWxlcNirURDiyJbPAOlyBCgAVbtJe3wY/CiqU9h56RLaW k7+2QA1JvfHF32odOkcQRvMbOKs/2YMNoOHwP5FlAopQoP0Z1mwqam4QiljeXYeN6SRr tJBhp+pxZh34OJ4E8eoXcTP2nqWO6XQI+2s23yS2r4WNCLmS7QtpifKuC3a8Yv0kLnQX FDdG5N4Q+q7H0/lpj/Ou1XF9A3sOugLOwVWHSIJL9z9WCppFxMIPF2q7fPRRuhS6Cb++ ud1A== X-Gm-Message-State: AOJu0YxeqNF5VfCntEPlk6RFrGoJC2rjmFpp4L0XiV76MIfle0gNFm3O YLTVDJfgQNnFFnsdHA9Xovg= X-Received: by 2002:a17:902:aa44:b0:1d4:c445:c705 with SMTP id c4-20020a170902aa4400b001d4c445c705mr8257678plr.26.1705444497618; Tue, 16 Jan 2024 14:34:57 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v2-20020a17090331c200b001d54c615e09sm9782856ple.252.2024.01.16.14.34.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jan 2024 14:34:57 -0800 (PST) Sender: groeck7 Message-ID: <76bd483b-e48c-4697-8cbd-05a0346090b7@roeck-us.net> Date: Tue, 16 Jan 2024 14:34:55 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] gpiolib: remove extra_checks Content-Language: en-US To: Bartosz Golaszewski Cc: Linus Walleij , Andy Shevchenko , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski References: <20231219201102.41639-1-brgl@bgdev.pl> <19dca2a9-36e1-4a6b-9b65-db4c0a163d56@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2stdXMubmV0PsLBgQQTAQIAKwIbAwYL CQgHAwIGFQgCCQoLBBYCAwECHgECF4ACGQEFAlVcphcFCRmg06EACgkQyx8mb86fmYFg0RAA nzXJzuPkLJaOmSIzPAqqnutACchT/meCOgMEpS5oLf6xn5ySZkl23OxuhpM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1v464dSpy1tQVHhhp8LFTxh/6RWkRIR2uF I4v3Xu/k5D0LhaZHpQ4C+xKsQxpTGuYh2tnRaRL14YMW1dlI3HfeB2gj7Yc8XdHh9vkpPyuT nY/ZsFbnvBtiw7GchKKri2gDhRb2QNNDyBnQn5mRFw7CyuFclAksOdV/sdpQnYlYcRQWOUGY HhQ5eqTRZjm9z+qQe/T0HQpmiPTqQcIaG/edgKVTUjITfA7AJMKLQHgp04Vylb+G6jocnQQX JqvvP09whbqrABEBAAHCwWUEGAECAA8CGwwFAlVcpi8FCRmg08MACgkQyx8mb86fmYHNRQ/+ J0OZsBYP4leJvQF8lx9zif+v4ZY/6C9tTcUv/KNAE5leyrD4IKbnV4PnbrVhjq861it/zRQW cFpWQszZyWRwNPWUUz7ejmm9lAwPbr8xWT4qMSA43VKQ7ZCeTQJ4TC8kjqtcbw41SjkjrcTG wF52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/16/24 13:41, Bartosz Golaszewski wrote: > On Tue, Jan 16, 2024 at 7:23 PM Guenter Roeck wrote: >> >> Hi, >> >> On Tue, Dec 19, 2023 at 09:11:02PM +0100, Bartosz Golaszewski wrote: >>> From: Bartosz Golaszewski >>> >>> extra_checks is only used in a few places. It also depends on >>> a non-standard DEBUG define one needs to add to the source file. The >>> overhead of removing it should be minimal (we already use pure >>> might_sleep() in the code anyway) so drop it. >>> >>> Signed-off-by: Bartosz Golaszewski >> >> This patch triggers (exposes) the following backtrace. >> >> BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:3738 >> in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 7, name: kworker/0:0 >> preempt_count: 1, expected: 0 >> RCU nest depth: 0, expected: 0 >> 3 locks held by kworker/0:0/7: >> #0: c181b3a4 ((wq_completion)events_freezable){+.+.}-{0:0}, at: process_scheduled_works+0x23c/0x644 >> #1: c883df28 ((work_completion)(&(&host->detect)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x23c/0x644 >> #2: c24e1720 (&host->lock){-...}-{2:2}, at: sdhci_check_ro+0x14/0xd4 >> irq event stamp: 2916 >> hardirqs last enabled at (2915): [] _raw_spin_unlock_irqrestore+0x70/0x84 >> hardirqs last disabled at (2916): [] _raw_spin_lock_irqsave+0x74/0x78 >> softirqs last enabled at (2360): [] __do_softirq+0x28c/0x4b0 >> softirqs last disabled at (2347): [] __irq_exit_rcu+0x15c/0x1a4 >> CPU: 0 PID: 7 Comm: kworker/0:0 Tainted: G N 6.7.0-09928-g052d534373b7 #1 >> Hardware name: Freescale i.MX25 (Device Tree Support) >> Workqueue: events_freezable mmc_rescan >> unwind_backtrace from show_stack+0x10/0x18 >> show_stack from dump_stack_lvl+0x34/0x54 >> dump_stack_lvl from __might_resched+0x188/0x274 >> __might_resched from gpiod_get_value_cansleep+0x14/0x60 >> gpiod_get_value_cansleep from mmc_gpio_get_ro+0x20/0x30 > > When getting GPIO value with a spinlock taken the driver *must* use > the non-sleeping variant of this function: gpiod_get_value(). If the > underlying driver can sleep then the developer seriously borked. The > API contract has always been this way so I wouldn't treat it as a > regression. > I said "This patch triggers (exposes) the following backtrace" and "It isn't really surprising since sdhci_check_ro() calls the gpio code under spin_lock_irqsave(). " I didn't (intend to) claim that this would be a regression. It was supposed to be a report. My apologies if it came along the wrong way. Guenter