[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 12/14] xen/riscv: introduce an implementation of macros from <asm/bug.h>


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 27 Jan 2023 15:34:19 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p+y4yvqopXpvgyB8ejzGsOVkvXAMiQzvJ5mjT0msAQE=; b=LLWwmvq9idV5EqDU6lA77QMoYQKAQC2q3zAKFGeiyebz5/hgORPM2EEy0F3F047O0nlwzYAQRLjxeOPRqb75zMaNonVZJDto/MQd8uUH8taS/0c2ho+x6qtTvml3oz/+Y3Brx7ndn8KBp+mEtGGeTDgccewKVh8FKB3m/40t2BD9D5d7HWrDOHo1EBQDfQ5hGHkLqYDys8P1p1C7N63yte/r3oTb3kC/UuwcHtD4oEWXq9ENkn3dIzzhjZW37zcL7+27iAftiz6X2xZcg4Xvh4bJFo3h+X4mIhG2ff75NEuctZs5cwDR/NLy84yGq37DUrzV/wSe2Sgq+4vr6+R5Kg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EtbqvTNE7IGEH3ll0frhByL9ctjIKRsWCKw/a3jQqOzVlb7qVCxrVVG92y1n2JdLqJQchpz19/+JRnzAZVbfj3YjeVvcS2SnFVlop+SBkTfHc9f64nJJU76CZ66Asf4C5uGvnBmWBjAvL5cpif6LS/NPHnury867PnyXzD0qoUxnKl8/Ju6Ecd8Nb4tPPTcpBzzBHwxj9ZhN/np40EB4P+alHLLt/RlPAhNEwhbGSoFXHwaQTc4zsH+bGUr+abZmM2wSXHZjtotU5hZ5i4CqtqpLj1kqgfJUqP4JqZmULQUUgmivhbwSokGcxfLP0AoBxCoeylhBfM++FueuCK4qJQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 27 Jan 2023 14:34:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.01.2023 14:59, Oleksii Kurochko wrote:
> The patch introduces macros: BUG(), WARN(), run_in_exception(),
> assert_failed.
> 
> The implementation uses "ebreak" instruction in combination with
> diffrent bug frame tables (for each type) which contains useful
> information.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
> Changes:
>   - Remove __ in define namings
>   - Update run_in_exception_handler() with
>     register void *fn_ asm(__stringify(BUG_FN_REG)) = (fn);
>   - Remove bug_instr_t type and change it's usage to uint32_t

But that's not correct - as said before, you can't assume you can access
32 bits, there maybe only a 16-bit insn at the end of a page, with nothing
mapped to the VA of the subsequent page. Even more ...

> + end:
> +    regs->sepc += GET_INSN_LENGTH(*(uint32_t *)pc);

... you obtain insn length you don't even need to read 32 bits.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.