From patchwork Mon Mar 19 15:47:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132096 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp123037ljb; Mon, 19 Mar 2018 15:30:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELvEJKOTA8O93XCXfPXZ+pA8keN/uXFf1aRGmcTUymNBlsGtYY1H45rglbO7PUsb6f2ZSf7P X-Received: by 10.98.135.76 with SMTP id i73mr11568526pfe.140.1521498608194; Mon, 19 Mar 2018 15:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498608; cv=none; d=google.com; s=arc-20160816; b=E9PPrts/NtzwkJT+PR2GR52AXEZIUXXIukc38EQqLONKC6go5GTIfFFzd0q0UhEMaC 94wsHWXohAmtzCtTn2ihOpQXHItmW9AyvHX7Jv8/dBLgncSq99JR0TZJODznthOqFvd3 AAcGgWBNurbwRPPU/p4y99RxOMmQerd0ESz/JFdWjP+aa566ZP9OAq5gIRN2xcIbXYiU wFKKO/0x1NO16GxKu8tE4AhsimHIiV7E/Is1RJIu1/9XAe+VqFFmDKPykAx2WZJUbRdN MKCV2WUB6GhKijHpKXGadURD6kzx+CtB/TxnZVGfIYDHGGL9wZJVsWVKSXDRG+/3jUKU 7YXQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=4FchJ+SVaykXLEKWv6/QOrC83v07UoRp8vfZcQHPMKs=; b=ThznVwQn2P8NKdBbcIJrVuDkBbBbFz7WhUGWmsLfAUsARuUoqL+tq9M2n2Ts+q5hza j05iRQr54lXGQWlBVFyBBvy6gumYV0jxtbLWCk/CJyYmeoTcdOZr+waddnspqUSadXlz X8LTSiMRW3HBjBdlpRC1xm4606KkkIP+h5gSXZZkq4X2CrVPVXmNuqwqT2DZgvMW68Up nYOJeza20C98rpqPAZ3zjTgRNTLpzPqtMLuILuMfXh7IEFf1g6I2AhEgJ2h97lD4Zmm6 zC+EZxf1X/HTYS6t03rpF+7RF9PHbwGTb3WFL95peCW93LpUER89dc1Gk8bqa4s3o6Oq a0cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=RlGRL7j2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v61-v6si236608plb.297.2018.03.19.15.30.07; Mon, 19 Mar 2018 15:30:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@microsoft.com header.s=selector1 header.b=RlGRL7j2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936530AbeCSWaG (ORCPT + 10 others); Mon, 19 Mar 2018 18:30:06 -0400 Received: from mail-by2nam01on0106.outbound.protection.outlook.com ([104.47.34.106]:16179 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933522AbeCSPsa (ORCPT ); Mon, 19 Mar 2018 11:48:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4FchJ+SVaykXLEKWv6/QOrC83v07UoRp8vfZcQHPMKs=; b=RlGRL7j2YKOK1sbQtq2sYZjqGDag1uy+/YHEVk4CyrTDj+ONbSJr+yOQN7iBWJBQGFugQRQK3NLWitMqZ2XAlPr5khVKfqA6DCxpMdbqwpktW7t2i5EXWwqZyg0ecsThA4iy4HzWh7XvNerLj91+DUEb5L6ibTGoczUfGjjY0As= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:48:14 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:48:14 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Linus Walleij , "Reported-by : Jason Kridner" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 052/124] gpio: label descriptors using the device name Thread-Topic: [PATCH AUTOSEL for 4.15 052/124] gpio: label descriptors using the device name Thread-Index: AQHTv5ml+sln5ZcwBkSMg1noXkQBXQ== Date: Mon, 19 Mar 2018 15:47:54 +0000 Message-ID: <20180319154645.11350-52-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1031; 7:jnORC4JQqwlQ2YYGePIpKHtm9t1dbneZQ2qNHZvn5j3dVMxZb91m2MnRDhkhHtB2q7Z4EynDi7tl4VU1ZrKeX4oi3roTGHXnS8ApLobpLqmHQBUU1+2zXzBVuv1gVScFwdV5/CSMBHudzSJNxuzrZnVl4OcoaK2kCwADbdVcrLEAdsb5XT29XLzsm9JX+kMKPnj/dO8iqTNG/5WC9ci6Rvp0naTBZCFw7pj4KpHfs2EGju3xsEsQKgOAkgsA7Q4Z; 20:ItCoAxTxXzHRGc0Ym+ZyhYd0sSl289hKy+arF9nRNZmoqka4xIy20BjvsOB3nkWTY1qMURk2ZLpafs5WYGDcAKrVZK7+eOYliy2iAWazeBoBP+/rh1EJKfZEsQyu7L7JVq1Zh7gYRdHrMoDlabHmlR8LSX1lKGLNa4IW5WBq0zw= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 67d6edc2-f158-4025-2ebf-08d58db0d33d x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1031; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1031; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(39860400002)(39380400002)(376002)(189003)(199004)(6436002)(6512007)(6666003)(3280700002)(2950100002)(7736002)(6116002)(3846002)(10090500001)(105586002)(4326008)(5660300001)(305945005)(1076002)(81156014)(2906002)(6486002)(81166006)(8676002)(8936002)(2900100001)(106356001)(36756003)(68736007)(54906003)(3660700001)(22452003)(97736004)(6506007)(25786009)(59450400001)(99286004)(10290500003)(76176011)(66066001)(14454004)(72206003)(478600001)(102836004)(26005)(186003)(316002)(2501003)(110136005)(5250100002)(86362001)(53936002)(107886003)(86612001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1031; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: SU7nwxjyDkgGecyRovQc09Ia0QyadCEylaD40h6x3poN1MSNWv6GmdnpkNeKPhBmg0VdWQ4vYLp8i1IKw/aT4izK2phmqFc7dWyJnSsnbQ0oNOOqXEGCQ+7s3OFaRaoG2DjhJ0CwfEyMa9ZbRLn+uff0gTpXMbuk7D9l6evzBeNNMNvwcLRArX7CY1Z/QFcCS19Q6KYnsUHUas7JUHerKNzIM+DLxcNI3yQuyib0Lg8eLTfgJ4q0l6diJ4Ukx7y/iyA2eywnJkv7qamIKGh/9U204tmV5hc/FkvIbmp5beJDGtUPyo9WCXtPtdyP0ythoQXhCw8jRLhsOk7QR8JZ8g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67d6edc2-f158-4025-2ebf-08d58db0d33d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:54.8581 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 24e78079bf2250874e33da2e7cfbb6db72d3caf4 ] Some GPIO lines appear named "?" in the lsgpio dump due to their requesting drivers not passing a reasonable label. Most typically this happens if a device tree node just defines gpios = <...> and not foo-gpios = <...>, the former gets named "foo" and the latter gets named "?". However the struct device passed in is always valid so let's just label the GPIO with dev_name() on the device if no proper label was passed. Cc: Reported-by: Jason Kridner Reported-by: Jason Kridner Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.14.1 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 8abdd0035091..c6c499691541 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3638,7 +3638,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, return desc; } - status = gpiod_request(desc, con_id); + /* If a connection label was passed use that, else use the device name as label */ + status = gpiod_request(desc, con_id ? con_id : dev_name(dev)); if (status < 0) return ERR_PTR(status); From patchwork Mon Mar 19 15:47:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132095 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp122864ljb; Mon, 19 Mar 2018 15:30:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELuFst8Z7CWN+9rufzvHrND8AE1YqYtQyFypewkuqrbCJpEz+OosTbUczwXZF/FXBN8mAe+p X-Received: by 10.99.116.30 with SMTP id p30mr10348986pgc.60.1521498600264; Mon, 19 Mar 2018 15:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498600; cv=none; d=google.com; s=arc-20160816; b=dxLwFFwqkvkGSmnyjg9G/hzeFSeWu8cnvbtmlLrl1xm67gnIVN15AsFCwCCYqLw75z 5jSK+DFTI/4vT2+soRXGsv1IssuOaEUKqNS36u7mxE8O9nnSQnvn/vc2SOwpnKSDZVIF cSY0r8jRtVobRXw7omD0hVNRvSMxun2AW1QxOVa+72bjnzNFDzpJrzoWnGe6m0RPHNMW JU/hFheF6IPkb3gPOv052jPmVDLEbBuKJOA75+cir+CcE5BUTHy7qBdAfE8elSH2dRf5 vhOfKacSPDy2NNII+NS/ZoGgnwkhQBfyXKCS/53x2CzTEbREGkvuNZErvjSZSKrL4d2T VehA== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9kYPuMUFeGhDq02hbqs31IMFqCISMQAl55wBwTpE/Yg=; b=l8bv/fRtkSQ9RYr0pz+auW4ow8CodLVLojHziA3fQ4qoi/MmcAjOW9i4QEhZgau1k1 qMtqcfSR9XD/rMizvhxv5g5NMNO5gIweWZWey0Gfx/87ppfiKVCguQ1TqzVBjsmGKJ5v Ob4L+WXUoBvFK/PcPVkC4CUNpqKAc9MRus4lJh4mr5cRuvVOhxE3slYD8yqgfjgbsKVV 7gEhJ9hyztoLcLKMff/i/vmMJOwVAr1JTssfH+WKuZGqD/75k3JGXU/nj/EvEFD7xlpe ig3p6GcE0htas5qSN1pPBTcgJbCu02heV1CqTa4/VTB6ECyhIhwMqWk8LIyFMSxbbe20 rdWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=BUHmYY+r; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si174716pgv.165.2018.03.19.15.30.00; Mon, 19 Mar 2018 15:30:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@microsoft.com header.s=selector1 header.b=BUHmYY+r; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933828AbeCSW36 (ORCPT + 10 others); Mon, 19 Mar 2018 18:29:58 -0400 Received: from mail-by2nam01on0123.outbound.protection.outlook.com ([104.47.34.123]:15712 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933785AbeCSPsi (ORCPT ); Mon, 19 Mar 2018 11:48:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9kYPuMUFeGhDq02hbqs31IMFqCISMQAl55wBwTpE/Yg=; b=BUHmYY+rcx/jBXttMEuuiSyEa8sC1mHLj549uQF9KzQHKrsOeYopwGq5U0WA8qCVKrxz+cfzUNpUkRnnv8v2oYSefbladtsYOef79LmxhqJSgaoVZlsDKYNewNN81GelfDShELpmRKF1S7HOd7BMFtNy8fudmk/gApgFe044ORg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:48:14 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:48:14 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Catalin Marinas , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 053/124] arm64: asid: Do not replace active_asids if already 0 Thread-Topic: [PATCH AUTOSEL for 4.15 053/124] arm64: asid: Do not replace active_asids if already 0 Thread-Index: AQHTv5mlUZNMn7KDvkq0Rkvp79GfjA== Date: Mon, 19 Mar 2018 15:47:55 +0000 Message-ID: <20180319154645.11350-53-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1031; 7:8wgjjLVb8M/Z6LPeoiilaPXZuB+365H/Ma0DI902E46di1jiuiDtxeKXNMA1Riev8lqq92cuZjnbt6crmrbgpOkOlKaCDdEQ9b+/KScd+mjtXObopY/s2ZHusz+QZIGdyY2dDhCXG0WS3GgLJ4r1fHUhgUUlxgvIvv4l/RYsMklfvWSxnOJKZNBeaH3g+aoCaW5kRhOUXNKIvEa45mvVLcSAdGE7veGZs31to4Fit7i9/BP107ygDNI8gBoebjWy; 20:+ZZvaYQsBlQjekrshXGtl6a7FdYTn8Yn9q4Nk/8bMTuKY30zr4HPLs7PimvWMgjOmiHosfpqtIvj1UnWlMNIXxzMreej9Qv1t927A86IOK39nZ4kZGjwbeXppis36NkhWWad96cFuq5z1Q4pXLTanwt993BUNitdzRQoGNo4XhU= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ba615d28-2717-4ea6-fcee-08d58db0d389 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171)(788757137089)(84791874153150); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1031; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1031; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(396003)(39860400002)(39380400002)(376002)(189003)(199004)(6436002)(6512007)(6666003)(3280700002)(2950100002)(7736002)(6116002)(3846002)(10090500001)(105586002)(4326008)(5660300001)(305945005)(1076002)(81156014)(6306002)(2906002)(6486002)(81166006)(8676002)(8936002)(2900100001)(106356001)(36756003)(68736007)(54906003)(3660700001)(22452003)(97736004)(6506007)(25786009)(59450400001)(99286004)(10290500003)(76176011)(66066001)(14454004)(72206003)(478600001)(102836004)(26005)(186003)(316002)(2501003)(110136005)(5250100002)(575784001)(86362001)(53936002)(107886003)(86612001)(966005)(22906009)(87944003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1031; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: YmZE9Ax43UA/s6B2Ec6GvniuV/fRoZO8CMCU3puNNRzYkzaiEThYbEdxr/91kF75bYhhchDLwbpIpfjySeuxdUuk0T1q8efjvHHODASZDOd2ZhADyDNJgnI+1lZPvg4EKSom6iJM/u6EGmCASG8nAHdibR5r1jb2CsX49QvVbqOX+9W8OXadb7Wu0MxnkhVeIoyrY8W3c9a8UxUAasnRbu1BI+dFlKH8VWsUDy+EumF0yFu09mCcfuBXl1PmARxu0Fk1vZUenHpVsemfFCI8uRQQYN1ebLiN47lTjcMxMByVhAwRmSa+5DK2qK79fW28c76YqrYSaW6WcgLeOnSJNQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba615d28-2717-4ea6-fcee-08d58db0d389 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:55.7588 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Catalin Marinas [ Upstream commit a8ffaaa060b8d4da6138e0958cb0f45b73e1cb78 ] Under some uncommon timing conditions, a generation check and xchg(active_asids, A1) in check_and_switch_context() on P1 can race with an ASID roll-over on P2. If P2 has not seen the update to active_asids[P1], it can re-allocate A1 to a new task T2 on P2. P1 ends up waiting on the spinlock since the xchg() returned 0 while P2 can go through a second ASID roll-over with (T2,A1,G2) active on P2. This roll-over copies active_asids[P1] == A1,G1 into reserved_asids[P1] and active_asids[P2] == A1,G2 into reserved_asids[P2]. A subsequent scheduling of T1 on P1 and T2 on P2 would match reserved_asids and get their generation bumped to G3: P1 P2 -- -- TTBR0.BADDR = T0 TTBR0.ASID = A0 asid_generation = G1 check_and_switch_context(T1,A1,G1) generation match check_and_switch_context(T2,A0,G0) new_context() ASID roll-over asid_generation = G2 flush_context() active_asids[P1] = 0 asid_map[A1] = 0 reserved_asids[P1] = A0,G0 xchg(active_asids, A1) active_asids[P1] = A1,G1 xchg returns 0 spin_lock_irqsave() allocated ASID (T2,A1,G2) asid_map[A1] = 1 active_asids[P2] = A1,G2 ... check_and_switch_context(T3,A0,G0) new_context() ASID roll-over asid_generation = G3 flush_context() active_asids[P1] = 0 asid_map[A1] = 1 reserved_asids[P1] = A1,G1 reserved_asids[P2] = A1,G2 allocated ASID (T3,A2,G3) asid_map[A2] = 1 active_asids[P2] = A2,G3 new_context() check_update_reserved_asid(A1,G1) matches reserved_asid[P1] reserved_asid[P1] = A1,G3 updated T1 ASID to (T1,A1,G3) check_and_switch_context(T2,A1,G2) new_context() check_and_switch_context(A1,G2) matches reserved_asids[P2] reserved_asids[P2] = A1,G3 updated T2 ASID to (T2,A1,G3) At this point, we have two tasks, T1 and T2 both using ASID A1 with the latest generation G3. Any of them is allowed to be scheduled on the other CPU leading to two different tasks with the same ASID on the same CPU. This patch changes the xchg to cmpxchg so that the active_asids is only updated if non-zero to avoid a race with an ASID roll-over on a different CPU. The ASID allocation algorithm has been formally verified using the TLA+ model checker (see https://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/kernel-tla.git/tree/asidalloc.tla for the spec). Reviewed-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/mm/context.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.14.1 diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index b1ac80fba578..301417ae2ba8 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -194,26 +194,29 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) void check_and_switch_context(struct mm_struct *mm, unsigned int cpu) { unsigned long flags; - u64 asid; + u64 asid, old_active_asid; asid = atomic64_read(&mm->context.id); /* * The memory ordering here is subtle. - * If our ASID matches the current generation, then we update - * our active_asids entry with a relaxed xchg. Racing with a - * concurrent rollover means that either: + * If our active_asids is non-zero and the ASID matches the current + * generation, then we update the active_asids entry with a relaxed + * cmpxchg. Racing with a concurrent rollover means that either: * - * - We get a zero back from the xchg and end up waiting on the + * - We get a zero back from the cmpxchg and end up waiting on the * lock. Taking the lock synchronises with the rollover and so * we are forced to see the updated generation. * - * - We get a valid ASID back from the xchg, which means the + * - We get a valid ASID back from the cmpxchg, which means the * relaxed xchg in flush_context will treat us as reserved * because atomic RmWs are totally ordered for a given location. */ - if (!((asid ^ atomic64_read(&asid_generation)) >> asid_bits) - && atomic64_xchg_relaxed(&per_cpu(active_asids, cpu), asid)) + old_active_asid = atomic64_read(&per_cpu(active_asids, cpu)); + if (old_active_asid && + !((asid ^ atomic64_read(&asid_generation)) >> asid_bits) && + atomic64_cmpxchg_relaxed(&per_cpu(active_asids, cpu), + old_active_asid, asid)) goto switch_mm_fastpath; raw_spin_lock_irqsave(&cpu_asid_lock, flags); From patchwork Mon Mar 19 15:48:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132042 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp2969305edb; Mon, 19 Mar 2018 08:50:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBMDhE7ncCZvPGQQFAPmN0UiZcCMSNO/MrbJ98+DKv7nrlo05lV1a99lExLq3+q/fUYV0X X-Received: by 2002:a17:902:5814:: with SMTP id m20-v6mr12067522pli.311.1521474621051; Mon, 19 Mar 2018 08:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521474621; cv=none; d=google.com; s=arc-20160816; b=nHjreaQFfbadiEmMHCv7LASg/ZwkdYJ9J99v9YBNpBxzUlD+T4+8yrMbJR6eE2+cMf kidIZpzdSzxXbGyQohAdSU/1kRmRxBV9WTV3fGHXf6FZFs5EazXRRMetd4JnN2tykggo fMmUGx6qhULSKjjijUHs2ON9AjbEVQ4tsJ4aLlI0QGqPpOpo4eSRaA0vRYXoa0ypnbws DJ0Fu/yb7+tmeMtRFatwY2y/KbgJpqRaesDkFpyrnMFKshV14iVNztwlPVUQ1lKXCU2j 8U/Y2IoA02xCKn7EO/plUwuArg27Ak12p3ybb0ksBrhXhnDJqobPlm6/jnIRTGE/vHU6 sXrA== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3OX0qAj5jfFMHYdFMlJ4KNhnPYVf6Gdp1J74x/CklyU=; b=N4f6GY/3IXQer0pRhxP6KLCXW8wLrGrXiNLPTDhQgswOLLW0IOKa8DTkNIJSMQ0QTH rGQPhti6oLBbEhMRBZgJ/qAPWLa1QEqRAXCIlmBQHmBy0YBIpsImNEPfoLle6rGc+GL3 YGUO3ZZvJlbwH0+JPFHh/Y7MLZScmdzPgO7i1dRPMnpbp6JqqQ8BTuU1nNSE40uw1gTW HtFH+LI6bwmFmrzdh28CORoc+MnePhLXqUGebbvh7mBr0ccyFIt3kGIhUegkqfqSNSTb 5vv11MzjDkNH9TjqM/8ZCzGoiWR/Q9BeSYyKam3ICGRXj6UarcbFS6KtIrpxyA1x4FYF c0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZWlSS/RG; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q188si155086pga.547.2018.03.19.08.50.20; Mon, 19 Mar 2018 08:50:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@microsoft.com header.s=selector1 header.b=ZWlSS/RG; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934072AbeCSPuQ (ORCPT + 10 others); Mon, 19 Mar 2018 11:50:16 -0400 Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:57771 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933993AbeCSPt4 (ORCPT ); Mon, 19 Mar 2018 11:49:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3OX0qAj5jfFMHYdFMlJ4KNhnPYVf6Gdp1J74x/CklyU=; b=ZWlSS/RGGaHWi1iBeqmzF9zF52YwtbhHC3D+GkvFkMw1LZ9h95EbIN8Rp5LghHMzuDNRiWrCisX2/unJ3KUNgstTZj1zHI3bfrxo+zVuSuxRqupJ825UIxGdFUDhOt/e+0v4n2pMPiE3piIBk8V/TUD9ijKSH1V3e2jXgvVTufg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1109.namprd21.prod.outlook.com (52.132.130.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:49:44 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:49:44 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ulf Hansson , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 105/124] PM / domains: Don't skip driver's ->suspend|resume_noirq() callbacks Thread-Topic: [PATCH AUTOSEL for 4.15 105/124] PM / domains: Don't skip driver's ->suspend|resume_noirq() callbacks Thread-Index: AQHTv5nKeduELtCd/0CXDaa1vCMwyQ== Date: Mon, 19 Mar 2018 15:48:57 +0000 Message-ID: <20180319154645.11350-105-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1109; 7:l8VyMlP9d+1s2MhqQOs6lf2vOE4IIoEKcfKm2ZHQvHi/j8GbznVOuwL3SnM/IF5SBMf+KgQq9/+DjY6nIKR7I6BtpDaWqdC4w4ZfxWaU55OS22a4auR+LWePR8ln560LU3f6xjKomt98Kd78aBM2WrwMpbUO9hwRfg3wFUcxUhEu3OfTSuTcBNZU0zGK9XMmfwGq1gi7ZecEh/lxFGd0wnWgcQu3El38jOvAX5JLtU4ptpuHHls3t47r+QpggKIr; 20:PaSiPuTy010N/4Vc9eX1pva3u/7zJc+hezuOD87jaTezM5SrHWrSLfICK9LTmjhZXioVbNIK3vIg3U7RbRuSzHMye7B+7ZbfiQAJqfOKGaVIKS5TYAPDNwE+Gxu/RpvcPGmU/CdXcOdgnRs03kotoicEz0hPvObnF6pCo0ReBjE= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fe3bfe45-3746-417e-f7d4-08d58db10941 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1109; x-ms-traffictypediagnostic: DM5PR2101MB1109: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB1109; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1109; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(39380400002)(376002)(346002)(199004)(189003)(81166006)(10290500003)(107886003)(81156014)(106356001)(6506007)(8676002)(3846002)(36756003)(8936002)(97736004)(6116002)(1076002)(102836004)(68736007)(6666003)(3280700002)(2950100002)(3660700001)(478600001)(72206003)(59450400001)(2906002)(15650500001)(14454004)(76176011)(66066001)(6512007)(5250100002)(10090500001)(2501003)(53936002)(6486002)(6436002)(26005)(316002)(22452003)(305945005)(7736002)(4326008)(25786009)(86362001)(86612001)(5660300001)(2900100001)(99286004)(54906003)(186003)(105586002)(110136005)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1109; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: S2+Yj1EJYh/FB6SyaGJ00/9sD+5JsuipbqTbk+RSm1Mwy3bqBrGwCnqgymx22PkLob+ZW+xAS5VOO58LS/5pHrsH/SG3EXc53SomTOSTrtwk3K1hE2JlwAHp0d+8BNOxRmxWfMkNKN498BHAAbvlHrV2kun7C9SNtUai/hurRr/Gpr7z63V7LI9luvO1m7MUs3UGoKk5t9tljjiyUgPBNOmiZnCvyq36rO0mKajYMcFxYf8T+5OhaCHvE6HKFGSp30M0bL+h6pVbqVy7Cfkux5bu1JpdOMQkcixzaDFGNwpsdsZdLppPh4qKgWG3/IKQ23Y0ff/BdqMGAMqhoQZRMw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe3bfe45-3746-417e-f7d4-08d58db10941 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:57.3118 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1109 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit a935424bb658f9ca37eb5e94119b857998341356 ] Commit 10da65423fdb (PM / Domains: Call driver's noirq callbacks) started to respect driver's noirq callbacks, but while doing that it also introduced a few potential problems. More precisely, in genpd_finish_suspend() and genpd_resume_noirq() the noirq callbacks at the driver level should be invoked, no matter of whether dev->power.wakeup_path is set or not. Additionally, the commit in question also made genpd_resume_noirq() to ignore the return value from pm_runtime_force_resume(). Let's fix both these issues! Fixes: 10da65423fdb (PM / Domains: Call driver's noirq callbacks) Signed-off-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/domain.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) -- 2.14.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0c80bea05bcb..b4501873354e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1032,15 +1032,12 @@ static int genpd_prepare(struct device *dev) static int genpd_finish_suspend(struct device *dev, bool poweroff) { struct generic_pm_domain *genpd; - int ret; + int ret = 0; genpd = dev_to_genpd(dev); if (IS_ERR(genpd)) return -EINVAL; - if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) - return 0; - if (poweroff) ret = pm_generic_poweroff_noirq(dev); else @@ -1048,10 +1045,18 @@ static int genpd_finish_suspend(struct device *dev, bool poweroff) if (ret) return ret; + if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) + return 0; + if (genpd->dev_ops.stop && genpd->dev_ops.start) { ret = pm_runtime_force_suspend(dev); - if (ret) + if (ret) { + if (poweroff) + pm_generic_restore_noirq(dev); + else + pm_generic_resume_noirq(dev); return ret; + } } genpd_lock(genpd); @@ -1085,7 +1090,7 @@ static int genpd_suspend_noirq(struct device *dev) static int genpd_resume_noirq(struct device *dev) { struct generic_pm_domain *genpd; - int ret = 0; + int ret; dev_dbg(dev, "%s()\n", __func__); @@ -1094,21 +1099,20 @@ static int genpd_resume_noirq(struct device *dev) return -EINVAL; if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) - return 0; + return pm_generic_resume_noirq(dev); genpd_lock(genpd); genpd_sync_power_on(genpd, true, 0); genpd->suspended_count--; genpd_unlock(genpd); - if (genpd->dev_ops.stop && genpd->dev_ops.start) + if (genpd->dev_ops.stop && genpd->dev_ops.start) { ret = pm_runtime_force_resume(dev); + if (ret) + return ret; + } - ret = pm_generic_resume_noirq(dev); - if (ret) - return ret; - - return ret; + return pm_generic_resume_noirq(dev); } /**