Skip to contentSkip to conversation

tools: Move MASK_INSR to common-macros.h

PATCH In review Andrew Cooper 3 participants 8 messages Jun 8, 2023 – Jun 9, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: Move MASK_INSR to common-macros.h

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Luca Fancellu <[email protected]>

---
 tools/include/xen-tools/common-macros.h | 1 +
 tools/libs/light/libxl_internal.h       | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/include/xen-tools/common-macros.h +1 -0
index d53b88182560..168691be0e93 100644
@@ -73,6 +73,7 @@
 #endif
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
+#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
 
 #ifndef __must_check
 #define __must_check __attribute__((__warn_unused_result__))
tools/libs/light/libxl_internal.h +0 -2
index 8aba3e138909..61f4fe1dec55 100644
@@ -132,8 +132,6 @@
 
 #define DIV_ROUNDUP(n, d) (((n) + (d) - 1) / (d))
 
-#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
-
 #define LIBXL__LOGGING_ENABLED
 
 #ifdef LIBXL__LOGGING_ENABLED
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

I don’t think this patch is fixing a bug:

### Fixes:

If your patch fixes a bug in a specific commit, e.g. you found an issue using ``git bisect``, please use the Fixes: tag with the first 12 characters of the commit id, and the one line summary.

Quoted 1 line

But it makes sense, so

Quoted 37 lines

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Luca Fancellu <[email protected]>
---
tools/include/xen-tools/common-macros.h | 1 +
tools/libs/light/libxl_internal.h | 2 --

2 files changed, 1 insertion(+), 2 deletions(-)
tools/include/xen-tools/common-macros.h +1 -0
index d53b88182560..168691be0e93 100644
@@ -73,6 +73,7 @@
 #endif
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
+#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
 
 #ifndef __must_check
 #define __must_check __attribute__((__warn_unused_result__))
tools/libs/light/libxl_internal.h +0 -2
index 8aba3e138909..61f4fe1dec55 100644
@@ -132,8 +132,6 @@
 
 #define DIV_ROUNDUP(n, d) (((n) + (d) - 1) / (d))
 
-#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
-
 #define LIBXL__LOGGING_ENABLED
 
 #ifdef LIBXL__LOGGING_ENABLED
Signature · 1 line
2.30.2
#2 lore raw
Quoted 4 lines · Luca Fancellu
Quoted 4 lines · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Quoted 8 lines
Quoted 1 line
Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

I don’t think this patch is fixing a bug:

### Fixes:

If your patch fixes a bug in a specific commit, e.g. you found an issue using ``git bisect``, please use the Fixes: tag with the first 12 characters of the commit id, and the one line summary.

That a poor explanation...

Fixes is about corrections to the patch, not bugs.

56a7aaa16bfe is unlikely to be backported, but if a downstream were to backport your SVE patches, Fixes: identify all other patches they need to take.

Fixes: was specifically invented to let tooling (partially) automate the task if finding new patches to backport, based on what had already been backported.

Concrete bugs are the majority reason for a Fixes tag, sure, but not the only reason.  In this case, a downstream absolutely doesn't want to get into a position where these macros aren't together in a pair, because it there will be a case in the future where it causes a build error.

Quoted 4 lines
Quoted 1 line

But it makes sense, so

Thanks.  As you've already indicated that you're ok with fixing up x86-emulate.h in v2, I'll retain this.

~Andrew

#3 lore raw
Quoted 22 lines · Andrew Cooper
Quoted 4 lines · Luca Fancellu
Quoted 4 lines · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Quoted 8 lines
Quoted 1 line
Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

I don’t think this patch is fixing a bug:

### Fixes:

If your patch fixes a bug in a specific commit, e.g. you found an issue using ``git bisect``, please use the Fixes: tag with the first 12 characters of the commit id, and the one line summary.

That a poor explanation...

Fixes is about corrections to the patch, not bugs.
Quoted 7 lines

56a7aaa16bfe is unlikely to be backported, but if a downstream were to backport your SVE patches, Fixes: identify all other patches they need to take.

