From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB092ECDE3B for ; Wed, 17 Oct 2018 19:45:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F86B2086E for ; Wed, 17 Oct 2018 19:45:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F86B2086E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42b2hx22WSzF3G8 for ; Thu, 18 Oct 2018 06:45:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=mwb@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42b2Xw4PFnzF3b0 for ; Thu, 18 Oct 2018 06:38:40 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9HJYCmS026544 for ; Wed, 17 Oct 2018 15:38:38 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n69adnery-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Oct 2018 15:38:37 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Oct 2018 15:38:37 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Oct 2018 15:38:34 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9HJcXth47382766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Oct 2018 19:38:34 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6807AC060; Wed, 17 Oct 2018 19:38:33 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA962AC05B; Wed, 17 Oct 2018 19:38:33 +0000 (GMT) Received: from ltcalpine2-lp9.aus.stglabs.ibm.com (unknown [9.40.195.192]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 17 Oct 2018 19:38:33 +0000 (GMT) Received: from ltcalpine2-lp9.aus.stglabs.ibm.com (localhost [IPv6:::1]) by ltcalpine2-lp9.aus.stglabs.ibm.com (Postfix) with ESMTP id 5240C2087F42; Wed, 17 Oct 2018 14:38:33 -0500 (CDT) Subject: [PATCH v07 3/5] migration/memory: Add hotplug READD_MULTIPLE From: Michael Bringmann To: linuxppc-dev@lists.ozlabs.org, mwb@linux.vnet.ibm.com Date: Wed, 17 Oct 2018 14:38:33 -0500 In-Reply-To: <20181017193745.4844.11915.stgit@ltcalpine2-lp9.aus.stglabs.ibm.com> References: <20181017193745.4844.11915.stgit@ltcalpine2-lp9.aus.stglabs.ibm.com> User-Agent: StGit/0.18-105-g416a MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18101719-0064-0000-0000-00000361FED4 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009893; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104107; UDB=6.00571556; IPR=6.00884159; MB=3.00023798; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-17 19:38:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101719-0065-0000-0000-00003B040365 Message-Id: <20181017193826.4844.74017.stgit@ltcalpine2-lp9.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-16_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=870 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810170162 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juliet Kim , Thomas Falcon , Tyrel Datwyler , Nathan Fontenot Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" migration/memory: This patch adds a new pseries hotplug action for CPU and memory operations, PSERIES_HP_ELOG_ACTION_READD_MULTIPLE. This is a variant of the READD operation which performs the action upon multiple instances of the resource at one time. The operation is to be triggered by device-tree analysis of updates by RTAS events analyzed by 'migation_store' during post-migration processing. It will be used for memory updates, initially. Signed-off-by: Michael Bringmann --- Changes in v07: -- Provide more useful return value from dlpar_memory_readd_multiple Changes in v05: -- Provide dlpar_memory_readd_helper routine to compress some common code Changes in v04: -- Move init of 'lmb->internal_flags' in init_drmem_v2_lmbs to previous patch. -- Pull in implementation of dlpar_memory_readd_multiple() to go with operation flag. --- arch/powerpc/include/asm/rtas.h | 1 arch/powerpc/platforms/pseries/hotplug-memory.c | 47 ++++++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index 0183e95..cc00451 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h @@ -333,6 +333,7 @@ struct pseries_hp_errorlog { #define PSERIES_HP_ELOG_ACTION_ADD 1 #define PSERIES_HP_ELOG_ACTION_REMOVE 2 #define PSERIES_HP_ELOG_ACTION_READD 3 +#define PSERIES_HP_ELOG_ACTION_READD_MULTIPLE 4 #define PSERIES_HP_ELOG_ID_DRC_NAME 1 #define PSERIES_HP_ELOG_ID_DRC_INDEX 2 diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 2b796da..c44c6a6 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -507,6 +507,19 @@ static int dlpar_memory_remove_by_index(u32 drc_index) return rc; } +static int dlpar_memory_readd_helper(struct drmem_lmb *lmb) +{ + int rc; + + rc = dlpar_remove_lmb(lmb); + if (!rc) { + rc = dlpar_add_lmb(lmb); + if (rc) + dlpar_release_drc(lmb->drc_index); + } + return rc; +} + static int dlpar_memory_readd_by_index(u32 drc_index) { struct drmem_lmb *lmb; @@ -519,12 +532,7 @@ static int dlpar_memory_readd_by_index(u32 drc_index) for_each_drmem_lmb(lmb) { if (lmb->drc_index == drc_index) { lmb_found = 1; - rc = dlpar_remove_lmb(lmb); - if (!rc) { - rc = dlpar_add_lmb(lmb); - if (rc) - dlpar_release_drc(lmb->drc_index); - } + rc = dlpar_memory_readd_helper(lmb); break; } } @@ -541,6 +549,26 @@ static int dlpar_memory_readd_by_index(u32 drc_index) return rc; } +static int dlpar_memory_readd_multiple(void) +{ + struct drmem_lmb *lmb; + int rc = 0; + + pr_info("Attempting to update multiple LMBs\n"); + + for_each_drmem_lmb(lmb) { + if (drmem_lmb_update(lmb)) { + rc |= dlpar_memory_readd_helper(lmb); + drmem_remove_lmb_update(lmb); + } + } + + if (rc) + return -EIO; + + return rc; +} + static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index) { struct drmem_lmb *lmb, *start_lmb, *end_lmb; @@ -641,6 +669,10 @@ static int dlpar_memory_readd_by_index(u32 drc_index) { return -EOPNOTSUPP; } +static int dlpar_memory_readd_multiple(void) +{ + return -EOPNOTSUPP; +} static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index) { @@ -918,6 +950,9 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog) drc_index = hp_elog->_drc_u.drc_index; rc = dlpar_memory_readd_by_index(drc_index); break; + case PSERIES_HP_ELOG_ACTION_READD_MULTIPLE: + rc = dlpar_memory_readd_multiple(); + break; default: pr_err("Invalid action (%d) specified\n", hp_elog->action); rc = -EINVAL;