Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5992157pxv; Thu, 29 Jul 2021 03:50:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN1vOdyjf1buXtLhawqvv33/4JUkw+WkvdMNdU47uao4L56p9Pmv3iKfKEd4EmNG8KPAh1 X-Received: by 2002:a5d:9808:: with SMTP id a8mr3649928iol.1.1627555857768; Thu, 29 Jul 2021 03:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627555857; cv=none; d=google.com; s=arc-20160816; b=uCFofWmYp4DxwnaCmiXMb07/P16FaBVC2ZnGNhYYagzjVNwl2fbIY7d+gZjzWLgq7W Bgcf9zTOkitU6VTcQRnDsza0hSsNdikkk//NDA4ClmSf+PvZyy2S0oAS6RhtnMx35V9c vbiKW3KpTlN8IpEU+KMusB1yua35U7RVc6iN6q80r8hQU293tP8O7AV8lmnUGaotDTDy u22f0RdD/kOvZRjS1OmxXJdWtnv9UsP115V9a55kUGTK4l04aHN7qhiGaIWTz/itzgsE 47NntNAb3FyKZ/cq2GVAlTRL8G74/j5PS3tfthQF7/kIuuNWLkB9A9crmTs7ZbylOMq4 3yCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:user-agent :references:organization:in-reply-to:subject:cc:to:from :dkim-signature; bh=nZ7sUAzPLCx+igL+qYK5oAUhkT7/9Lc+cUII6v850Ns=; b=RknkLRosPWTCKpyneAhyK2agh/0qlXhfKVO2QrlToE9s+gKBWYbazIgB0azqbd9dey 2q10UZXfalyekbioMI215dhZEHQssBSM03swLC1im4qcgEXmgWfEA/rWyJR4h54OWMu0 Ozgk2SSBZqpcqzyvuzdq23wAw5iQQB1YDLVw/nDVYNZ5IUYXKrL30yStRLwAwoZs9LZ6 p/X09KB4L1vUdUJQ9VJnnSq+Bsnj7Osqx+ZPtxYsONaDSIbl9+ABzMM6guhXNgvyQr8L 4Z6SNDcTVDHeRSqVOx9/uWoFtNDho6UVpSjWzcQTaASpSxlkI3YfgdRutSklkFEuV6kW WcBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OwfJhiOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si3078718jad.34.2021.07.29.03.50.46; Thu, 29 Jul 2021 03:50:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OwfJhiOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235722AbhG2Kta (ORCPT + 99 others); Thu, 29 Jul 2021 06:49:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31447 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbhG2KtP (ORCPT ); Thu, 29 Jul 2021 06:49:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627555751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nZ7sUAzPLCx+igL+qYK5oAUhkT7/9Lc+cUII6v850Ns=; b=OwfJhiOdEJe8cBGoJ4iGWSy3R16FpZlU/nB+dV+CFMHncD+OBHOrA/VMsDcbGWsEfhHMAA jqGtyWl0jfxm39uIt5l5u1IZ2xCfyoXZHPjzbtp+Cn7WhBWHYCQY2is3k5MRg8VRzcEoAt FAyA5Cdq7HxG3vdIzc0mHJfbZ1D5mnQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-469-O721HR48OhWO6uZVuyu9sA-1; Thu, 29 Jul 2021 06:49:10 -0400 X-MC-Unique: O721HR48OhWO6uZVuyu9sA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06BE018C8C01; Thu, 29 Jul 2021 10:49:09 +0000 (UTC) Received: from localhost (unknown [10.39.192.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 159391007606; Thu, 29 Jul 2021 10:49:04 +0000 (UTC) From: Cornelia Huck To: Claudio Imbrenda , kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, david@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 01/13] KVM: s390: pv: avoid stall notifications for some UVCs In-Reply-To: <20210728142631.41860-2-imbrenda@linux.ibm.com> Organization: Red Hat GmbH References: <20210728142631.41860-1-imbrenda@linux.ibm.com> <20210728142631.41860-2-imbrenda@linux.ibm.com> User-Agent: Notmuch/0.32.1 (https://notmuchmail.org) Date: Thu, 29 Jul 2021 12:49:03 +0200 Message-ID: <87h7gd2y5c.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28 2021, Claudio Imbrenda wrote: > Improve make_secure_pte to avoid stalls when the system is heavily > overcommitted. This was especially problematic in kvm_s390_pv_unpack, > because of the loop over all pages that needed unpacking. > > Also fix kvm_s390_pv_init_vm to avoid stalls when the system is heavily > overcommitted. > > Signed-off-by: Claudio Imbrenda > --- > arch/s390/kernel/uv.c | 11 ++++++++--- > arch/s390/kvm/pv.c | 2 +- > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c > index aeb0a15bcbb7..fd0faa51c1bb 100644 > --- a/arch/s390/kernel/uv.c > +++ b/arch/s390/kernel/uv.c > @@ -196,11 +196,16 @@ static int make_secure_pte(pte_t *ptep, unsigned long addr, > if (!page_ref_freeze(page, expected)) > return -EBUSY; > set_bit(PG_arch_1, &page->flags); > - rc = uv_call(0, (u64)uvcb); > + rc = __uv_call(0, (u64)uvcb); > page_ref_unfreeze(page, expected); > - /* Return -ENXIO if the page was not mapped, -EINVAL otherwise */ > - if (rc) > + /* > + * Return -ENXIO if the page was not mapped, -EINVAL for other errors. > + * If busy or partially completed, return -EAGAIN. > + */ > + if (rc == 1) > rc = uvcb->rc == 0x10a ? -ENXIO : -EINVAL; > + else if (rc > 1) > + rc = -EAGAIN; > return rc; > } Possibly dumb question: when does the call return > 1? gmap_make_secure() will do a wait_on_page_writeback() for -EAGAIN, is that always the right thing to do?