From patchwork Fri Feb 26 16:32:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1445009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lZ8/oFlI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DnFkW2xF9z9sCD for ; Sat, 27 Feb 2021 03:40:03 +1100 (AEDT) Received: from localhost ([::1]:52882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFg9o-0002G3-46 for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2021 11:40:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFg3X-0004pZ-1z; Fri, 26 Feb 2021 11:33:31 -0500 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:41979) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFg3P-0007ip-D3; Fri, 26 Feb 2021 11:33:30 -0500 Received: by mail-qk1-x72f.google.com with SMTP id q85so9610809qke.8; Fri, 26 Feb 2021 08:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0wSN41gsfP0wx8cWcfsCenYCryYImxZlyeOVat/UOe0=; b=lZ8/oFlIJVO70mkNRYwvxKmfKytO34wkI++jgHyI3RAISWsQbJmuWUtrevS4a8fODD ZaDRudXN09JB2ZUNeBueI4CoB+DmqWAMJbNb+azFqgFE77C2WxZnAP36Mspz3pvM6Cdc aqRSSK55J1cI+xIM+f57YhZ9w5nYG820qIlh8fE1T6exz/6fid2T6Bv0Wuenpo3zCygG wgePc9JGCGBj9KE0te5nhL9WKv68WV4n/dcMb2EOFW5o37GMqhQtI/xdsoXYUYJC8fJ7 MRNNB+z+vkfPUtyI4GA4Hfde0mTLL1IxffNhG68+21IA/GV+/684uHY2V2iBiWH6VDkv 3dFA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0wSN41gsfP0wx8cWcfsCenYCryYImxZlyeOVat/UOe0=; b=J3CKZ0CW5kaXqPZFALgnF+CUg35UU6OC6Mcuq7Z4UwBH56BlyEnvLP8hCHe1Hg9NXX MPjsn4tIyv7hIBSRosnnQ02qaapFgArV1LwsuKQp0nLWw+5TxoXu8Nnc9gWQO+/XideZ lt7M5SObCCB5qq+dgnAEbdrYGsu6iMedB49Z/hveXCUKKSTpm+xLqIm59DwMOiLXkRvS 8vIg1BBvJJhPxUpQoaya4DeCDJAcWervmw8rSIBkn+RiXeDX1mcHsr7DUfavY1nCGQru L2M4XmfVo4CvwnQ/XUuNj9WI5A9Cjin/baJZMtSysz+6x/+v15xsv55jYK9+ywxR8fvr C2Fg== X-Gm-Message-State: AOAM533ZPRLawjADrvPgrqeA7EtWXShfHDgFW7N3zvxkXmyeJmyK4r+7 FQtYLo+ANd8yfy00A6RqbI2STtF02UfsaQ== X-Google-Smtp-Source: ABdhPJzJeCRjN5kltpwQUJEunei/3Vh6yWTudPfC9U0oLtGiJkSYxIza1eMllujP/rOPa46QEXcQpQ== X-Received: by 2002:a37:a913:: with SMTP id s19mr2038506qke.158.1614357198301; Fri, 26 Feb 2021 08:33:18 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:cd1c:d722:e26f:4e76:c5c1]) by smtp.gmail.com with ESMTPSA id t33sm731116qtd.13.2021.02.26.08.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:17 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 1/5] spapr.c: assert first DRC LMB earlier in spapr_memory_unplug_request() Date: Fri, 26 Feb 2021 13:32:57 -0300 Message-Id: <20210226163301.419727-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226163301.419727-1-danielhb413@gmail.com> References: <20210226163301.419727-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x72f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are asserting the existence of the first DRC LMB after sending unplug requests to all LMBs of the DIMM, where every DRC is being asserted inside the loop. This means that the first DRC is being asserted twice. We will use the first DRC to simplify the code a bit in the next patch, so instead of removing the duplicated assert, let's do it earlier. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6eaddb12cb..74e046b522 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3664,7 +3664,7 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, uint32_t nr_lmbs; uint64_t size, addr_start, addr; int i; - SpaprDrc *drc; + SpaprDrc *drc, *drc_start; if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { error_setg(errp, "nvdimm device hot unplug is not supported yet."); @@ -3677,6 +3677,10 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, addr_start = object_property_get_uint(OBJECT(dimm), PC_DIMM_ADDR_PROP, &error_abort); + drc_start = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, + addr_start / SPAPR_MEMORY_BLOCK_SIZE); + g_assert(drc_start); + /* * An existing pending dimm state for this DIMM means that there is an * unplug operation in progress, waiting for the spapr_lmb_release @@ -3701,11 +3705,9 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, addr += SPAPR_MEMORY_BLOCK_SIZE; } - drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, - addr_start / SPAPR_MEMORY_BLOCK_SIZE); - g_assert(drc); spapr_hotplug_req_remove_by_count_indexed(SPAPR_DR_CONNECTOR_TYPE_LMB, - nr_lmbs, spapr_drc_index(drc)); + nr_lmbs, + spapr_drc_index(drc_start)); } /* Callback to be called during DRC release. */ From patchwork Fri Feb 26 16:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1445012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Lyl8X3/m; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DnFr94bsYz9rx8 for ; Sat, 27 Feb 2021 03:44:57 +1100 (AEDT) Received: from localhost ([::1]:32930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFgEZ-00060p-Ip for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2021 11:44:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFg3X-0004pq-94; Fri, 26 Feb 2021 11:33:31 -0500 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:42423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFg3P-0007jA-Tw; Fri, 26 Feb 2021 11:33:31 -0500 Received: by mail-qt1-x82e.google.com with SMTP id d11so6314542qtx.9; Fri, 26 Feb 2021 08:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bP1h3rFMbb8T0NWNRHLG/mNCr4sUyYzgV3DW65L/Oyo=; b=Lyl8X3/mspzCcw5IPJ2YmxOcHePdt7uqjDdS2rklkXJ2E8UcIu97F37yl0aFctD+oE YEqYcYWcQorL1IyNNMROFuZuDr9Bqv8X9dCKZfp9/mc2oEHGSWpeXb3hU+copaM5om5R 2xk+zlxBoNtSTiREM9TmAODFVclPRZegiSc+AdeNgC9AySWkOFYc0W4HaTDSWAv3EE7v S7D1rYE+PaOGRe8A15TuxLGP1/FwBKBEvLR+Tl7q8OsHCiZKtZRqrtZl28kiyi7uH9+q cgnNjblRD/3QFmDfHjMWC/ZI+eE/+xzoDr6o8cakPaO0qsEoTKoXCeq7E6H/NPJSeLqS 4brw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bP1h3rFMbb8T0NWNRHLG/mNCr4sUyYzgV3DW65L/Oyo=; b=Y/sppHKG2qfCXwMc/vNrdtUTw/mDxRV7mMIlsz3Jbwlc/soNYItcXYmHGZTXin7nVF 6xqZq08VVAXd6Bum8oAs57F/WMYBZ5n+2DWVOZp4EmES2KwuzvuL874Yl5bvtvnZBIHG hroELdW1BulU0r+sXbn5x+KrsRTMpqcVdyoaxaleVNs4IKC6uHLGEnMpp/HV5NgQ8BBM Pw4ozY6HHt6I6T9kauCQwbQ18+ifkAc3zwxsImDQwvzXEfFdKAFIxraT9aVWo7EgKuc1 MJuMy0nZM7SOI+NdW8DC+AXeSItTajDRW+oJUhf1b2sBo++9HZjsw87uecQAnyMUw9vB hsWA== X-Gm-Message-State: AOAM533awVylWAtFYkvIVpDmJWUtIGSPO9modOugLXca6HRNc4y3dgeN CiuBtl6N0hdOmcaX2lQxDSwxGwq7H89Zdw== X-Google-Smtp-Source: ABdhPJyOr+dWuXZKBSe0LWI6jDj4RN1Y2IlEzdr821dsGPa7VWQIoJ/DPJGsOb44O5ukoBmPPWg0HQ== X-Received: by 2002:ac8:735a:: with SMTP id q26mr3317576qtp.5.1614357200758; Fri, 26 Feb 2021 08:33:20 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:cd1c:d722:e26f:4e76:c5c1]) by smtp.gmail.com with ESMTPSA id t33sm731116qtd.13.2021.02.26.08.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:20 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 2/5] spapr.c: check unplug_request flag in spapr_memory_unplug_request() Date: Fri, 26 Feb 2021 13:32:58 -0300 Message-Id: <20210226163301.419727-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226163301.419727-1-danielhb413@gmail.com> References: <20210226163301.419727-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=danielhb413@gmail.com; helo=mail-qt1-x82e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that we're asserting the first DRC LMB earlier, use it to query if the DRC is already pending unplug and, in this case, issue the same error we already do. The previous check was introduced in commit 2a129767ebb1 and it works, but it's easier to check the unplug_requested flag instead of looking for the existence of the sPAPRDIMMState. It's also compliant with what is already done in other unplug_request functions for other devices. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 74e046b522..149dc2113f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3681,13 +3681,7 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, addr_start / SPAPR_MEMORY_BLOCK_SIZE); g_assert(drc_start); - /* - * An existing pending dimm state for this DIMM means that there is an - * unplug operation in progress, waiting for the spapr_lmb_release - * callback to complete the job (BQL can't cover that far). In this case, - * bail out to avoid detaching DRCs that were already released. - */ - if (spapr_pending_dimm_unplugs_find(spapr, dimm)) { + if (spapr_drc_unplug_requested(drc_start)) { error_setg(errp, "Memory unplug already in progress for device %s", dev->id); return; From patchwork Fri Feb 26 16:32:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1445016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=cuACRIbD; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DnFzJ5N71z9rx8 for ; Sat, 27 Feb 2021 03:51:08 +1100 (AEDT) Received: from localhost ([::1]:43744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFgKY-0002IM-NI for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2021 11:51:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFg3a-0004uS-2H; Fri, 26 Feb 2021 11:33:34 -0500 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:34108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFg3S-0007k5-68; Fri, 26 Feb 2021 11:33:33 -0500 Received: by mail-qt1-x833.google.com with SMTP id c1so7058428qtc.1; Fri, 26 Feb 2021 08:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=861800TWaNkqS5Y/m11iEAVnYay2bHYjqTj17onrvN8=; b=cuACRIbDfYY6+FyeBnVtAY8nMJdSbqsBalNAaVEkgYwcE/m3AHfCTLvadKisbMPwc7 soV1dNaHxcF83Bh5f39wv3qoHPV3dtrfgds63Yf/yS/8vk0/vc1V2KszCsw2VDUgEKcP BqeN7SG8dNyeEvnLR5srRsh8uNmZL+UIyg+FSxUxLjN5b1u033YsQzP3gWFDphdWAGCM VCLzAJhuKdFnCZ1ktasPi5CZ2VF5TIekacGh1knfIx31NnbzDvKIpD6CWPkaex0lBKgE 8n0ifWFeAYZqVvuxRvZ0pe5A7B5mrT3alSQh1M9z/VNePRlxd0+3/VHH6CijVo7ZZC99 jbbw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=861800TWaNkqS5Y/m11iEAVnYay2bHYjqTj17onrvN8=; b=s8Bv6kGNReoIKe1cMS1W0iaGnmS0rkQEn+DWjUJuAsv7C3Ap1OFO5ZIKpa8d9LEXSA Iu6ZcVP5gyZtvXxrYtGpXF1zlyjRswkhPb8ooZI3D12ONozuO/++rlnAPL0C5MT/Fozz p05R61VetSrDW+8aQBrhJksPRC92qKWgl/4TXb7xsPkFufBNYfKWCLS47zLwCrr4NDKB 8FUfjJMr4QVGhwas1Vnx4rfwPcDCLyRQMU4ECchgfeSOdysjptX665ckBmBEHFy+zVOp SYb2mNe4KW+GSBPC/BvuCefZQBG8QmeHBB2wFSoBjs++mRuojEFHZu9r+u06jpiTLP2L 5Tqw== X-Gm-Message-State: AOAM530+KjbVxXRlzxcc9Taf65gBy9hrDh7+PLdpq0JIacHeFnugvQd0 K8C9PQk0cLfbJao+klXc91xWX17GDD48zQ== X-Google-Smtp-Source: ABdhPJyipI5XLQCdKUA6MUNhxsaHlngKUK26A3+uq9yWBfb3nhOrmOKbyic2gtCeMtoL7cwvLTPdwg== X-Received: by 2002:ac8:5d0c:: with SMTP id f12mr3355948qtx.192.1614357202926; Fri, 26 Feb 2021 08:33:22 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:cd1c:d722:e26f:4e76:c5c1]) by smtp.gmail.com with ESMTPSA id t33sm731116qtd.13.2021.02.26.08.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:22 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 3/5] spapr.c: add 'unplug already in progress' message for PHB unplug Date: Fri, 26 Feb 2021 13:32:59 -0300 Message-Id: <20210226163301.419727-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226163301.419727-1-danielhb413@gmail.com> References: <20210226163301.419727-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::833; envelope-from=danielhb413@gmail.com; helo=mail-qt1-x833.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Both CPU hotunplug and PC_DIMM unplug reports an user warning, mentioning that the hotunplug is in progress, if consecutive 'device_del' are issued in quick succession. Do the same for PHBs in spapr_phb_unplug_request(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 149dc2113f..6ef72ee7bd 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4030,6 +4030,10 @@ static void spapr_phb_unplug_request(HotplugHandler *hotplug_dev, if (!spapr_drc_unplug_requested(drc)) { spapr_drc_unplug_request(drc); spapr_hotplug_req_remove_by_index(drc); + } else { + error_setg(errp, + "PCI Host Bridge unplug already in progress for device %s", + dev->id); } } From patchwork Fri Feb 26 16:33:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1445014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=SD5SkEc1; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DnFtN2nZtz9rx8 for ; Sat, 27 Feb 2021 03:46:52 +1100 (AEDT) Received: from localhost ([::1]:35894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFgGQ-0007GX-86 for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2021 11:46:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFg3Y-0004t6-IG; Fri, 26 Feb 2021 11:33:33 -0500 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]:44039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFg3T-0007kI-SD; Fri, 26 Feb 2021 11:33:32 -0500 Received: by mail-qv1-xf2a.google.com with SMTP id cw15so3982415qvb.11; Fri, 26 Feb 2021 08:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BCak+5bL0bc2PXTFFFEg+FnORCbpmgqZxUJWBfO7Wmc=; b=SD5SkEc11gFzAHOZI2kcFx6m6CPOBNzzlM1s7UiJi6RTL9WfnxaWBpaiTSaZkyDIhR 0zPm40yVukNvZUQf6SQmX75mMAcBXXTtgmjMcV37ownmtGSFN90zpw7W3saPlerdwKy3 xfKah526YanYuLPgDN8kGV+zyvUJwoQ0eAMfMmqfrer+tRvCTjsZnWzBf4Y9QxiuRbGq AZQR3K6IaUBL30gYXclH1JbXdo70O6MD6iK34xOKV3VN2s4AKm+sW7msVAYBQK0vSkMT yzeNOPqod3xbhzGPWqOOpVqw1sZ5mnARRUnZkw5W/dkdKlVs7tGV99JTIz/cnvgAQMpb mjGg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=BCak+5bL0bc2PXTFFFEg+FnORCbpmgqZxUJWBfO7Wmc=; b=lYixqZiXgduPgcLlA0wpSPUIa0VofBMmpv2yuhiDYMwJM2XB5gBl5s5dPUMrwu1CzY eTvubg8Tf2BtH2WVf8vtaIgROEDNNx1Dy9koSMQVInN1mzNw1E6TjrExYtfrUZgs2w/Y NW1NxBKU/AXRScCi7ct9oSnGOhNnT6H1OZ++kx4Rjs34Hbw62J9lZnGtBDfWXACHkwTh MfdwbAIukyYq2LZmWhOjhBMA5IgzM35ej/nt0hvHeTBzXLCKimqz8kkoB74bANCRkGNd tw7gRm2d8V52oLVl7x5IRY+bI/ju7lKTNQgzXln5NN20dwC55ZYcxk1jZOY5o+30Dd6D 0QHQ== X-Gm-Message-State: AOAM531IfhG4JQLSUnANnf0mBAZdIh38DNqEUR+I/Kob+0v2wRN4twXj +T4Uq321ky1gktsLOf+UpjToYKFjGbgcUA== X-Google-Smtp-Source: ABdhPJw7pbsS21/Rz4gRESB5wAbTsYnJGGixw9vbf3aG4GR11JBlK6lx0kxcF+x1aEJD+/B/hVNdBw== X-Received: by 2002:a05:6214:4b2:: with SMTP id w18mr3365129qvz.5.1614357204974; Fri, 26 Feb 2021 08:33:24 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:cd1c:d722:e26f:4e76:c5c1]) by smtp.gmail.com with ESMTPSA id t33sm731116qtd.13.2021.02.26.08.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:24 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 4/5] spapr_pci.c: add 'unplug already in progress' message for PCI unplug Date: Fri, 26 Feb 2021 13:33:00 -0300 Message-Id: <20210226163301.419727-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226163301.419727-1-danielhb413@gmail.com> References: <20210226163301.419727-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hotunplug for all other devices are warning the user when the hotunplug is already in progress. Do the same for PCI devices in spapr_pci_unplug_request(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- hw/ppc/spapr_pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index b00e9609ae..feba18cb12 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1743,6 +1743,10 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler, } } } + } else { + error_setg(errp, + "PCI device unplug already in progress for device %s", + drc->dev->id); } } From patchwork Fri Feb 26 16:33:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1445023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rk21n75K; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DnG796rXyz9rx8 for ; Sat, 27 Feb 2021 03:57:57 +1100 (AEDT) Received: from localhost ([::1]:60668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFgR9-0001Zf-TP for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2021 11:57:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFg3Z-0004tN-8n; Fri, 26 Feb 2021 11:33:33 -0500 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]:37280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFg3V-0007kW-L6; Fri, 26 Feb 2021 11:33:33 -0500 Received: by mail-qv1-xf2a.google.com with SMTP id n4so2430513qvl.4; Fri, 26 Feb 2021 08:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sCLg0b1bGvQZdp5H68kCD1UXScNDhrufoE3t3af+d9k=; b=rk21n75KbULAxpA5pqny2RqARBEdWr0pn7kKjsbfd8halR063jsm4J7f0obfmLXF90 w2Jp3mS7ZgF1ALWM+Re6uCSwxtGJIhCbQr2qomsiFM4h4H//i1Lz3hrAWf1x9WlaXklL 3+g2Fm72JUhb/h2VjSwDWd62cngtzuR9f9pqpPCnGoOXBpCAeZT1VDVCNavqYiz5Jbq+ +IWACRADWEgZ8aRfrwELD1P651BvezYSSnrwiwoonZwCDQKi2xewhT1h0djOFWokVg32 hRayjkc2Cdk81/lXOaKu9hAvbFZAz719+MMgVbMuL9Yj41uInraVS7Y+w3LloxBWAVnH wwZg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=sCLg0b1bGvQZdp5H68kCD1UXScNDhrufoE3t3af+d9k=; b=XgXotNawiSCYR1n+Iydbyxj/5F+kNDKIinFWVCPmyFNfkVWOcNvX/4sOlL2viM39kp 9b6McYhOArB+acMbmNHSvf4uYkqtSG8j0coiTeFPpmAvw4KfgJK9BKpj0+JTqCuscdyg Sxd0o3YLMlDNtu+43WTjVPjiPZU5zrZfXi7D15ZqV1JQlvnWOtyGrVBZeT+tZH/jFJ8z LWblQbWPqvqya9kyyaH3usHpRZw8ufqTyqsgaSWCcz7uHXez1Tgpiy2yIquhwm5lZ9Pw XQ+Ggcbt82VetmvkU9Xl96gwYGPPlwiYg5MT+gLqx3iI5hfgHXJB0SxLMFawg+13yayI nPPA== X-Gm-Message-State: AOAM5338sTdUlTgedHvJENTKnvejBqMCp7Vt81iioJxgHVQktJddVW6n qs5KuKxHnxfoL+IuhqMRY+QNRpKIdfJbIA== X-Google-Smtp-Source: ABdhPJyZ9rTOVOQH+/IPGi+EFlJeQqzU/CSXEZg1+JAsew99XslVzIbRk/hjynVhTAx/JyDcFW+uMQ== X-Received: by 2002:a05:6214:2464:: with SMTP id im4mr3165691qvb.61.1614357207175; Fri, 26 Feb 2021 08:33:27 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:cd1c:d722:e26f:4e76:c5c1]) by smtp.gmail.com with ESMTPSA id t33sm731116qtd.13.2021.02.26.08.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 08:33:26 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 5/5] spapr.c: send QAPI event when memory hotunplug fails Date: Fri, 26 Feb 2021 13:33:01 -0300 Message-Id: <20210226163301.419727-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226163301.419727-1-danielhb413@gmail.com> References: <20210226163301.419727-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=danielhb413@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Recent changes allowed the pSeries machine to rollback the hotunplug process for the DIMM when the guest kernel signals, via a reconfiguration of the DR connector, that it's not going to release the LMBs. Let's also warn QAPI listerners about it. One place to do it would be right after the unplug state is cleaned up, spapr_clear_pending_dimm_unplug_state(). This would mean that the function is now doing more than cleaning up the pending dimm state though. This patch does the following changes in spapr.c: - send a QAPI event to inform that we experienced a failure in the hotunplug of the DIMM; - rename spapr_clear_pending_dimm_unplug_state() to spapr_memory_unplug_rollback(). This is a better fit for what the function is now doing, and it makes callers care more about what the function goal is and less about spapr.c internals such as clearing the pending dimm unplug state. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 13 +++++++++++-- hw/ppc/spapr_drc.c | 5 ++--- include/hw/ppc/spapr.h | 3 +-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6ef72ee7bd..cbe5cafb14 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -28,6 +28,7 @@ #include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" +#include "qapi/qapi-events-machine.h" #include "qapi/visitor.h" #include "sysemu/sysemu.h" #include "sysemu/hostmem.h" @@ -3575,14 +3576,14 @@ static SpaprDimmState *spapr_recover_pending_dimm_state(SpaprMachineState *ms, return spapr_pending_dimm_unplugs_add(ms, avail_lmbs, dimm); } -void spapr_clear_pending_dimm_unplug_state(SpaprMachineState *spapr, - DeviceState *dev) +void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev) { SpaprDimmState *ds; PCDIMMDevice *dimm; SpaprDrc *drc; uint32_t nr_lmbs; uint64_t size, addr_start, addr; + g_autofree char *qapi_error = NULL; int i; if (!dev) { @@ -3616,6 +3617,14 @@ void spapr_clear_pending_dimm_unplug_state(SpaprMachineState *spapr, drc->unplug_requested = false; addr += SPAPR_MEMORY_BLOCK_SIZE; } + + /* + * Tell QAPI that something happened and the memory + * hotunplug wasn't successful. + */ + qapi_error = g_strdup_printf("Memory hotunplug failed for device %s", + dev->id); + qapi_event_send_mem_unplug_error(dev->id, qapi_error); } /* Callback to be called during DRC release. */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 8c4997d795..8faaf9f1dd 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -1232,12 +1232,11 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu, /* * This indicates that the kernel is reconfiguring a LMB due to - * a failed hotunplug. Clear the pending unplug state for the whole - * DIMM. + * a failed hotunplug. Rollback the DIMM unplug process. */ if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB && drc->unplug_requested) { - spapr_clear_pending_dimm_unplug_state(spapr, drc->dev); + spapr_memory_unplug_rollback(spapr, drc->dev); } if (!drc->fdt) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index d6edeaaaff..47cebaf3ac 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -847,8 +847,7 @@ int spapr_hpt_shift_for_ramsize(uint64_t ramsize); int spapr_reallocate_hpt(SpaprMachineState *spapr, int shift, Error **errp); void spapr_clear_pending_events(SpaprMachineState *spapr); void spapr_clear_pending_hotplug_events(SpaprMachineState *spapr); -void spapr_clear_pending_dimm_unplug_state(SpaprMachineState *spapr, - DeviceState *dev); +void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev); int spapr_max_server_number(SpaprMachineState *spapr); void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte0, uint64_t pte1);