Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7256441rdb; Wed, 3 Jan 2024 09:27:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBtXGKqaL35nCFdYcsthCM5oGh4RWIiXuUZwMbLwv3w5uFpXUJh+I/NuwuLecGR9DFUQUa X-Received: by 2002:a17:906:6a03:b0:a27:b575:5711 with SMTP id qw3-20020a1709066a0300b00a27b5755711mr2200738ejc.198.1704302826535; Wed, 03 Jan 2024 09:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704302826; cv=none; d=google.com; s=arc-20160816; b=TkOhvzIBg1IR7t4sXE3rZ8pN5hnT9Fw958g6gxf3Amts92i0/i9oszS630MZKrK2SS WSb54aDFKyJx1F4Es1EYj3jNkAD0lBCmu5fIT7+wuyxznKhQFQ6aXjEg1O0LusEPSCpz rRpg9T1a/OdhKHyLuyC1j/wGar+YSon1dQpU3GL5Shx800qryRvEPPtxHTYqV2iwYjod v/vvqp6m1gKmxBD6Krgm5rCBE4ubpJW03b3ELsok8se7ZyVfNfjKIfCaS/asGWKb42fZ FGWo/F+iuO6rthoP5iU32n19r44RWrg46ycvRFn8vQjHm81UGdP72fJJgo6nyLLzwgfC 3UXA== 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=3yeGP79SIeBmoqoWjpW3uZR916TO/3Q84JY5Iidc0qk=; fh=xk/AnOW87AHro5jkHt7kwmREk1T9WVL5QeMpwN761DI=; b=h6CxMzIILkBi+gH2WGV3y9TJzfcTuusBjLWGhAQhrX+cC13/Y8BCzf1gAISgPiFMYa 3WaqsrHNLkld0eCYgW9vnH8EKekk7hN6q8DBqycdZRuHfqBeOd1AgCTaaBXeS01xqP+I lsB/vsVF0ka1jpJ5ssj/8KsjoAbCW/B9EzpQkx/KA63FgCK4OkoGiZ1mmvhGiCHJCb9J UE8sElV6+fcx4mE/URGsUVlhvA7jhaZQah0w66FoyaMFqB6LXJzbkFlo5r71dM0atjVD EJBdCizxKolErMcQivDmBSMrKbf9F2HzRSrLrp8gl3Ao7V/VAIJ746ffq5g4rj5Zmrwz HNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MJtJBiNZ; spf=pass (google.com: domain of linux-kernel+bounces-15798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15798-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gh4-20020a1709073c0400b00a26a96753fdsi10249118ejc.227.2024.01.03.09.27.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 09:27:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MJtJBiNZ; spf=pass (google.com: domain of linux-kernel+bounces-15798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15798-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 450891F24DE4 for ; Wed, 3 Jan 2024 17:27:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 546851C29C; Wed, 3 Jan 2024 17:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MJtJBiNZ" X-Original-To: linux-kernel@vger.kernel.org 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 E17931C280; Wed, 3 Jan 2024 17:26:55 +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=1704302816; x=1735838816; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=EJE3hRpgK0X23wIsKdiyvAzh6pSGgJFYMhCfGWSeSWc=; b=MJtJBiNZoMJMrCXxgFmqDk221JUfRAy3g1DTgKZkkTYsYBbpFL8LqdKK Hq6D2B7N8oA+bclF+KQP51jyvNRQljZleend+40frvaXHGZst4JoK8ajS oTTyWu8XmTftWa9GKDONFx/VyBg+/1J+tc2uvTKuJICS3a45/IxCCEfhC 2XUf7Vldi4c5Mx570ga8GGRVEeLYvfkpP0P/11vl+EKi9Awv/2YByVaUL 25RCODabia2S0UILg/sJjALo1+lMUT1/ahHCHN6eAYgccuIhSAbbyM8Xo OaoBmcekpKCz4bbWmMT68WbOnSvcUJxyK+lA1kN4j8QmilKSxs1Q4zxXh w==; X-IronPort-AV: E=McAfee;i="6600,9927,10942"; a="18561802" X-IronPort-AV: E=Sophos;i="6.04,328,1695711600"; d="scan'208";a="18561802" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 09:26:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10942"; a="953283636" X-IronPort-AV: E=Sophos;i="6.04,328,1695711600"; d="scan'208";a="953283636" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.252.36.57]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 09:26:51 -0800 Date: Wed, 3 Jan 2024 16:02:34 +0100 From: Stanislaw Gruszka To: "Rafael J. Wysocki" Cc: Ricardo Neri , "Rafael J. Wysocki" , Chen Yu , Len Brown , Srinivas Pandruvada , Zhang Rui , Zhao Liu , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] thermal: intel: hfi: Add a suspend notifier Message-ID: References: <20240103041459.11113-1-ricardo.neri-calderon@linux.intel.com> <20240103041459.11113-5-ricardo.neri-calderon@linux.intel.com> 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: On Wed, Jan 03, 2024 at 02:34:26PM +0100, Rafael J. Wysocki wrote: > > +static int hfi_pm_notify(struct notifier_block *nb, > > + unsigned long mode, void *unused) > > +{ > > + struct hfi_cpu_info *info = &per_cpu(hfi_cpu_info, 0); > > + struct hfi_instance *hfi = info->hfi_instance; > > + int ret = 0; > > + > > + /* HFI may not be in use. */ > > + if (!hfi) > > + return ret; > > + > > + mutex_lock(&hfi_instance_lock); > > + /* > > + * Only handle the HFI instance of the package of the boot CPU. The > > + * instances of other packages are handled in the CPU hotplug callbacks. > > + */ > > + switch (mode) { > > + case PM_HIBERNATION_PREPARE: > > + case PM_SUSPEND_PREPARE: > > + case PM_RESTORE_PREPARE: > > + ret = smp_call_function_single(0, hfi_do_disable, NULL, true); > > + break; > > + > > + case PM_POST_RESTORE: > > + case PM_POST_HIBERNATION: > > + case PM_POST_SUSPEND: > > + ret = smp_call_function_single(0, hfi_do_enable, hfi, true); > > + break; > > Because this handles the boot CPU only, one has to wonder if it should > be a syscore op rather than a PM notifier. > > It does not sleep AFAICS, so it can run in that context, and it is > guaranteed to run on the boot CPU then, so it is not necessary to > force that. Moreover, syscore ops are guaranteed to be > non-concurrent, so locking is not needed. There are below warnings in smp_call_function_single() : /* * Can deadlock when called with interrupts disabled. * We allow cpu's that are not yet online though, as no one else can * send smp call function interrupt to this cpu and as such deadlocks * can't happen. */ WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled() && !oops_in_progress); /* * When @wait we can deadlock when we interrupt between llist_add() and * arch_send_call_function_ipi*(); when !@wait we can deadlock due to * csd_lock() on because the interrupt context uses the same csd * storage. */ WARN_ON_ONCE(!in_task()); And this one in syscore_suspend(): WARN_ONCE(!irqs_disabled(), "Interrupts enabled before system core suspend.\n"); So seems they are not compatible. Regards Stanislaw