Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2075793rda; Tue, 24 Oct 2023 11:29:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1L/XZFHdI2yVI82XQyM/6sEd7EDGv/6pBbyiwuEAHyPxLikx0ocy1+K1gxPYV6VBT3Azv X-Received: by 2002:a17:903:290c:b0:1c3:3b5c:1fbf with SMTP id lh12-20020a170903290c00b001c33b5c1fbfmr12180336plb.10.1698172178728; Tue, 24 Oct 2023 11:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698172178; cv=none; d=google.com; s=arc-20160816; b=oQObjY6amgRCRGEf5NhrvcDYax0k2t+d5LLU4dbuOfr0jG5oIWKPpmIf4tGM0QgBGA tSdiZmGAna/0+MGRxCKcfF6yTbonQVjcIAx3VR5mG5UbPVDHasEFrA3pL8ftyCHrUVie NboZszEOCBVGKNPjlUJEdm6ejGJUMwc3dEViJyN1mlmtBjQ7kiJDIv+KJZDlQrbJHFEG MrBhxjBv5JEe5aOdcMvpC8nn0u277S8NNGQq/a3dFJjEdaH1raJr5zsRolhmb2Dd47+I wy0mzyiUz6DA9rrJKPmZ3VuRu4m4e4BtfYd1n4CoJaodZrR3fXWdgSrp3QJufZRrLOOp eJhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=RRSsi4LGt8MbQ4KLys+pDJGRcAZu1kNaXtLuROXhy8I=; fh=4I6BNv7iobpZrRcbueKA7r9RD02xPQmynyU/PeDFguM=; b=zgkZ3p5m6X0Ek9xSwA4hUMvKhvrV31rAt/pg9zQZY+m07eNQp2vPF7jZjiZQ3+n+qq u9E8jAHLur+J8t1SNQb1m30ukMK5B67k6RpmqiKdggARFpegrP8TmbwUWjoedukFX3cj norXt2pVnQwhNz7Si/pznXBQaWQhRdHkLbOTnRJrHQfFg335c1OJiNQbpDdPv77DMjpF JB+xg+4FwN02qurwMxeqH4pfaeltOosmGS2/UYKz11sCrqMlEabfHkWqHxU9PZFSYDEc ez4uJBWf2tk2jv1gokI80DbVBtRii1eHtKW6UKWKfjFBJ2CaAE+CHLarMxjCsTbeECFw YL5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=o2ccfekA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id i6-20020a170902eb4600b001c32d285db8si8364870pli.308.2023.10.24.11.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 11:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=o2ccfekA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E7BCB8029AEF; Tue, 24 Oct 2023 11:29:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344117AbjJXS3e (ORCPT + 99 others); Tue, 24 Oct 2023 14:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344111AbjJXS3c (ORCPT ); Tue, 24 Oct 2023 14:29:32 -0400 Received: from out-190.mta0.migadu.com (out-190.mta0.migadu.com [91.218.175.190]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E311A2 for ; Tue, 24 Oct 2023 11:29:30 -0700 (PDT) Date: Tue, 24 Oct 2023 18:29:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698172168; 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=RRSsi4LGt8MbQ4KLys+pDJGRcAZu1kNaXtLuROXhy8I=; b=o2ccfekA1HV281+lY8Y0GgD/IkzTQy9l7dRQ8lCqmeGVbXZztnbjZPYgWv0boTaT/0A0zU /qMVkE7LYziezD4yn/SxMSZSzRODCztlZNMqwe5H+fBmtZa30v4Mbk0X0wbaPufcOb1WUK 1WnpesWP8+SiqFIiCjXtUOqldYEa5pI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Raghavendra Rao Ananta Cc: 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 Subject: Re: [PATCH v8 11/13] KVM: selftests: aarch64: vPMU register test for unimplemented counters Message-ID: References: <20231020214053.2144305-1-rananta@google.com> <20231020214053.2144305-12-rananta@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231020214053.2144305-12-rananta@google.com> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 11:29:38 -0700 (PDT) On Fri, Oct 20, 2023 at 09:40:51PM +0000, Raghavendra Rao Ananta wrote: [...] > +#define INVALID_EC (-1ul) > +uint64_t expected_ec = INVALID_EC; > +uint64_t op_end_addr; > + > static void guest_sync_handler(struct ex_regs *regs) > { > uint64_t esr, ec; > > esr = read_sysreg(esr_el1); > ec = (esr >> ESR_EC_SHIFT) & ESR_EC_MASK; > - __GUEST_ASSERT(0, "PC: 0x%lx; ESR: 0x%lx; EC: 0x%lx", regs->pc, esr, ec); > + > + __GUEST_ASSERT(op_end_addr && (expected_ec == ec), > + "PC: 0x%lx; ESR: 0x%lx; EC: 0x%lx; EC expected: 0x%lx", > + regs->pc, esr, ec, expected_ec); > + > + /* Will go back to op_end_addr after the handler exits */ > + regs->pc = op_end_addr; This sort of game is exceedingly fragile, and actually causes the test to fail when I build it with clang. The test body is written in C, so you don't know if the label you've chosen as the return address is actually the next instruction after the sysreg access. A64 instructions are guaranteed to be 32 bit, so we can just increment PC by 4 here. -- Thanks, Oliver