Received: by 10.223.164.221 with SMTP id h29csp2927870wrb; Thu, 2 Nov 2017 21:35:06 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SSXGbWJ8vphAB3XL9jsRnG1KCP2V78TmFfE5gcf8d9N4HqPNjjO6jAQ/VUsW79zMfZA4Rx X-Received: by 10.99.63.7 with SMTP id m7mr5659590pga.359.1509683706596; Thu, 02 Nov 2017 21:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509683706; cv=none; d=google.com; s=arc-20160816; b=ZahdO0fv6n0d6ErUU6gi0pCOIVzJRHPrySUyVETJbCQZZB3iPkNlTLxiyXaeLe1zPW BI5G/7ENOz4vgZXniPJAGhl8pI01sGcbhKTJ/yAFoqropXI5EFWf4xvF8P5/dfT8ckQn wENc4DpwoCCHEwDUn8qhic+kUkVVT1OuaGgrMkawNriMD2N5Q/P2Juo9CqiG5OrBK01m WFCovvG3QqisVo8HmohJgeW9KJoqcDlk8ZRmfpaL6DTNPT4f4CMIcZj6k1W8A8fpzrCS k+7L4yKUH5MySc5zk/iSLm8YxAseg6J0CjHFm678zbhnkWIS0IBx84DhihHthF1BUIMR I/QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=7n5MsWMu9rxJCoui8M2D2Vv+CmKsj6mMTx2DyPJUVPk=; b=lpZeBht9Id8ex7Was0oso1KjdcPKGDhS9ZD/9VB5LmCxpcRLmUmI8gG3VQ9OoHfPMJ RnwtNGl09ldUuTeyaH40EdVlPlMjHiDnYiiseO3D/gZ7y9VH83nQJWwqOS1NrOjKtvy6 Kh8qSRFNWjVkjpjMWdTUVpKoVRVllGw1AYzS/Bz1tDl0Mdg5YKE1iH+HFGIBBEtWKkRM YyvvQl4+cf1r0Z6BTdpIjjUIvh+XqzWbvP2+V/b+jyDFp+5hNS7Qytr5//NwDltRGXEs GZ7yOiIw5QC+IR1O1iuQh3mGeIYpuMLDRAitxl9OwOGEL99a8X8ilATYPJZYXYmKk3da ZTOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TWmeE/OD; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h83si5198750pfk.250.2017.11.02.21.34.36; Thu, 02 Nov 2017 21:35:06 -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=@gmail.com header.s=20161025 header.b=TWmeE/OD; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbdKCEdk (ORCPT + 97 others); Fri, 3 Nov 2017 00:33:40 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:46294 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbdKCEdj (ORCPT ); Fri, 3 Nov 2017 00:33:39 -0400 Received: by mail-pg0-f65.google.com with SMTP id k7so1502811pga.3 for ; Thu, 02 Nov 2017 21:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7n5MsWMu9rxJCoui8M2D2Vv+CmKsj6mMTx2DyPJUVPk=; b=TWmeE/ODpQFLb8uTQy6sxoucQY76IIdIaRxsfdnVFgBcqA/0dI+JjhCqZxTQhaijgn XGMcglN/SZVC/RoMrSVy+kaQadMYBtLIdh+sqPDICXYz5O81blupqAct8EYyUBRjZOKf 7jqAY9avQepzCL6iOQF7ndARJKVjKI9Lty+7/PJ3kLsH9sDmT0tAqxzK/TsCPsGS2xoz HBMAoSUOyZBrpUiI2DcmLDpXYIKB/1UZg3nnx4nRVK+kw3GktjhkOmrK6dCP27Klvn6e HVWLJewGO0FpTgEOBTybJ6cNwh7C4kZycK43KV5JVlM/sHl4jGH5Yrohl0E7dkGwHHE6 zRGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7n5MsWMu9rxJCoui8M2D2Vv+CmKsj6mMTx2DyPJUVPk=; b=VAtvZ/+wBP9kQNoShmmiL6f4inn/nEZabInd28HGE7ehcou3adBn/xvV3J6WKGt42C pYlTmPhXmNaacRwfiiadV5lv9Ou4O9qnC5mXUX+3ELVCDB5XENJmlLhL9r9DLPr0//tH yPO3PBjeraWjFhNL1NbBXrf6wv3F1iKeQIRYNdyNWfL9RBll8EJOlzi5ivlY9LJdtV44 rdgwGNCd8V2m0GEpvjdIEFB87K5HV7/BBGLvuhpkc44h+uafRA9dcSuj17+IvFZu+OqU Ii1A+svDonTDrjnC6+967g7pWFqY86bR1LCljvE46iCTHulz5l8DLKyMEEszbuF5Pz9M 3BQA== X-Gm-Message-State: AMCzsaUZnj4/CgyvAUX9FPxTN4ebdgVQ/QwFpmiOqHg/tjcLq5om9YQc OgzFX8RawdYLymihVsImdXHjHztL X-Received: by 10.101.92.8 with SMTP id u8mr5352595pgr.93.1509683618201; Thu, 02 Nov 2017 21:33:38 -0700 (PDT) Received: from localhost (g183.61-45-92.ppp.wakwak.ne.jp. [61.45.92.183]) by smtp.gmail.com with ESMTPSA id t24sm7945790pfj.46.2017.11.02.21.33.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2017 21:33:37 -0700 (PDT) From: Stafford Horne To: LKML Cc: matt.redfearn@mips.com, Stafford Horne , Jonas Bonn , Stefan Kristiansson , Jan Henrik Weinstock , openrisc@lists.librecores.org Subject: [PATCH for-next] openrisc: fix possible deadlock scenario during timer sync Date: Fri, 3 Nov 2017 13:33:22 +0900 Message-Id: <20171103043325.20646-1-shorne@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org OpenRISC borrows its timer sync logic from MIPS, Matt helped to review the OpenRISC implementation and noted that we may suffer the same deadlock case that MIPS has faced. The case being: "the MIPS timer synchronization code contained the possibility of deadlock. If you mark a CPU online before it goes into the synchronize loop, then the boot CPU can schedule a different thread and send IPIs to all "online" CPUs. It gets stuck waiting for the secondary to ack it's IPI, since this secondary CPU has not enabled IRQs yet, and is stuck waiting for the master to synchronise with it. The system then deadlocks." Fix this by moving set_cpu_online() to after timer sync. Reported-by: Matt Redfearn Signed-off-by: Stafford Horne --- arch/openrisc/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 4d80ce6fa045..7d518ee8bddc 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -127,10 +127,10 @@ asmlinkage __init void secondary_start_kernel(void) /* * OK, now it's safe to let the boot CPU continue */ - set_cpu_online(cpu, true); complete(&cpu_running); synchronise_count_slave(cpu); + set_cpu_online(cpu, true); local_irq_enable(); -- 2.13.6 From 1586655940213755496@xxx Wed Dec 13 08:16:59 +0000 2017 X-GM-THRID: 1586231777295738408 X-Gmail-Labels: Inbox,Category Forums