Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4388163rdb; Thu, 28 Dec 2023 23:02:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpugay4AwXQceVEp9E0JCw+OURewtRioomhj4/kMv1kIFsJjGFlBuQRyNk3hVGGXjgVVFN X-Received: by 2002:a05:622a:14cf:b0:425:8fb6:5f74 with SMTP id u15-20020a05622a14cf00b004258fb65f74mr17468429qtx.34.1703833365768; Thu, 28 Dec 2023 23:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703833365; cv=none; d=google.com; s=arc-20160816; b=tj6UKRYvScCoz3JqRZfBpljba05PJ06gu1R9d5hrSW7ndhk3dAgvPlpH+YVWQZM8/g GUBfaZ48b08yk7V1E2d4HzbOUSeSUNVwf8AxGTJXWQSiZ2g9D7vN3343CQg8OGunf1GB 4sgNIMZXy+M9wCsIaLbafpzuTTkSHGa7e5HejxDkS64UZDluAwAoXemvK6FSjR0Omnye MAv9C4b0eXhciVcYAySFVMnNYBc7VtsqBvAVNj8dlbgQaYtCCtkzgQiJYNqieaifwn7s h5pMtnRIgStVPjAR9UriL8oC+U2bDb7ChD4GR5PkihZCpKpAuH9Dxe2KxUli/SIBAVA4 fuJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=wgZVs+amkuK1fUjlxrcYZpbB83PgLwi2Rd8yNz0GwZ8=; fh=fnH9hi1aqVH9h6AWKrpExYLQGHLYX9MeKbUGpiTn0cM=; b=knESdhojqdXWHRGGNIt9v4GpZbJLnKc2NsPkkyol/NpOKg50MFetty7ppUzuEUmz4M mi26gtCAEc/i+G2yqO68ZHAePgogDPctzIY0TmSEy9g+UI+jdCzoFUTTMA5Och4vw67L S7nA+d0GsEvcEU2pCw97xvo6jPjo5ryeJ50i7y8NjGUs3j4NmHtdC2XO5Rei7gNUn45E PzOg7xBFe+7djoXhlOsBcj20cfc+lXMBDFACVUp6O4uEZzIBHEK8n2wuhpaE5vWOS5f6 pRHGczYBrPo9PKubFX+mG8iDf9GVNzeR8/e5qNjCvVGMpgrE/Y+J8/FqEKfvPtLslCTF 5qFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hiQTcVbY; spf=pass (google.com: domain of linux-kernel+bounces-12966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12966-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 d20-20020ac85ad4000000b00423e08d321fsi18590299qtd.142.2023.12.28.23.02.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 23:02:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12966-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=hiQTcVbY; spf=pass (google.com: domain of linux-kernel+bounces-12966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12966-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 755AB1C20D1C for ; Fri, 29 Dec 2023 07:02:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA312567C; Fri, 29 Dec 2023 07:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hiQTcVbY" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) (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 CA4D023A4; Fri, 29 Dec 2023 07:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703833354; x=1735369354; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LSvcQG3U5KLGAazpVSYk1Ga5VrUD6NmAFmtR76jg2NM=; b=hiQTcVbYe75ZaXEdPFno8/L5gezyXbK5BICsGSJMweq9yAG6Pf6YhZCq b/E7C7Le3obbZSEGwdiApPbveSSs8EO9ZUrXUuLnTDciYJbGnEA6HVbj6 Si4tG27m+eur84QedpxJU59QQF4VV5PKW+4hH9p6JvtskMbANmHTGw2+N ldGk1YnVONg2YADtWfjgkZc3YZvgckt0qk16PkjLImsxL9fevZizsWKYD 2MrPMStOEv/y1vlcYZY9Be8aACdwzQDLVIrFlk9G2VTBP7BQC1pAfJww0 l7gXCXQh+3iZgh3zOMkHuWUbWeKbToteWg11CWLKzK6fkj/s00QVdeNY0 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10937"; a="381600831" X-IronPort-AV: E=Sophos;i="6.04,314,1695711600"; d="scan'208";a="381600831" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 23:02:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,314,1695711600"; d="scan'208";a="27070934" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.252.35.82]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 23:02:31 -0800 Date: Thu, 28 Dec 2023 21:29:45 +0100 From: Stanislaw Gruszka To: "Rafael J. Wysocki" Cc: Greg KH , linux-pm@vger.kernel.org, Youngmin Nam , rafael@kernel.org, linux-kernel@vger.kernel.org, d7271.choe@samsung.com, janghyuck.kim@samsung.com, hyesoo.yu@samsung.com, Alan Stern , Ulf Hansson Subject: Re: [PATCH v1 2/3] async: Introduce async_schedule_dev_nocall() Message-ID: References: <5754861.DvuYhMxLoT@kreacher> <6019796.lOV4Wx5bFT@kreacher> <4874693.GXAFRqVoOG@kreacher> 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: <4874693.GXAFRqVoOG@kreacher> On Wed, Dec 27, 2023 at 09:38:23PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > In preparation for subsequent changes, introduce a specialized variant > of async_schedule_dev() that will not invoke the argument function > synchronously when it cannot be scheduled for asynchronous execution. > > The new function, async_schedule_dev_nocall(), will be used for fixing > possible deadlocks in the system-wide power management core code. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/base/power/main.c | 12 ++++++++---- > include/linux/async.h | 2 ++ > kernel/async.c | 29 +++++++++++++++++++++++++++++ > 3 files changed, 39 insertions(+), 4 deletions(-) > > Index: linux-pm/kernel/async.c > =================================================================== > --- linux-pm.orig/kernel/async.c > +++ linux-pm/kernel/async.c > @@ -244,6 +244,35 @@ async_cookie_t async_schedule_node(async > EXPORT_SYMBOL_GPL(async_schedule_node); > > /** > + * async_schedule_dev_nocall - A simplified variant of async_schedule_dev() > + * @func: function to execute asynchronously > + * @dev: device argument to be passed to function > + * > + * @dev is used as both the argument for the function and to provide NUMA > + * context for where to run the function. > + * > + * If the asynchronous execution of @func is scheduled successfully, return > + * true. Otherwise, do nothing and return false, unlike async_schedule_dev() > + * that will run the function synchronously then. > + */ > +bool async_schedule_dev_nocall(async_func_t func, struct device *dev) > +{ > + struct async_entry *entry; > + > + entry = kzalloc(sizeof(struct async_entry), GFP_KERNEL); Is GFP_KERNEL intended here ? I think it's not safe since will be called from device_resume_noirq() . Regards Stanislaw