Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4648560rdb; Fri, 29 Dec 2023 08:36:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzG8QxWafu1vjlwDAizuuj6DnmfpMsBhM80V9wWQOHnMCLNmkoCYizKheO365D9QNdeWLj X-Received: by 2002:a17:907:3acf:b0:a26:b86e:2b0f with SMTP id fi15-20020a1709073acf00b00a26b86e2b0fmr3196776ejc.127.1703867784830; Fri, 29 Dec 2023 08:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703867784; cv=none; d=google.com; s=arc-20160816; b=R4ScltNFbDM4J7MJn8mYKYfSYHjkgEIMazGBlxWk/qm7YucdkLWKCtUxIf6GZiW/wI kldKn6JiQNZrneBGboe1/tKV3dOKYDBvHaJQZN9NY2RYE1A017fJC+v+I0m2wyKXRsGu cHxPx3XJdDDFH49WWAT864EIWOZQP9HysS+72KVvyS+1fqm+SEtpK24hF3m68fSmNn7n LnmIayTXjmBUkJiTrCUcwjxOZsEHNerZaJTPDF3L96s8nYitrJ070Nj5U+qTSk+AW6hw tDVU++xnoKBtHodAeXgYeTyivbR6qV13TA2s2bsUbGjZZk7muUsTJfB3muEktbqdlHJu AIDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=g5osr6xfn25Wt0TdDGmPAZn7SDMAzkOWPXYFwHYI1i4=; fh=a9joolQSUO//2HtTji6PElbTysgVtDmQJESWkVR7nU4=; b=BepOCjTx9LH5tj2WOtXuB4P5iwwei1FftmGyaJwJNiAHplW51e8oFmF8uTeMQmZukn ib1GUNbNHL9H5cNbfpWaQB63SfxkSF/xGCQ8pAKI+9E/ieAI+c+cJ934IQNSmdITTM5Z o06jhe/gGZw0Sb7UQBoi/QrcnTHoJtQuuOTw+atVN+mJeSq91R42Pfzlw9ggLf3YBNCh bFvgAKnJmXWnn9y/dU438a5zQNoh5xBuOVp8hJaljlwR5Mq/ZsVqzywICXqk4F+T1AbD rAevjkmK5kgewyOhZVUmWNQOpxW6f0IaS0UB4T5LBsTB/HvYz3EvmbWemHw7MrZfu6Vk AJ6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 j21-20020a170906255500b00a276987d719si1358550ejb.192.2023.12.29.08.36.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 08:36:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13161-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; spf=pass (google.com: domain of linux-kernel+bounces-13161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 6723A1F22BE6 for ; Fri, 29 Dec 2023 16:36:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B3BD12B69; Fri, 29 Dec 2023 16:36:15 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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 9E5AF12B60; Fri, 29 Dec 2023 16:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3bbc5cd15b6so361934b6e.0; Fri, 29 Dec 2023 08:36:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703867772; x=1704472572; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g5osr6xfn25Wt0TdDGmPAZn7SDMAzkOWPXYFwHYI1i4=; b=v05a3tJjKfXRApfF4MI7GmraruaMjJN0N6i3Nw/OHO4BjLBJe4WhaRMrfvMkxnsZrU fgnoPDJhXrPqPTHaQNZtbEMTHLTNK4nhVtXvmG+J1/UBZlQFyqJRgFwWb3xHnG+Gdd99 129p6TuHUYJdDgpd+yN1jBt4VOylZk7HlPsSX9jISGLpht6auoZ2IFJybj+4m9tJzfIb 1ScDPbIRv4ioRp38sNXJS2Bhb4K2zRU14jELTPQGvJXx1cqNvRp3u3VH8ii1D9Mjda68 tW/mQ6EhW/J2KPIofn2jRbhBcNSdEQTIZ5yy/PN5IdBMqrGrAIJJnRnIzQn5L8NyIyvi mMag== X-Gm-Message-State: AOJu0YyoIaMwxX8NstoctBIP+ZxZ75ZnmzEyQoEk80uXm4Ta/oo39+aC ciPYZGC2qfojxLhIWroxpqDjXtWCrRmfrj9cTkQ= X-Received: by 2002:a4a:dc96:0:b0:594:ad62:bab9 with SMTP id g22-20020a4adc96000000b00594ad62bab9mr10280653oou.1.1703867772553; Fri, 29 Dec 2023 08:36:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <5754861.DvuYhMxLoT@kreacher> <6019796.lOV4Wx5bFT@kreacher> <4874693.GXAFRqVoOG@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 29 Dec 2023 17:36:01 +0100 Message-ID: Subject: Re: [PATCH v1 2/3] async: Introduce async_schedule_dev_nocall() To: Stanislaw Gruszka Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Greg KH , linux-pm@vger.kernel.org, Youngmin Nam , linux-kernel@vger.kernel.org, d7271.choe@samsung.com, janghyuck.kim@samsung.com, hyesoo.yu@samsung.com, Alan Stern , Ulf Hansson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 29, 2023 at 3:54=E2=80=AFPM Stanislaw Gruszka wrote: > > On Fri, Dec 29, 2023 at 02:37:36PM +0100, Rafael J. Wysocki wrote: > > > > +bool async_schedule_dev_nocall(async_func_t func, struct device *d= ev) > > > > +{ > > > > + struct async_entry *entry; > > > > + > > > > + entry =3D kzalloc(sizeof(struct async_entry), GFP_KERNEL); > > > > > > Is GFP_KERNEL intended here ? > > > > Yes, it is. > > > > PM will be the only user of this, at least for now, and it all runs in > > process context. > > > > > I think it's not safe since will > > > be called from device_resume_noirq() . > > > > device_resume_noirq() runs in process context too. > > > > The name is somewhat confusing (sorry about that) and it means that > > hardirq handlers (for the majority of IRQs) don't run in that resume > > phase, but interrupts are enabled locally on all CPUs (this is > > required for wakeup handling, among other things). > > Then my concern would be: if among devices with disabled IRQs are > disk devices? Seems there are disk devices as well, and because > GFP_KERNEL can start reclaiming memory by doing disk IO (write > dirty pages for example), with disk driver interrupts disabled > reclaiming process can not finish. > > I do not see how such possible infinite waiting for disk IO > scenario is prevented here, did I miss something? Well, it is not a concern, because the suspend code already prevents the mm subsystem from trying too hard to find free memory. See the pm_restrict_gfp_mask() call in enter_state(). Otherwise, it would have been a problem for any GFP_KERNEL allocations made during system-wide suspend-resume, not just in the _noirq phases.