Fixes: was specifically invented to let tooling (partially) automate the task if finding new patches to backport, based on what had already been backported.

Ok this makes sense, so that a tool can easily understand where to put the focus.

Quoted 6 lines

Concrete bugs are the majority reason for a Fixes tag, sure, but not the only reason. In this case, a downstream absolutely doesn't want to get into a position where these macros aren't together in a pair, because it there will be a case in the future where it causes a build error.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

But it makes sense, so

Thanks. As you've already indicated that you're ok with fixing up x86-emulate.h in v2, I'll retain this.

sure, thanks for fixing it

Quoted 2 lines

~Andrew

#4 lore raw
In reply to Andrew Cooper
Quoted 1 line · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Right, that's one thing which should have been done right away. The other is that both macros should have been purged from tools/tests/x86_emulator/x86-emulate.h (which includes xen-tools/common-macros.h). Luca?

Jan

Quoted 36 lines
Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Luca Fancellu <[email protected]>

---
 tools/include/xen-tools/common-macros.h | 1 +
 tools/libs/light/libxl_internal.h       | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/include/xen-tools/common-macros.h +1 -0
index d53b88182560..168691be0e93 100644
@@ -73,6 +73,7 @@
 #endif
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
+#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
 
 #ifndef __must_check
 #define __must_check __attribute__((__warn_unused_result__))
tools/libs/light/libxl_internal.h +0 -2
index 8aba3e138909..61f4fe1dec55 100644
@@ -132,8 +132,6 @@
 
 #define DIV_ROUNDUP(n, d) (((n) + (d) - 1) / (d))
 
-#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
-
 #define LIBXL__LOGGING_ENABLED
 
 #ifdef LIBXL__LOGGING_ENABLED
#5 lore raw
Quoted 6 lines · Jan Beulich
Quoted 1 line · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Right, that's one thing which should have been done right away. The other is that both macros should have been purged from tools/tests/x86_emulator/x86-emulate.h (which includes xen-tools/common-macros.h). Luca?

Hmm - I explicitly checked that, and concluded they didn't...  Happy to purge them if I'm wrong.

~Andrew

#6 lore raw
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich
Quoted 1 line · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Right, that's one thing which should have been done right away. The other is that both macros should have been purged from tools/tests/x86_emulator/x86-emulate.h (which includes xen-tools/common-macros.h). Luca?

Hmm - I explicitly checked that, and concluded they didn't...  Happy to purge them if I'm wrong.

I think I was looking in an old branch.  Fixed for v2.

~Andrew

#7 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 1 line · Andrew Cooper

MASK_EXTR() and MASK_INSR() are a matching pair. Keep them together.

Right, that's one thing which should have been done right away. The other is that both macros should have been purged from tools/tests/x86_emulator/x86-emulate.h (which includes xen-tools/common-macros.h). Luca?

mmm right I’ve missed that, if Andrew can handle it in this patch I’m ok, if you want me to send a patch I can do it

Quoted 40 lines

Jan

Quoted 36 lines
Fixes 56a7aaa16bfe ("tools: add physinfo arch_capabilities handling for Arm")

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Luca Fancellu <[email protected]>
---
tools/include/xen-tools/common-macros.h | 1 +
tools/libs/light/libxl_internal.h | 2 --

2 files changed, 1 insertion(+), 2 deletions(-)
tools/include/xen-tools/common-macros.h +1 -0
index d53b88182560..168691be0e93 100644
@@ -73,6 +73,7 @@
 #endif
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
+#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
 
 #ifndef __must_check
 #define __must_check __attribute__((__warn_unused_result__))
tools/libs/light/libxl_internal.h +0 -2
index 8aba3e138909..61f4fe1dec55 100644
@@ -132,8 +132,6 @@
 
 #define DIV_ROUNDUP(n, d) (((n) + (d) - 1) / (d))
 
-#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
-
 #define LIBXL__LOGGING_ENABLED
 
 #ifdef LIBXL__LOGGING_ENABLED