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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48713C00A8F for ; Tue, 24 Oct 2023 18:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ha6lZl8jKbvDFJX7BTaUDYtXUHrdxjd0sKoZdQ2IaNo=; b=wl8UIyzUgp2UqB /MV1CPo5Erensnvvkztjw3OKlPtP/x6fKAbGHcuc8+arJ0pCTe9KKWckSQ3sA8e/4F8gM5jP3KxWD 3Fd5YXZtjSH5oX2zMTxGe9wW6nk/5FS0idCqFwfcoN97gRbKWrEVKH7gECrdZGZ8VWVWfdejhScqD KYgZNc0oJD2tDPblShBdMHfoUdUF6uJ4qQ5ClFY1SgfjzwwmGLM/kGIfpqJtAMBdlpOFF3C7u/LY6 d/iC2DvqCBG25KX2/S5jQ2NE3dnhbe30lHYT9GTAUtHJEx8ZxMZiaDYA+01D+8DR8SbSFWQ7jUN+7 vuIaLVeXf+mj+dOrUJqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvM9o-00AfrP-2g; Tue, 24 Oct 2023 18:29:36 +0000 Received: from out-195.mta0.migadu.com ([91.218.175.195]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qvM9m-00Afpw-1R for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2023 18:29:36 +0000 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-Disposition: inline In-Reply-To: <20231020214053.2144305-12-rananta@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231024_112934_653000_D8CF434A X-CRM114-Status: GOOD ( 10.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel