Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp319767lqp; Tue, 11 Jun 2024 05:49:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTeklGXIBHj7bnTvJdbJ2GxEZprri/S4ayuYQnMNQiO2Dm54QLjRgiJ9aP07+/r7WCxMSeov7WP4GOrl12zxBikQ9kwECE2u4ot870gg== X-Google-Smtp-Source: AGHT+IHSNdPtfjuyi6hhiObBGf5JCUhPJNEVKt0LL+qdv9CLNgBP8uOnrQZnJv8cpAj8ssLcad2h X-Received: by 2002:a05:620a:4546:b0:797:5765:b844 with SMTP id af79cd13be357-7975765bb48mr558143285a.37.1718110170344; Tue, 11 Jun 2024 05:49:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718110170; cv=pass; d=google.com; s=arc-20160816; b=ijG0CmFrPSLhpZg6PQtaT7gr+YYQnW7RfSG4+eHjslR0fSbDNkmZvT49dcRsANp6qu Vbtjz8yWKZAajgVuiV6iJRb1Cgjh4nFtHyvWJJwmjDaZtSBpvLoAa5WYT9ZPpu+jmq98 waidORqE0VD7uZeTX7CKPoEYTgqQug1o9r5+zZsVtaRO4F9dSqYobBG4CvgCzisHqh9R tkpo7ULd+0dvJJ0dchOTeWgoOWRSwYbUj1CMTyXMc012P099taPK1x7EN/27QPPie4nc ynNLnfiARoRbTUH9vmO3oUABn2CgPDqMQl4lz5IuH4abDVtcMQuPiiYksBsZ1Dbsm4Yo zepg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=q/+FYAMnRPQpYJxyZf17TaLFB9/YgLnzol82QmYmED8=; fh=Ef+u0OFX2RT9heVyk7tCri1rlFnofIwOUW+Hf6/0nKU=; b=rQhENuAujbG1QLpDXjhzmPwhXdvEAuQSwr4MNGfPWVQt94ZIaCBAUDnI1dpCUeQBOX RhWu9ZjGmynCWI/gAzzsipMBAvIWZwZ9KrxJR4ga4LKgAu55+Sh4lgVcfIoPvvSM8UDN 9aw8GelVcGgTwPmmXI7RVMApVaD6Q2BFrtUCGstTxC402HmeGknhPzS7yBgCweqUrmuO xmUu0ZcIhTTeUd4OsQhabRQ1rSROLB/BP0zoir7FHaytnTld6+W6Lhf5Srg69sELnwur 1RJ78ygIDNhwc312a6szQcoPF9t4JIFzQXii6eHKchGDUa3h8lJ+ywNs7BkFLDbmqkdR r3Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UnED1n3G; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-209878-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-79553e27dd7si800377485a.239.2024.06.11.05.49.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 05:49:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209878-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UnED1n3G; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-209878-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 159191C21F1F for ; Tue, 11 Jun 2024 12:49:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DE8A17C22E; Tue, 11 Jun 2024 12:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UnED1n3G" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E44C17C20E; Tue, 11 Jun 2024 12:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718110159; cv=none; b=gPxaS4qxqabGxm9DJj/2XaQ5M85nUmmFEp1yiwLPu7mPzrj9p+1t9yF6+dnnNh6Ex2tS75lZ6xKI8tMAaoehXR7v0pCX30zk7ArlAMsvSz5EIQ2uU22HjN1+vxMKJtyNqsKXi1N4kccHvDp1iql/qJlwXz/hUGz5mTwB938b/Jo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718110159; c=relaxed/simple; bh=+QxKwaQcofH/vz7EI40+6zzWU5vWLDbTcmb2UoPBdts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G4hvdW1XlA0rEa+ztlvC31l/iuKjQ/EsBurfMW4mBPrLQKRp8ySpPN9Vf8CDukI9Qa/SEg6+2MnuToJyW+fvuxn4Z6m3DarV3bF3a7fG88bDc/KMMqleBtiHAWqDwBvERIAo7ayikwuQ0azopljhd0IpTvjip50cH72cAiX1QP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UnED1n3G; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718110158; x=1749646158; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+QxKwaQcofH/vz7EI40+6zzWU5vWLDbTcmb2UoPBdts=; b=UnED1n3GEhxRvqM8ZbnAhjPoOQGh4kAqhkUTpo5GzSd+/T0OkY6QCTju 2mlYOmSOieOfvV7k0k1cwOR2jHW7AuRJe3WfnwFAobk7ohV5AOC0KdHUa 3FyDQeA1NsLsqyuWSYeZtShIr7S4NwYIZ2W2r5E/iQPeqpXsJZVJFWHhS JPBhOS/PhA4NqhDSNnjyVTZRjLwRuyYtQFMQ2w0zBMBoY83SZnWF25rdO TtLO9neCYMAVQz+vUbBot4vL43nlUEeM8PlxnwUXDgzyFb0I/0OxlxfJT g5MYQIJcqE6qRk48BC41xqZcIzgoysJrYSLFG9o7YSmwmNR49QHha6loR A==; X-CSE-ConnectionGUID: FJgiGhNmTEumiDXML0ffNA== X-CSE-MsgGUID: 2nTlOlT7SROv9E9HaGye7w== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="40217850" X-IronPort-AV: E=Sophos;i="6.08,230,1712646000"; d="scan'208";a="40217850" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 05:49:09 -0700 X-CSE-ConnectionGUID: A6HISGOJQiatQg6STih/Yw== X-CSE-MsgGUID: 9c4C8P1+TnSTbPenn1WmuQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,230,1712646000"; d="scan'208";a="40124797" Received: from smile.fi.intel.com ([10.237.72.54]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 05:49:06 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1sH0vv-0000000FXSj-1RHd; Tue, 11 Jun 2024 15:49:03 +0300 Date: Tue, 11 Jun 2024 15:49:02 +0300 From: Andy Shevchenko To: Breno Leitao Cc: Laxman Dewangan , Dmitry Osipenko , Andi Shyti , Thierry Reding , Jonathan Hunter , paulmck@kernel.org, apopple@nvidia.com, Michael van der Westhuizen , "open list:I2C SUBSYSTEM HOST DRIVERS" , "open list:TEGRA ARCHITECTURE SUPPORT" , open list Subject: Re: [PATCH] [i2c-tegra] Do not mark ACPI devices as irq safe Message-ID: References: <20240606132708.1610308-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240606132708.1610308-1-leitao@debian.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Jun 06, 2024 at 06:27:07AM -0700, Breno Leitao wrote: > On ACPI machines, the tegra i2c module encounters an issue due to a > mutex being called inside a spinlock. This leads to the following bug: > > BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585 > in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1282, name: kssif0010 > preempt_count: 0, expected: 0 > RCU nest depth: 0, expected: 0 > irq event stamp: 0 > > Call trace: > dump_backtrace+0xf0/0x140 > show_stack (./arch/x86/include/asm/current.h:49 > arch/x86/kernel/dumpstack.c:312) > dump_stack_lvl (lib/dump_stack.c:89 lib/dump_stack.c:115) > dump_stack (lib/earlycpio.c:61) > __might_resched (./arch/x86/include/asm/current.h:49 > kernel/sched/core.c:10297) > __might_sleep (./include/linux/lockdep.h:231 > kernel/sched/core.c:10236) > __mutex_lock_common+0x5c/0x2190 > mutex_lock_nested (kernel/locking/mutex.c:751) > acpi_subsys_runtime_resume+0xb8/0x160 > __rpm_callback+0x1cc/0x4b0 > rpm_resume+0xa60/0x1078 > __pm_runtime_resume+0xbc/0x130 > tegra_i2c_xfer+0x74/0x398 > __i2c_transfer (./include/trace/events/i2c.h:122 drivers/i2c/i2c-core-base.c:2258) Please, read https://www.kernel.org/doc/html/latest/process/submitting-patches.html#backtraces-in-commit-messages and follow the advice on how to improve your commit message. > The problem arises because during __pm_runtime_resume(), the spinlock > &dev->power.lock is acquired before rpm_resume() is called. Later, > rpm_resume() invokes acpi_subsys_runtime_resume(), which relies on > mutexes, triggering the error. > > To address this issue, devices on ACPI are now marked as not IRQ-safe, > considering the dependency of acpi_subsys_runtime_resume() on mutexes. ... While it's a move in the right direction, the real fix is to get rid of the IRQ safe PM hack completely. Look at how OMAP code was modified for the last few years and now it's pm_runtime_irq_safe()-free. The main (ab)users are SH code followed by Tegra drivers. So, can we fix this once for all? -- With Best Regards, Andy Shevchenko