Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3099219ybi; Thu, 18 Jul 2019 21:01:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6fNi667mqoH0ilP0cN7qCYEQEGS3QyYB0NCfkcX57toe/bj0sFKgaDWp+TKyj0QfPqbx8 X-Received: by 2002:a63:490a:: with SMTP id w10mr50677767pga.6.1563508878142; Thu, 18 Jul 2019 21:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508878; cv=none; d=google.com; s=arc-20160816; b=bIN+biCVdgG9Ejcpv+VihqKfCv1z3NIZCGwL+sBjPW47tVYeDBjFhzj1BgOvM6XnzH ZH/xe3aPqs3fki5tWI/XVJJEFdv0KqTAk/k7o5v5xA4EBrLfqhFbMsCdgDpKvmRyy1jE krdVRb8voz2md9KeVJpKwD1Ud8IK9wVVi2476cAOAgz/MfPnw/UsYFqIDH7LO/DYyxcY dNDbw5D6Dd0incuvbP8imOLoP0hX8P/2JSpWx0dhhsHK2jF8Khq5Uj51BzzqoJ0GfdMB iqxXAppjtk+CEGeDbVuc65i2bBGm1i8cshspK73+EqC03+GzXL+d/3xWXNwewFjSjv8D GZsA== 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 :dkim-signature; bh=EbOEq04XXw3xpUOpfwwqizApFH19UCID9R9Lj6+7bJY=; b=EbR+2Nx3V013aU5Dd4scmgBqt5VxDeVdTWRIdw3vdMU2Pp5DKkXPIV7wav9Jz0tVzb ilJYiGE1EQGovFEWxQpYvUChB9WqZ7k/5OVNuNkTXTc/JoCq55E48kIU1dCats8sHbFH K4SsnqmD+RcjioHmqc6/AkIoL0EwsxdsTz/zC74oRmE86OMItOh4rGeRtnGZyU0UFMU6 MkxuXfIPxvHHhvgoMDctT6gzx18kixvr+n+1i1QqxDgnyQSP81NMjyayCjBJuraZzxQg 7hChSOxWwqvkAv9AjUn79kLlC4SqHQ1D4vxEh5mQv1RRna+5rsNYgnMKHMzskVV/g/MP Sn5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cp1Rb85D; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si634963pgd.496.2019.07.18.21.01.03; Thu, 18 Jul 2019 21:01:18 -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=@kernel.org header.s=default header.b=Cp1Rb85D; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbfGSEAD (ORCPT + 99 others); Fri, 19 Jul 2019 00:00:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:59780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728966AbfGSD77 (ORCPT ); Thu, 18 Jul 2019 23:59:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 877E021897; Fri, 19 Jul 2019 03:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508798; bh=kWl7ki8gD50y+AFBXm5vB+yb+O7/3/NGsP6VegL2F0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cp1Rb85DBhJArJstpDhveczPT0w23hE4wch7TE6I+wnphX8WFYmf2wI62l707iBTD Cn1dScaQ3JKqyhqhVocjvT7MEd/6RKDVY0pp6PcyXG3WY3FCoyidjUntzvauuzo9Et usZMQPC1MHNajFvlUnCGIE/fIEHSRiqGCutBlTMw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Lynch , Michael Ellerman , Sasha Levin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.2 094/171] powerpc/rtas: retry when cpu offline races with suspend/migration Date: Thu, 18 Jul 2019 23:55:25 -0400 Message-Id: <20190719035643.14300-94-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch [ Upstream commit 9fb603050ffd94f8127df99c699cca2f575eb6a0 ] The protocol for suspending or migrating an LPAR requires all present processor threads to enter H_JOIN. So if we have threads offline, we have to temporarily bring them up. This can race with administrator actions such as SMT state changes. As of dfd718a2ed1f ("powerpc/rtas: Fix a potential race between CPU-Offline & Migration"), rtas_ibm_suspend_me() accounts for this, but errors out with -EBUSY for what almost certainly is a transient condition in any reasonable scenario. Callers of rtas_ibm_suspend_me() already retry when -EAGAIN is returned, and it is typical during a migration for that to happen repeatedly for several minutes polling the H_VASI_STATE hcall result before proceeding to the next stage. So return -EAGAIN instead of -EBUSY when this race is encountered. Additionally: logging this event is still appropriate but use pr_info instead of pr_err; and remove use of unlikely() while here as this is not a hot path at all. Fixes: dfd718a2ed1f ("powerpc/rtas: Fix a potential race between CPU-Offline & Migration") Signed-off-by: Nathan Lynch Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/kernel/rtas.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index b824f4c69622..fff2eb22427d 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -980,10 +980,9 @@ int rtas_ibm_suspend_me(u64 handle) cpu_hotplug_disable(); /* Check if we raced with a CPU-Offline Operation */ - if (unlikely(!cpumask_equal(cpu_present_mask, cpu_online_mask))) { - pr_err("%s: Raced against a concurrent CPU-Offline\n", - __func__); - atomic_set(&data.error, -EBUSY); + if (!cpumask_equal(cpu_present_mask, cpu_online_mask)) { + pr_info("%s: Raced against a concurrent CPU-Offline\n", __func__); + atomic_set(&data.error, -EAGAIN); goto out_hotplug_enable; } -- 2.20.1