Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3798731ybi; Mon, 29 Jul 2019 12:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmtnT+BUiU6mLAk+3GuEBdpnCwtMF49M0SHxV8+HvKKjVT35ygIo/vHpVl5y1jNS35qP5u X-Received: by 2002:a65:6817:: with SMTP id l23mr65072685pgt.46.1564429864627; Mon, 29 Jul 2019 12:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429864; cv=none; d=google.com; s=arc-20160816; b=s8QzUqTKQsStPfYmuVEDtlrsB8ZA2lHQ/dvYR+H+jirAYDddvZRgAo4Tu1VwreSlWp gMp7JdpQtnQ88G6M8zQm3s33TufuungvsmQrMuUgEMoV6wzGhFbOrqVtdymf/1sWBaOD 3lGfGDIFlh7FOqz2+3VV0h5chO2bWWKBhnLX3NT8frD4aNmJTLyuZS+NxbwrqBNL8hEw LnK2/cL3UzPIHDJiODbvnyakFpDzLaGUi4O8DZLNF7nD/75RqUPltY4+etk921c3cXyw ZVhQPnwixtsChgDxwij2sln2qEDitbpI4Yhv6tJFhhIgC9h2TtC8QKF2c1W3s+yT/b4B i/Wg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gteEiVkfnv6uq1rwQ56tX9CvF8+LN+ezO57+GCLdamw=; b=j/QEbOjLMROjHcpUpRADjFLS8gQG21cBH90krAskxIqfLSHguTdiezeNgzZVopM7Ym MStN3vSTNFO5o060VCkxJhEEMn9BGQ6A5u6KLv2+B6kMh8TdvXZ7YkYAQqjQlvdmFEyd ULNVoVCvod3i2Dtl1uzEJygjdNL7BvmYF9J8MkEVnLiU53N0MgwCxZ2X//Dr+BiKA0Ql JVhxkJF37DmCupupKmuyomwOVcUlCwPOtB4U2XVgqJj+HXcjXC5iKqaC7ii/Od3zNsLu b0lrGmsC/qGl0cwr+1yDWtbAEsG9PsuDy5W5HN6lyk1cacR8i2QOWfbbf3iff1ApCHSW 0aPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZoTr8s+m; 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 193si29066049pfz.124.2019.07.29.12.50.49; Mon, 29 Jul 2019 12:51:04 -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=ZoTr8s+m; 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 S2390570AbfG2Ttj (ORCPT + 99 others); Mon, 29 Jul 2019 15:49:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390559AbfG2Tth (ORCPT ); Mon, 29 Jul 2019 15:49:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2D542171F; Mon, 29 Jul 2019 19:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429776; bh=ljmbUjArS7s9I0wGp7O46tcK9Gu6RtaNGsPsw8xQges=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZoTr8s+m2R7uNtipbWZIi7BmLmSXPoafkeN3Ttt/+B4m1ZtfwsCI8Njvj1hA7vfOa VsmPsqkIzKCrCu4JWFOT2d0oyYL7UogrDincb/y8Xs2FRkTrUtCBA2LaWaSXAtmGZH nY/6t5HIhFOd+E2S2/J05e+9zeEEnN8xm3rd+oMk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Michael Ellerman , Sasha Levin Subject: [PATCH 5.2 092/215] powerpc/rtas: retry when cpu offline races with suspend/migration Date: Mon, 29 Jul 2019 21:21:28 +0200 Message-Id: <20190729190755.293241211@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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