From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751212AbdFBHLN (ORCPT ); Fri, 2 Jun 2017 03:11:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38076 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbdFBHLL (ORCPT ); Fri, 2 Jun 2017 03:11:11 -0400 Subject: Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and 4k) To: David Hildenbrand , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Thomas Huth References: <20170529163202.13077-1-david@redhat.com> <20170529163202.13077-2-david@redhat.com> <2bc699c3-f3ba-e8b1-1149-92b31a0bcb22@redhat.com> From: Christian Borntraeger Date: Fri, 2 Jun 2017 09:11:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <2bc699c3-f3ba-e8b1-1149-92b31a0bcb22@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-IE Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17060207-0024-0000-0000-0000168EBDDF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007157; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00868950; UDB=6.00431943; IPR=6.00648914; BA=6.00005393; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015675; XFM=3.00000015; UTC=2017-06-02 07:11:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060207-0025-0000-0000-00004B306FD7 Message-Id: <22972b9a-3ce2-380d-c724-3a13c01a5279@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-02_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706020135 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2017 02:59 PM, David Hildenbrand wrote: > >> diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c >> index d4d409b..b22c2b6 100644 >> --- a/arch/s390/mm/pgtable.c >> +++ b/arch/s390/mm/pgtable.c >> @@ -196,7 +196,7 @@ static inline pgste_t ptep_xchg_start(struct mm_struct *mm, >> { >> pgste_t pgste = __pgste(0); >> >> - if (mm_has_pgste(mm)) { >> + if (pgtable_has_pgste(mm, __pa(ptep))) { >> pgste = pgste_get_lock(ptep); >> pgste = pgste_pte_notify(mm, addr, ptep, pgste); >> } >> @@ -207,7 +207,7 @@ static inline pte_t ptep_xchg_commit(struct mm_struct *mm, >> unsigned long addr, pte_t *ptep, >> pgste_t pgste, pte_t old, pte_t new) >> { >> - if (mm_has_pgste(mm)) { >> + if (pgtable_has_pgste(mm, __pa(ptep))) { >> if (pte_val(old) & _PAGE_INVALID) >> pgste_set_key(ptep, pgste, new, mm); >> if (pte_val(new) & _PAGE_INVALID) > > I think these two checks are wrong. We really have to test here the > mapcount bit only (relying on mm_has_pgste(mm) is wrong in case global > vm.allocate_pgste ist set). > > But before I continue working on this, I think it makes sense to clarify > if something like that would be acceptable at all. I think that is up to Martin to decide. Given the fact that Fedora, SUSE, Ubuntu always enable this sysctl when the qemu package is installed (other distros as well?) I think that we should really think about changing things. I see 2 options: 1. dropping 2k page tables completely pro: - simplifies pagetable code (e.g. look at page_table_alloc code) - we could get rid of a lock in the pgtable allocation path (mm->context.pgtable_lock) - I am not aware of any performance impact due to the 4k page tables - transparent for old QEMUs - KVM will work out of the box con: - higher page table memory usage for non-KVM processes 2. go with your approach pro: - lower page table memory usage for non-KVM processes - KVM will work out of the box - no addtl overhead for non-KVM processes con: - higher overhead for KVM processes during paging (since we are going to use IPTE or friends anyway, the question is: does it matter?) - needs QEMU change Christian