From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA14EC11F6F for ; Tue, 6 Jul 2021 12:03:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7193620E9 for ; Tue, 6 Jul 2021 12:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240717AbhGFMGO (ORCPT ); Tue, 6 Jul 2021 08:06:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29784 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237488AbhGFL6A (ORCPT ); Tue, 6 Jul 2021 07:58:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625572521; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ekaSBwRSsDtmUBzMzvteWh+vl9RVfK9dJAN2VWd9G3M=; b=Ze/bpwBcr10LHD8okdaKe99FOYHFrcoVKTP3ogZKT+jMUf5peiBcloldftZc13PVgzTKG4 qTmpa++mbAM1MoUP3tNOiFwFSm1JcZw9z6mICz0NDg6ZOKPFeYc0vEZm5DYbQwsFIV+mLl 7fbiNuYo5pEwBWgQ6r/tuzUeGU+pXak= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-4gjt3dI1OiuREohet-er2Q-1; Tue, 06 Jul 2021 07:55:20 -0400 X-MC-Unique: 4gjt3dI1OiuREohet-er2Q-1 Received: by mail-wm1-f72.google.com with SMTP id z4-20020a1ce2040000b02901ee8d8e151eso1006783wmg.1 for ; Tue, 06 Jul 2021 04:55:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ekaSBwRSsDtmUBzMzvteWh+vl9RVfK9dJAN2VWd9G3M=; b=lLNf04LWMNpV4hKpV+oTjsh0LtGsfFzyR0FY8X0WyLyAbdy2ZPf+YWxhuWN55OkzWb ZrFB72uR18s/GerOiVQFlF/px1x1IDfZyolREyKgQ1mn3KgHQKN4sCAHQtd9PeZPOnnc ECrB69VWLzVGC5RUhhch2C6Yery9InWwHu1oihPBtz2Mi2hy7KZXsH9e5ylHWGuNP9Yj z6EKa5rlzfLwyx/NumLvt6Bbadqas3YV5XySXwcaBejs5eCXw/KJt8TgnmbzoGPUDCZd Hk/AbLJj5lV+jcwQZdVjYQwWwy6YbSruIDP/kiqkJW7SMm/zBfD+uYAJqypT1k0TluoT uW1Q== X-Gm-Message-State: AOAM533SKabTfCsojdYME8ERzZ0eXafnpfdlBkPgY92Vi12HF3N5D+64 INWuhJNAzZUG+mGdC/ogxpxgFldCofIp1Xmqd5hV9NMFd84oJ0bS3OjrtD87Px8Pft6dQgdcTne xDgzxFwgCgwQ/mtSJWLwbhA== X-Received: by 2002:a1c:7510:: with SMTP id o16mr190040wmc.137.1625572518784; Tue, 06 Jul 2021 04:55:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGQpsRZ++S+YiSMEDriBlOwEF/OUEzifhLn67uvRKBjHvT1wB1/7FMOZUybC5IurPe6tt8kg== X-Received: by 2002:a1c:7510:: with SMTP id o16mr190029wmc.137.1625572518636; Tue, 06 Jul 2021 04:55:18 -0700 (PDT) Received: from ?IPv6:2003:d8:2f0a:7f00:fad7:3bc9:69d:31f? (p200300d82f0a7f00fad73bc9069d031f.dip0.t-ipconnect.de. [2003:d8:2f0a:7f00:fad7:3bc9:69d:31f]) by smtp.gmail.com with ESMTPSA id i12sm1689249wrp.57.2021.07.06.04.55.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 04:55:18 -0700 (PDT) Subject: Re: [PATCH] KVM: s390: Enable specification exception interpretation To: Janis Schoetterl-Glausch , Christian Borntraeger , Janosch Frank , Heiko Carstens , Vasily Gorbik Cc: Cornelia Huck , Claudio Imbrenda , "open list:KERNEL VIRTUAL MACHINE for s390 (KVM/s390)" , "open list:S390" , open list References: <20210706114714.3936825-1-scgl@linux.ibm.com> From: David Hildenbrand Organization: Red Hat Message-ID: <967b92c6-e7ab-2a58-57e6-2945b7ceb94e@redhat.com> Date: Tue, 6 Jul 2021 13:55:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210706114714.3936825-1-scgl@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On 06.07.21 13:47, Janis Schoetterl-Glausch wrote: > When this feature is enabled the hardware is free to interpret > specification exceptions generated by the guest, instead of causing > program interruption interceptions. > > This benefits (test) programs that generate a lot of specification > exceptions (roughly 4x increase in exceptions/sec). > > Interceptions will occur as before if ICTL_PINT is set, > i.e. if guest debug is enabled. > > Signed-off-by: Janis Schoetterl-Glausch > --- > I'll additionally send kvm-unit-tests for testing this feature. > > arch/s390/include/asm/kvm_host.h | 1 + > arch/s390/kvm/kvm-s390.c | 2 ++ > arch/s390/kvm/vsie.c | 2 ++ > 3 files changed, 5 insertions(+) > > diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h > index 9b4473f76e56..3a5b5084cdbe 100644 > --- a/arch/s390/include/asm/kvm_host.h > +++ b/arch/s390/include/asm/kvm_host.h > @@ -244,6 +244,7 @@ struct kvm_s390_sie_block { > __u8 fpf; /* 0x0060 */ > #define ECB_GS 0x40 > #define ECB_TE 0x10 > +#define ECB_SPECI 0x08 > #define ECB_SRSI 0x04 > #define ECB_HOSTPROTINT 0x02 > __u8 ecb; /* 0x0061 */ > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index b655a7d82bf0..aadd589a3755 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -3200,6 +3200,8 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu) > vcpu->arch.sie_block->ecb |= ECB_SRSI; > if (test_kvm_facility(vcpu->kvm, 73)) > vcpu->arch.sie_block->ecb |= ECB_TE; > + if (!kvm_is_ucontrol(vcpu->kvm)) > + vcpu->arch.sie_block->ecb |= ECB_SPECI; > > if (test_kvm_facility(vcpu->kvm, 8) && vcpu->kvm->arch.use_pfmfi) > vcpu->arch.sie_block->ecb2 |= ECB2_PFMFI; > diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c > index 4002a24bc43a..acda4b6fc851 100644 > --- a/arch/s390/kvm/vsie.c > +++ b/arch/s390/kvm/vsie.c > @@ -510,6 +510,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) > prefix_unmapped(vsie_page); > scb_s->ecb |= ECB_TE; > } > + /* specification exception interpretation */ > + scb_s->ecb |= scb_o->ecb & ECB_SPECI; > /* branch prediction */ > if (test_kvm_facility(vcpu->kvm, 82)) > scb_s->fpf |= scb_o->fpf & FPF_BPBC; > I assume this is a new CPU feature, right? If so a) How can we check whether we can actually safely enable it. (which facility do we have to check) b) Do we have to handle vSIE? Do we have to indicate a CPU feature that unlocks this feature? -- Thanks, David / dhildenb