Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11816273pjo; Thu, 2 Jan 2020 14:47:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwU0PfYnlJWBbqxlAgTMTOrKP8lFT5KKBEOwLk6qApzFDUybH9ipKrDmbs6dc3BLImtnapO X-Received: by 2002:aca:5793:: with SMTP id l141mr2940228oib.38.1578005240963; Thu, 02 Jan 2020 14:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005240; cv=none; d=google.com; s=arc-20160816; b=fkAHRBqgIetr2MQABFXmUxhon7j2RG6VDXfgkIOeLgz+txBG6PNYN27uF1ul7C57VZ kfhr6r/2IH3tpO5x3rOoBGvrOEbd+JfsD9n1gNwGyV0AGVHHE5UBxP2VjFxdMsgaWj56 jAgXeSCL45LOS1ntZ6gRmkpYQwUcCf9BSSjreS+XEYEeNttr26wFz9D6AE/dvU9T61rV RfvjsDiEcVEqLSMIptbxQmlMcukaonZuK695Pi4X+kB4y877ySmFQIm4ks2DydvFJJRd WJU2kMK1B5flM1Jc4TOrlANZOfjsMHgHqBLcx8WpOzmG54VlvSY1ECTyHIriMpLGazDy S27Q== 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=dxekTBlNKkt3qUcvx3iv2Jxev5GEz05fQfRKpdZjJ8M=; b=m0lPTBW+G+vVfrdxqV0w/kuFJWvNCxtiUXka625GluUXenlBK7QE2BAFEEIK90DRqE mnXwD87nPDDNz42Cbso0EmAAKAS4o5wvujwPQZ4xJ39zjiUVyZVOW6mGmzUSpnD3fk3C stWp/n7icDjX6cOSG4m+D6/5RBC6OhhzPUCXE8iWqBcx9tTHKfr5lnK9ENP3tbtd8zgG qzzZMvByMi0yCokAwET9tZs2hzM2JmEOnBmki02deloqnCBqWTt3Puj/pptUxzLNfbej R0vUjJDttPv7SQz/7+u3hX6PF/iQSSgLWsXCk4rKFkdkZ9HIWPj9VwdtUPB18woxvR17 aArg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YuaTbVsj; 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 17si12557235oix.22.2020.01.02.14.47.09; Thu, 02 Jan 2020 14:47:20 -0800 (PST) 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=YuaTbVsj; 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 S1730313AbgABWbl (ORCPT + 99 others); Thu, 2 Jan 2020 17:31:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:36968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730301AbgABWbh (ORCPT ); Thu, 2 Jan 2020 17:31:37 -0500 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 67E7C22525; Thu, 2 Jan 2020 22:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004296; bh=6sjVKtc0kCiTiKhyKbAVxJ2gWded0kH98fqjv3yB+zQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YuaTbVsjXX9lQPq5RDEV9KeYacHOCmTVAeGiOOF2xWrAdmx1LvW6Y7OJ/9Gh48euS bzclT4bExozu7aMsTuKjOkgEj1+W18MEmGbvqCDgHJQAyTbfxiwWhrM9RX9khf4hza sxivDzuIry8Nm3AU2eQaKwGOt8EbUG9GoxioRQz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Aneesh Kumar K.V" , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 119/171] powerpc/pseries: Dont fail hash page table insert for bolted mapping Date: Thu, 2 Jan 2020 23:07:30 +0100 Message-Id: <20200102220603.584558473@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@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 From: Aneesh Kumar K.V [ Upstream commit 75838a3290cd4ebbd1f567f310ba04b6ef017ce4 ] If the hypervisor returned H_PTEG_FULL for H_ENTER hcall, retry a hash page table insert by removing a random entry from the group. After some runtime, it is very well possible to find all the 8 hash page table entry slot in the hpte group used for mapping. Don't fail a bolted entry insert in that case. With Storage class memory a user can find this error easily since a namespace enable/disable is equivalent to memory add/remove. This results in failures as reported below: $ ndctl create-namespace -r region1 -t pmem -m devdax -a 65536 -s 100M libndctl: ndctl_dax_enable: dax1.3: failed to enable Error: namespace1.2: failed to enable failed to create namespace: No such device or address In kernel log we find the details as below: Unable to create mapping for hot added memory 0xc000042006000000..0xc00004200d000000: -1 dax_pmem: probe of dax1.3 failed with error -14 This indicates that we failed to create a bolted hash table entry for direct-map address backing the namespace. We also observe failures such that not all namespaces will be enabled with ndctl enable-namespace all command. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20191024093542.29777-2-aneesh.kumar@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/mm/hash_utils_64.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index bd666287c5ed..de1d8cdd2991 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -289,7 +289,14 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, HPTE_V_BOLTED, psize, psize, ssize); - + if (ret == -1) { + /* Try to remove a non bolted entry */ + ret = mmu_hash_ops.hpte_remove(hpteg); + if (ret != -1) + ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, + HPTE_V_BOLTED, psize, psize, + ssize); + } if (ret < 0) break; -- 2.20.1