Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1017910ybv; Thu, 13 Feb 2020 14:06:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyovOdzqNVGlJbf7iFUobr6bFO1rQtjN3Brsb2HogbaNQmXvPWZjWYpyNbkWIS5qW1GL46B X-Received: by 2002:aca:54cc:: with SMTP id i195mr4387648oib.126.1581631600902; Thu, 13 Feb 2020 14:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581631600; cv=none; d=google.com; s=arc-20160816; b=Bx3EjDUuolLaL4smzWddviVLKMPYForXh/THoK7qpVJt58/4/Wb3bNoTuEksSe9aw1 DeZmh43ag+sBTPzr67+kcMHXkTc8WW+2DkNFi1Pq6OqKaUJCGk50CnNY47IGAYMZKY5a OnipR63ey9OP6SBaqwyh0bxXVF2/PB3J1gvUf5QXNX6Q1zPFvARvZkJ4njEnD7Z0BEwj V32b/kPR1ww2ogK87b1wMDr8hWEvdutR0/1kPFjC+NVQpMgVsndbKj8JZn5lIyLaWdol kEtjqovENpfDWS1mqvVabg9Vki3+FviTg1286cFwrVGxsIVyQUfM4Lxb967rZsaRokqT Igww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TGp5SJCPr8MxwDDZf79HMfQDcGbUPehrWpAKwRR+sMc=; b=Eg1CpD9a+73bQrufhVzAEW+j/UVyQqOEMzqJ5I5ZIMdOIYTvyL1ZmsMWgO39MJi2MC RVCRsPJxQm6oY2EOTlFpCS1oE4SSTDK+9mah5p035Uq1DUSd3lovAy3Z7yWjCyFokrAU X8Z+rZwO4L2QE4uTxum6lT7uFvjWMiuqJRCNB9zQKDuYynUd4bSCt+ocsjQPX+yI8L4M Hk0tIAIgVtoQD1xORPy1QPFTIi3hz0LKGejx+5dgpKIX2rcHFpnY6tpJGuYkQK+0J+jM a2TgOyYg6JW3xc9zE3ZdUQAg65c8hv7un9vweDN7BG8HkfgWaIrtZDbpSEokfXgqrYaE A43Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si1699052otq.210.2020.02.13.14.06.28; Thu, 13 Feb 2020 14:06:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728562AbgBMWFK (ORCPT + 99 others); Thu, 13 Feb 2020 17:05:10 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:57327 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728398AbgBMWFH (ORCPT ); Thu, 13 Feb 2020 17:05:07 -0500 Received: from 79.184.254.199.ipv4.supernova.orange.pl (79.184.254.199) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 73a572daf3199568; Thu, 13 Feb 2020 23:05:05 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: Len Brown , LKML , Zhang Rui , "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 2/9] intel_idle: Clean up definitions of cpuidle callbacks Date: Thu, 13 Feb 2020 22:59:56 +0100 Message-ID: <1923258.fxMWiWM92A@kreacher> In-Reply-To: <2960689.qre192dJKD@kreacher> References: <2960689.qre192dJKD@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" Add proper kerneldoc descriptions to intel_idle() and intel_idle_s2idle(), annotate the latter with __cpuidle and reorder the declarations of local variables in both of them to reflect the mwait_idle_with_hints() arguments order. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/idle/intel_idle.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 8d66efc53b89..5adc058c705d 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -892,19 +892,28 @@ static struct cpuidle_state dnv_cstates[] = { }; /** - * intel_idle - * @dev: cpuidle_device - * @drv: cpuidle driver - * @index: index of cpuidle state + * intel_idle - Ask the processor to enter the given idle state. + * @dev: cpuidle device of the target CPU. + * @drv: cpuidle driver (assumed to point to intel_idle_driver). + * @index: Target idle state index. + * + * Use the MWAIT instruction to notify the processor that the CPU represented by + * @dev is idle and it can try to enter the idle state corresponding to @index. + * + * If the local APIC timer is not known to be reliable in the target idle state, + * enable one-shot tick broadcasting for the target CPU before executing MWAIT. + * + * Optionally call leave_mm() for the target CPU upfront to avoid wakeups due to + * flushing user TLBs. * * Must be called under local_irq_disable(). */ static __cpuidle int intel_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - unsigned long ecx = 1; /* break on interrupt flag */ struct cpuidle_state *state = &drv->states[index]; unsigned long eax = flg2MWAIT(state->flags); + unsigned long ecx = 1; /* break on interrupt flag */ bool uninitialized_var(tick); int cpu = smp_processor_id(); @@ -937,16 +946,22 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, } /** - * intel_idle_s2idle - simplified "enter" callback routine for suspend-to-idle - * @dev: cpuidle_device - * @drv: cpuidle driver - * @index: state index + * intel_idle_s2idle - Ask the processor to enter the given idle state. + * @dev: cpuidle device of the target CPU. + * @drv: cpuidle driver (assumed to point to intel_idle_driver). + * @index: Target idle state index. + * + * Use the MWAIT instruction to notify the processor that the CPU represented by + * @dev is idle and it can try to enter the idle state corresponding to @index. + * + * Invoked as a suspend-to-idle callback routine with frozen user space, frozen + * scheduler tick and suspended scheduler clock on the target CPU. */ -static void intel_idle_s2idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static __cpuidle void intel_idle_s2idle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) { - unsigned long ecx = 1; /* break on interrupt flag */ unsigned long eax = flg2MWAIT(drv->states[index].flags); + unsigned long ecx = 1; /* break on interrupt flag */ mwait_idle_with_hints(eax, ecx); } -- 2.16.4