Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp641541ybl; Fri, 30 Aug 2019 05:09:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEO9tcs/7Rkspeml8YG2XtYOaPtMDcVSfnT/eyepy2lXYffuR/IUBg1NcwwTvNL7UaR8i5 X-Received: by 2002:a65:6454:: with SMTP id s20mr12719421pgv.15.1567166942937; Fri, 30 Aug 2019 05:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567166942; cv=none; d=google.com; s=arc-20160816; b=E/c8LIMJHY4v7Pu9TuguNz5oQS7LMAHaFZKF/867uo4bgAgMw21dWur0kLzR0SvDoQ eU21Zw2uB6/b0dMlC5pmfAKENDM8eMuE118zRzgzZFAAosIrOf6QYvJtfOlm6kL6k6nt 2dvriKPu5mm5oMLl0Y+IKXmqcQuwjOMzHoTTYnYwe4pCXtnlqP1v34vWnw9le+GoKZBd f1nuQMCX95hhentdsEBlTesyA6VqyTRimZUNJTBKsFJNFxtCZjup/Kp+JTN/PbSDmyS4 sczIz8bOfaXHAcvzXCHaGiSXmYBuvFiufhXyEC2uBVbjMhFeED3pt0V6WAHYpb8x7d9d Yczg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=jBvQcAjho239ZELxyObIfG/KfdAbw0lUe/eAKP86e0s=; b=KVVYAayNeSMYKD/j8gPQxKswALnuvb8gsKc2t+nP2Rk62quiD7SWiKEhuJ4mJE/x1A QUscWFP84MB7J6vdAXwB7MCTwmdgkhisvY+oHiP3uf7W9fTq2tDhHEMyQvR3o8V7qLc5 LJ9mtLSZtp6JI8lDcDaWz6QRELaV6uRi7DxA40j88eWjuW5prpLcG519S3+yKeLh1866 JB8Mji8KbbcJRHol2Q/Bfaj9auH8gLkgMfqUTItzfKSiIN7D/wNH4x9/9ihx23tJ261r uBhoWaW6gWTKX+R13rsXsO9L8sBfQV7N7A/wf4zO28rX1s1SMm7Pch8Ip4x3roSzvgKw D1vg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8si4335603pgi.347.2019.08.30.05.08.46; Fri, 30 Aug 2019 05:09:02 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728232AbfH3MH1 (ORCPT + 99 others); Fri, 30 Aug 2019 08:07:27 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32208 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728213AbfH3MHZ (ORCPT ); Fri, 30 Aug 2019 08:07:25 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7UC3UY5042561 for ; Fri, 30 Aug 2019 08:07:24 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2uq364gymq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 30 Aug 2019 08:07:24 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 30 Aug 2019 13:07:22 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 30 Aug 2019 13:07:18 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7UC7HdQ40763796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Aug 2019 12:07:17 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2547A42047; Fri, 30 Aug 2019 12:07:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63DF442042; Fri, 30 Aug 2019 12:07:16 +0000 (GMT) Received: from pomme.com (unknown [9.145.17.35]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 30 Aug 2019 12:07:16 +0000 (GMT) From: Laurent Dufour To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, aneesh.kumar@linux.ibm.com, npiggin@gmail.com Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] powerpc/mm: call H_BLOCK_REMOVE when supported Date: Fri, 30 Aug 2019 14:07:12 +0200 X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190830120712.22971-1-ldufour@linux.ibm.com> References: <20190830120712.22971-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19083012-0028-0000-0000-00000395A0EE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19083012-0029-0000-0000-00002457E4A7 Message-Id: <20190830120712.22971-4-ldufour@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-30_05:,, 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=992 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908300132 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of calling H_BLOCK_REMOVE all the time when the feature is exhibited, call this hcall only when the couple base page size, page size is supported as reported by the TLB Invalidate Characteristics. For regular pages and hugetlb, the assumption is made that the page size is equal to the base page size. For THP the page size is assumed to be 16M. Signed-off-by: Laurent Dufour --- arch/powerpc/platforms/pseries/lpar.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 375e19b3cf53..ef3dbf108a65 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -1143,7 +1143,11 @@ static inline void __pSeries_lpar_hugepage_invalidate(unsigned long *slot, if (lock_tlbie) spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags); - if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) + /* + * Assuming THP size is 16M, and we only support 8 bytes size buffer + * for the momment. + */ + if (mmu_psize_defs[psize].hblk[MMU_PAGE_16M] == 8) hugepage_block_invalidate(slot, vpn, count, psize, ssize); else hugepage_bulk_invalidate(slot, vpn, count, psize, ssize); @@ -1437,7 +1441,10 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local) if (lock_tlbie) spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags); - if (firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) { + /* + * Currently, we only support 8 bytes size buffer in do_block_remove(). + */ + if (mmu_psize_defs[batch->psize].hblk[batch->psize] == 8) { do_block_remove(number, batch, param); goto out; } -- 2.23.0