[PATCH 2/3] include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value

Pierrick Bouvier posted 3 patches 1 week, 2 days ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>
There is a newer version of this series
[PATCH 2/3] include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value
Posted by Pierrick Bouvier 1 week, 2 days ago
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/plugins/qemu-plugin.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/plugins/qemu-plugin.h b/include/plugins/qemu-plugin.h
index 2ce7a7fb6c3..4eb1d2cd85c 100644
--- a/include/plugins/qemu-plugin.h
+++ b/include/plugins/qemu-plugin.h
@@ -374,7 +374,8 @@ enum qemu_plugin_mem_value_type {
  *
  * @type: the memory access size
  * @data: the value accessed during the memory operation (value after
- *        read/write)
+ *        read/write). It's directly stored following host endianness, so no
+ *        further swap is needed.
  */
 typedef struct {
     enum qemu_plugin_mem_value_type type;
@@ -682,7 +683,7 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
  * qemu_plugin_mem_get_value() - return last value loaded/stored
  * @info: opaque memory transaction handle
  *
- * Returns: memory value
+ * Returns: memory value in host-endian order (no further swap is necessary).
  */
 QEMU_PLUGIN_API
 qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info);
-- 
2.47.3
Re: [PATCH 2/3] include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value
Posted by Alex Bennée 1 week, 1 day ago
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:

> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>  include/plugins/qemu-plugin.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/plugins/qemu-plugin.h b/include/plugins/qemu-plugin.h
> index 2ce7a7fb6c3..4eb1d2cd85c 100644
> --- a/include/plugins/qemu-plugin.h
> +++ b/include/plugins/qemu-plugin.h
> @@ -374,7 +374,8 @@ enum qemu_plugin_mem_value_type {
>   *
>   * @type: the memory access size
>   * @data: the value accessed during the memory operation (value after
> - *        read/write)
> + *        read/write). It's directly stored following host endianness, so no
> + *        further swap is needed.
>   */
>  typedef struct {
>      enum qemu_plugin_mem_value_type type;
> @@ -682,7 +683,7 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
>   * qemu_plugin_mem_get_value() - return last value loaded/stored
>   * @info: opaque memory transaction handle
>   *
> - * Returns: memory value
> + * Returns: memory value in host-endian order (no further swap is necessary).
>   */
>  QEMU_PLUGIN_API
>  qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info);

I'd be tempted to fold this into the change that makes it happen in 1/3.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH 2/3] include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value
Posted by Pierrick Bouvier 1 week, 1 day ago
On 3/25/26 8:17 AM, Alex Bennée wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> 
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>   include/plugins/qemu-plugin.h | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/plugins/qemu-plugin.h b/include/plugins/qemu-plugin.h
>> index 2ce7a7fb6c3..4eb1d2cd85c 100644
>> --- a/include/plugins/qemu-plugin.h
>> +++ b/include/plugins/qemu-plugin.h
>> @@ -374,7 +374,8 @@ enum qemu_plugin_mem_value_type {
>>    *
>>    * @type: the memory access size
>>    * @data: the value accessed during the memory operation (value after
>> - *        read/write)
>> + *        read/write). It's directly stored following host endianness, so no
>> + *        further swap is needed.
>>    */
>>   typedef struct {
>>       enum qemu_plugin_mem_value_type type;
>> @@ -682,7 +683,7 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info);
>>    * qemu_plugin_mem_get_value() - return last value loaded/stored
>>    * @info: opaque memory transaction handle
>>    *
>> - * Returns: memory value
>> + * Returns: memory value in host-endian order (no further swap is necessary).
>>    */
>>   QEMU_PLUGIN_API
>>   qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info);
> 
> I'd be tempted to fold this into the change that makes it happen in 1/3.
> 

It was already supposed to be the behavior (x64 host did the right thing 
by accident since it skips swap operation and rely on moveb), and other 
host architectures had a bug that went unnoticed until recently.

Regards,
Pierrick