Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17925523ybl; Thu, 2 Jan 2020 14:57:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxRvWlej8bBZe0I2hkOMptgQtLH3kyLpLPdUi/3vG544/KX0yTB0dvu3Gkvves/SWwKW3RR X-Received: by 2002:a9d:6516:: with SMTP id i22mr76803913otl.94.1578005821020; Thu, 02 Jan 2020 14:57:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005821; cv=none; d=google.com; s=arc-20160816; b=NaxOW+P5vLi+zY8fR8rIG5H8jDTPpopQzEP7zxV0Eavbgj6sBfdcEM09JtLbpGe7Dl ldZ+dl8ozaqpZyHZOQSj4UU+RVJlPj+eVCNQVqLj5AAvNDrJ8OHNmO0UKZ69v50zsk0T 4p2g4OgRJJaujTV1gHyRSPvre3z+oTj6ocZ1JlM8hn81wb0/bIPEzU+v7r7ETlisAQU4 9PhN+DXdZhtGorhc17/Sit+VywDmr+8A9b2S6D/CQzDUhrEPgkr6LM3iGLyMm+U4H1VQ yFnsLtvDvke9yccwh2lmlmYqpgGBKBpBTCpwzJZgDylNjvl37C1lDglMNsdF4bOFBqh4 KJ+w== 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=KsfDdA8GC8ONxZ8urNn8aVZd2BMzf4eGiBygCUBpzCc=; b=sQMQVi+Yoz5IBdoTl3gQSojzpJkGbOxhwOeHeIWa3DjDyT73dj681eTVqOLtLcZLnN PjcXqzVSLR//hjMUgTsdG8KaO+OZNuvnF/09JrouwXXXxeVPj/7HKP0c8L3vwNNP3ZF/ PRzVEx3W5W/I0CKS/ZhNjMGPZlKyAQNDmrD2B7LMuvcz/sDOWlWXs/Ju240HNIqb9aNd rZlmHrNBVtGUGKiYUYm/BunWvPiM1zBC5lCJObqAe9k2OHWzxgmPpwq4GO2Pm3hj7WN7 TXYVYJnoTULKMhdqyEF9UNi415RPwlZJgeNTqAvzcC7XPjXllOOyY8Tcmh+LyiAqB28n vUmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RhC2Txdw; 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 q2si26773700otn.220.2020.01.02.14.56.49; Thu, 02 Jan 2020 14:57:01 -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=RhC2Txdw; 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 S1728195AbgABWTH (ORCPT + 99 others); Thu, 2 Jan 2020 17:19:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:34942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbgABWTG (ORCPT ); Thu, 2 Jan 2020 17:19:06 -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 5E38221582; Thu, 2 Jan 2020 22:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003545; bh=dyDUn9B9Bca4O9azJBCRLDGWzqsKF0eIBKTh0se1o2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhC2TxdwUpeNPunYZTTOP8hoOBq7CkPMKNGKZXy1G1HBNlXWBs4H7a2SsSHi5g5sd 5GqPIuplqPK0XuostYyNHODuaTrdKeYJ9Ep5J7qdmPpzj8TH0yu2j8dx4evb+tVOX9 gef2Vkv5yCws8KIorfnJMZgP1H1pdZBxI/9Dka20= 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.19 014/114] powerpc/pseries: Dont fail hash page table insert for bolted mapping Date: Thu, 2 Jan 2020 23:06:26 +0100 Message-Id: <20200102220030.553775859@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@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 b1007e9a31ba..11b41383e167 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -296,7 +296,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