Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5317226img; Wed, 27 Mar 2019 06:23:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqytdoDQtSh220Z149oKW9Pl2s14Y09dqhs4QL4dL6HlaWAbCq7VygvjlZbf0qU7xJWVPzaK X-Received: by 2002:a63:d4f:: with SMTP id 15mr34530242pgn.162.1553693009429; Wed, 27 Mar 2019 06:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553693009; cv=none; d=google.com; s=arc-20160816; b=pBxioCJNAcYYb9pE3qI8VikbdAlX+dw9CcD5gZYSyMIEdgMNwS6q/CFx5Kr0g2Qaw3 GjSnrHAqDG2qE9Iz/YitVjir5pwf7NuoxEdV70Y+0Zgb6v7SwigIlP5TFOwWM+Rrs2sd P927rDSgX8MNKilXyzpF3W7OS8GV9KOwxZ+hiMWWT2Igg0JTVJExk3ifqE4lo+4MpS7N z5SbPFqe/d725KIarB2nbyZTejHzmNIXyLsz0toeosu1YVT8H/QzoSU///9xIIdrc1o/ conO9rn2vUgC7YAjXmWMTgPWI9MKPPJwj08qzYDNs0nHH8GikYKZT74Mtf4eMQBp+ivR YYoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=mJoxWhmCyb3/U5EQiMFlg+3tnG1hrEoxJr+Q2jp8qb4=; b=zVrfpAyIoPntwS7t3HeTAeL4pAvXBMfHd3OaV1C8ESGe2PadmRirOCAMqNJC9C0a2F yhFdfpVtMjF+ugh8ca4fCA9FwR6rjMPQjmSfhTyPI6Dwy6wbRcDSyWVwuPxW+8C4AVo/ s93Ss4nfagQ4RfuwZUte1p4APPVi6zVUfgQMHUoKe8DEDrKhhAoSGQ7GQSeyOYycX2s/ jEQ3CB/2OKB9aOHddRy+5U5Y752gNEGmR9jTbIbDhuy213zi82q+MhT5Pq9XOxudErDU +vRkIKnKERgisRLJlc7b53T53wMXJ9qI0x259SWV9BgZ5IL9ckKNCy9Qy+6vYk1FyiAC NBwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=F0FPr0vg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y24si7973987plr.255.2019.03.27.06.23.13; Wed, 27 Mar 2019 06:23:29 -0700 (PDT) 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; dkim=pass header.i=@nxp.com header.s=selector1 header.b=F0FPr0vg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730544AbfC0NVs (ORCPT + 99 others); Wed, 27 Mar 2019 09:21:48 -0400 Received: from mail-eopbgr20057.outbound.protection.outlook.com ([40.107.2.57]:29764 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725829AbfC0NVS (ORCPT ); Wed, 27 Mar 2019 09:21:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mJoxWhmCyb3/U5EQiMFlg+3tnG1hrEoxJr+Q2jp8qb4=; b=F0FPr0vgVEoD406wyJs3lSN4FABwuOgxpn2IacEjm5eAAfLdvGLQQ6dTZs9mSppKTbFjP7ZIi3rYb+CXJhxCFkKX7LCcLx6UTzCS58ldIbwI5NFheKK3XOT2I9voyEFLxXw70diiVj6kcPRezU6YQu0jbKJay92Dsca/BIlzLFE= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6051.eurprd04.prod.outlook.com (20.179.35.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 13:21:10 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::9579:32ab:898e:6769%2]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 13:21:09 +0000 From: Abel Vesa To: Sudeep Holla , Marc Zyngier , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , "catalin.marinas@arm.com" , Will Deacon , "Rafael J. Wysocki" , Lorenzo Pieralisi , Fabio Estevam , Lucas Stach , Aisheng Dong CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , "linux-pm@vger.kernel.org" , Abel Vesa Subject: [RFC 2/7] cpuidle: Add cpu poke support Thread-Topic: [RFC 2/7] cpuidle: Add cpu poke support Thread-Index: AQHU5J/xpRRIW2AJek+3mcOjLL/sJg== Date: Wed, 27 Mar 2019 13:21:09 +0000 Message-ID: <1553692845-20983-3-git-send-email-abel.vesa@nxp.com> References: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1553692845-20983-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0038.eurprd07.prod.outlook.com (2603:10a6:800:90::24) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [212.146.100.6] authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3ab53a77-04b0-4d0c-da77-08d6b2b7138d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB6051; x-ms-traffictypediagnostic: AM0PR04MB6051: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(25786009)(14444005)(68736007)(4326008)(6436002)(5660300002)(6116002)(71200400001)(71190400001)(3846002)(256004)(8936002)(8676002)(6636002)(2501003)(66066001)(305945005)(2906002)(53936002)(81156014)(6512007)(7736002)(81166006)(7416002)(97736004)(6486002)(36756003)(54906003)(44832011)(50226002)(486006)(106356001)(6506007)(386003)(186003)(110136005)(102836004)(446003)(14454004)(476003)(86362001)(99286004)(11346002)(52116002)(478600001)(316002)(2616005)(26005)(105586002)(76176011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6051;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TWH2+42YzTL6r44EZTcRdorG9+5Np9ttK6YSpIXGF/hrUeQvdfNgtu7oZUyCeQWDbW7dWBaqqOChfu+Hq0Klo9+F5IaA9IyoPzS/8eRFdmwo0QrjFSLcC8MynB7byLhB4w5gk2L4WMzw0mw8w+QCQ+O1f3utBRcRocvv0F6QQ5S3scocSOrvk/mEWuDxolBgfsLMRA5iI5LE4bug1qU3FgC6LTTkmDaZlX/cuIcTIvtGBoKDDX4bhzd8SIYBil/lTrpW7Sr+q8dH+fAG548PXvli26DFVu5vwTJaim6lnrgH6+sKwgyeN/tGFtYDIsXfkGDxZjhF9sI+0hYQPXtahAFb175eXZLSGX0YVuSt/rAZW4OA53rtfnffJwj8U0PHyJP4216wsMYLrZR/p7AFLWnNEGvXsyUhgEFXDkTphZ4= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ab53a77-04b0-4d0c-da77-08d6b2b7138d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 13:21:09.9348 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6051 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Having a poke operation per state, allows each cpuidle driver to implement, for each state, different ways of waking up (poking) cores. Signed-off-by: Abel Vesa --- drivers/cpuidle/cpuidle.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/cpuidle.h | 6 ++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 7f10830..fca5313 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -297,6 +297,29 @@ int cpuidle_enter_state(struct cpuidle_device *dev, st= ruct cpuidle_driver *drv, } =20 /** + * cpuidle_poke_single - poke the specified cpu to wake up from + * current idle state + * + * @dev: cpuidle device for this cpu + * @drv: cpuidle driver for this cpu + * @cpu: the index of the cpu + */ +int cpuidle_poke_single(struct cpuidle_driver *drv, struct cpuidle_device = *dev, + int cpu) +{ + struct cpuidle_state *state; + + if (cpuidle_disabled()) + return 0; + + state =3D sched_idle_get_state(cpu); + if (state && state->poke) + return state->poke(dev, drv, cpu); + + return 0; +} + +/** * cpuidle_select - ask the cpuidle framework to choose an idle state * * @drv: the cpuidle driver @@ -414,6 +437,17 @@ void cpuidle_resume(void) mutex_unlock(&cpuidle_lock); } =20 +void cpuidle_poke(const struct cpumask *mask) +{ + struct cpuidle_device *dev =3D cpuidle_get_device(); + struct cpuidle_driver *drv =3D cpuidle_get_cpu_driver(dev); + int cpu; + + for_each_cpu(cpu, mask) { + WARN_ON(cpuidle_poke_single(drv, dev, cpu)); + } +} + /** * cpuidle_enable_device - enables idle PM for a CPU * @dev: the CPU diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 88a9119..0270771 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -55,6 +55,10 @@ struct cpuidle_state { struct cpuidle_driver *drv, int index); =20 + int (*poke) (struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int cpu); + int (*enter_dead) (struct cpuidle_device *dev, int index); =20 /* @@ -145,6 +149,7 @@ extern void cpuidle_unregister(struct cpuidle_driver *d= rv); extern void cpuidle_pause_and_lock(void); extern void cpuidle_resume_and_unlock(void); extern void cpuidle_pause(void); +extern void cpuidle_poke(const struct cpumask *mask); extern void cpuidle_resume(void); extern int cpuidle_enable_device(struct cpuidle_device *dev); extern void cpuidle_disable_device(struct cpuidle_device *dev); @@ -181,6 +186,7 @@ static inline void cpuidle_unregister(struct cpuidle_dr= iver *drv) { } static inline void cpuidle_pause_and_lock(void) { } static inline void cpuidle_resume_and_unlock(void) { } static inline void cpuidle_pause(void) { } +static inline void cpuidle_poke(const struct cpumask *mask) { } static inline void cpuidle_resume(void) { } static inline int cpuidle_enable_device(struct cpuidle_device *dev) {return -ENODEV; } --=20 2.7.4