Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3287191rdg; Tue, 17 Oct 2023 09:49:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIsRV2PaUdrkrvSn2BiNoHV/UpEfCfsBlYHXX2J9gUX0ex5zWDdbB1F8H49ZmNnrK0oLGr X-Received: by 2002:a17:90b:1b4b:b0:27d:420:7b34 with SMTP id nv11-20020a17090b1b4b00b0027d04207b34mr2785872pjb.37.1697561392298; Tue, 17 Oct 2023 09:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697561392; cv=none; d=google.com; s=arc-20160816; b=Z2uwjhmYbuc+/CTjvSp6x3GnOEMzc5MnJPm3qYljd6YeILn1ERSpS80UF4pzyT2i33 HmM7LEbXv9UN3BL8M6XZibU4vgAWo2AprorjrAnsApXkSfgOGiagW3Upyl7mM22uodKs /DA1DE9hiYJioqwc2ajon0w7qaSkM/m3cO3/IIllJvsDjkMKpqw8FhPg9c7ELUTXyuhu 432HE64XbTLNTajkCB5Uqr+BM3QQlTi8ht+CyA6i9wMSpf0DK5+DshbP0dZ1YHnzTMNS KB/SghvF13OlFMY4tqpY9wpkEhKr+bO0o3FvDhRnFc5AVbeN8Uj813lYPVTAVQQkKDe/ jhrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lbOnMkAmys4ATC1jemLgDhyPYnDB7jZJzNIoSnmf3pM=; fh=Ydzx9+q2LPKW+62Dx8Wwj8Mofu196V11LHOTZ5Nf2xk=; b=byt0HWCql3Euhput56ok9udpoBr/9WjoyyDEAb0995yKIOtcl28hWM+o+iyx45oURE PjizbxK6tNfy7K4ZMJXAdrs8Gf2IJ+2JPsAAjvk8xKgWitn9rl1qoOTTbTfKCl0nEQo4 XyYhhnHr6+xi5agheGz78i+Dnhul1eiwba9KE7jd12Ha8IRL9d+02Lm5XVy9fVOVtv+8 DR0GpcNQKY3Oo0zkNaKQE0UdZK9/wuj3NFxXxMZ7Ed4RxntdLrrRCtoCJSfJgEg6lltr rEtClzo2DOjnF7a43b5bQLkl3dbc6scpgSE17/MWlp/uZ14SZD+uMeoCe2JqJ3VFTYlY 0oIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0MlnR9pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id nn3-20020a17090b38c300b0027d2db562d2si2180913pjb.161.2023.10.17.09.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 09:49:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0MlnR9pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3F44480BA7C3; Tue, 17 Oct 2023 09:49:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbjJQQt0 (ORCPT + 99 others); Tue, 17 Oct 2023 12:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbjJQQtW (ORCPT ); Tue, 17 Oct 2023 12:49:22 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF681F0 for ; Tue, 17 Oct 2023 09:49:20 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c9d4f08d7cso4585ad.0 for ; Tue, 17 Oct 2023 09:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697561360; x=1698166160; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lbOnMkAmys4ATC1jemLgDhyPYnDB7jZJzNIoSnmf3pM=; b=0MlnR9pSqpGABMZCepnMMmTm1gy7ENMSm68zmr4+HVzNdosZ4NR14K7cWf+J1Ep7eH x1qLn6urc5oEimxUWg6bFtaIsqJ2oDaRp8u1DlSpI53grKVcfCz047VYox3nKZcrFt/d TrYe3qQPV9TrxoaNbMdrWOHPqL7tjZ0ct4dL+zmK9vrBdi7w/rJs/eM90BixrkwMXv1F PN09J1OgrU9pek3UX/oWTSHn4xyCEW8r55hKBhZizPsuo1PeE11d2AHy1B1apLfZXDOp dwStLSMcP40AHM0PhL89ywTO3AbjfHb9dfGqcj5KBn273ZxV4fT5Fi33KlsMitceQOxa 4nbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697561360; x=1698166160; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lbOnMkAmys4ATC1jemLgDhyPYnDB7jZJzNIoSnmf3pM=; b=qautHPFMjgZq5WKnUDiA1eZFN75bhegcOMlSulH6OALB96PRlvCesG4RJT9VOL8HFM pOpK/wajnA9tfXRaC1X2fVcJdRv5suZwK4E0GQzSkRVw7ScBKYmZVPT71jQog1Mtk7nP bdKqi1zARYN/10yeuDijlqkKuhD9vh2wIYcUrxOvkYRtt2QVUG2zO9qAAAHed1wB0yPH GTsoSCIvgi6u6eF1oPaincRsbSPVXMeIB2Q9HlySMU82mLBWjWVKzMH54jTBnpjTYX8J VaTSAYpydKdBNzqKFwTRfR0pw1WnVsFdWacwhShhdS0hGy4yMHu1avszY0rlIslDry22 y0eg== X-Gm-Message-State: AOJu0YwEaxqV1CYxCAT8GjTyvqN488iUg6jSIkEMJazoBknbaMBQzwxy 1IpNPgRhYrmSiZ7B0/pvxEFo9RO1PsKPHE5/2hKxBA== X-Received: by 2002:a17:903:290:b0:1ca:16b8:b541 with SMTP id j16-20020a170903029000b001ca16b8b541mr2851plr.24.1697561359975; Tue, 17 Oct 2023 09:49:19 -0700 (PDT) MIME-Version: 1.0 References: <20231009230858.3444834-1-rananta@google.com> <20231009230858.3444834-9-rananta@google.com> <5d35c9f3-455e-6aa9-fd6a-4433cf70803a@redhat.com> In-Reply-To: <5d35c9f3-455e-6aa9-fd6a-4433cf70803a@redhat.com> From: Raghavendra Rao Ananta Date: Tue, 17 Oct 2023 09:49:07 -0700 Message-ID: Subject: Re: [PATCH v7 08/12] KVM: arm64: PMU: Allow userspace to limit PMCR_EL0.N for the guest To: Sebastian Ott Cc: Oliver Upton , Marc Zyngier , Alexandru Elisei , James Morse , Suzuki K Poulose , Paolo Bonzini , Zenghui Yu , Shaoqin Huang , Jing Zhang , Reiji Watanabe , Colton Lewis , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 17 Oct 2023 09:49:47 -0700 (PDT) On Tue, Oct 17, 2023 at 8:52=E2=80=AFAM Sebastian Ott w= rote: > > On Mon, 9 Oct 2023, Raghavendra Rao Ananta wrote: > > +static int set_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *= r, > > + u64 val) > > +{ > > + struct kvm *kvm =3D vcpu->kvm; > > + u64 new_n, mutable_mask; > > + > > + mutex_lock(&kvm->arch.config_lock); > > + > > + /* > > + * Make PMCR immutable once the VM has started running, but do > > + * not return an error (-EBUSY) to meet the existing expectations= . > > + */ > > Why should we mention which error we're _not_ returning? > Oh, it's not to break the existing userspace expectations. Before this series, any 'write' from userspace was possible. Returning -EBUSY all of a sudden might tamper with this expectation. Thank you. Raghavendra > > > + if (kvm_vm_has_ran_once(vcpu->kvm)) { > > + mutex_unlock(&kvm->arch.config_lock); > > + return 0; > > + } >