* [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c
@ 2023-03-21 14:51 Ondřej Surý via lttng-dev
2023-03-21 20:20 ` Mathieu Desnoyers via lttng-dev
0 siblings, 1 reply; 3+ messages in thread
From: Ondřej Surý via lttng-dev @ 2023-03-21 14:51 UTC (permalink / raw)
To: lttng-dev
When adding REMOVED_FLAG to the pointers in the rculfhash
implementation, retype the generic pointer to unsigned long to fix the
following compiler error:
rculfhash.c:1201:2: error: address argument to atomic operation must be a pointer to integer ('struct cds_lfht_node **' invalid)
uatomic_or(&node->next, REMOVED_FLAG);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/urcu/uatomic.h:60:8: note: expanded from macro 'uatomic_or'
(void)__atomic_or_fetch((addr), (mask), __ATOMIC_RELAXED)
^ ~~~~~~
rculfhash.c:1444:3: error: address argument to atomic operation must be a pointer to integer ('struct cds_lfht_node **' invalid)
uatomic_or(&fini_bucket->next, REMOVED_FLAG);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/urcu/uatomic.h:60:8: note: expanded from macro 'uatomic_or'
(void)__atomic_or_fetch((addr), (mask), __ATOMIC_RELAXED)
^ ~~~~~~
This was not a problem before because the way the uatomic_or was
implemented, but now we directly pass the addr to __atomic_or_fetch()
and the compiler doesn't like the implicit conversion from pointer to
pointer to integer.
Signed-off-by: Ondřej Surý <ondrej@sury.org>
---
src/rculfhash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/rculfhash.c b/src/rculfhash.c
index b456415..5292725 100644
--- a/src/rculfhash.c
+++ b/src/rculfhash.c
@@ -1198,7 +1198,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
* Knowing which wins the race will be known after the garbage
* collection phase, stay tuned!
*/
- uatomic_or(&node->next, REMOVED_FLAG);
+ uatomic_or((unsigned long *)&node->next, REMOVED_FLAG);
/* We performed the (logical) deletion. */
/*
@@ -1441,7 +1441,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
dbg_printf("remove entry: order %lu index %lu hash %lu\n",
i, j, j);
/* Set the REMOVED_FLAG to freeze the ->next for gc */
- uatomic_or(&fini_bucket->next, REMOVED_FLAG);
+ uatomic_or((unsigned long *)&fini_bucket->next, REMOVED_FLAG);
_cds_lfht_gc_bucket(parent_bucket, fini_bucket);
}
ht->flavor->read_unlock();
--
2.39.2
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c
2023-03-21 14:51 [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c Ondřej Surý via lttng-dev
@ 2023-03-21 20:20 ` Mathieu Desnoyers via lttng-dev
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers via lttng-dev @ 2023-03-21 20:20 UTC (permalink / raw)
To: Ondřej Surý, lttng-dev
On 2023-03-21 10:51, Ondřej Surý via lttng-dev wrote:
> When adding REMOVED_FLAG to the pointers in the rculfhash
> implementation, retype the generic pointer to unsigned long to fix the
> following compiler error:
You will need to update the patch subject as well.
Thanks,
Mathieu
>
> rculfhash.c:1201:2: error: address argument to atomic operation must be a pointer to integer ('struct cds_lfht_node **' invalid)
> uatomic_or(&node->next, REMOVED_FLAG);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../include/urcu/uatomic.h:60:8: note: expanded from macro 'uatomic_or'
> (void)__atomic_or_fetch((addr), (mask), __ATOMIC_RELAXED)
> ^ ~~~~~~
> rculfhash.c:1444:3: error: address argument to atomic operation must be a pointer to integer ('struct cds_lfht_node **' invalid)
> uatomic_or(&fini_bucket->next, REMOVED_FLAG);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../include/urcu/uatomic.h:60:8: note: expanded from macro 'uatomic_or'
> (void)__atomic_or_fetch((addr), (mask), __ATOMIC_RELAXED)
> ^ ~~~~~~
>
> This was not a problem before because the way the uatomic_or was
> implemented, but now we directly pass the addr to __atomic_or_fetch()
> and the compiler doesn't like the implicit conversion from pointer to
> pointer to integer.
>
> Signed-off-by: Ondřej Surý <ondrej@sury.org>
> ---
> src/rculfhash.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/rculfhash.c b/src/rculfhash.c
> index b456415..5292725 100644
> --- a/src/rculfhash.c
> +++ b/src/rculfhash.c
> @@ -1198,7 +1198,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
> * Knowing which wins the race will be known after the garbage
> * collection phase, stay tuned!
> */
> - uatomic_or(&node->next, REMOVED_FLAG);
> + uatomic_or((unsigned long *)&node->next, REMOVED_FLAG);
> /* We performed the (logical) deletion. */
>
> /*
> @@ -1441,7 +1441,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
> dbg_printf("remove entry: order %lu index %lu hash %lu\n",
> i, j, j);
> /* Set the REMOVED_FLAG to freeze the ->next for gc */
> - uatomic_or(&fini_bucket->next, REMOVED_FLAG);
> + uatomic_or((unsigned long *)&fini_bucket->next, REMOVED_FLAG);
> _cds_lfht_gc_bucket(parent_bucket, fini_bucket);
> }
> ht->flavor->read_unlock();
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c
2023-03-21 13:30 [lttng-dev] (no subject) Ondřej Surý via lttng-dev
@ 2023-03-21 13:31 ` Ondřej Surý via lttng-dev
0 siblings, 0 replies; 3+ messages in thread
From: Ondřej Surý via lttng-dev @ 2023-03-21 13:31 UTC (permalink / raw)
To: lttng-dev
When adding REMOVED_FLAG to the pointers in the rculfhash
implementation, retype the generic pointer to uintptr_t to fix the
compiler error.
Signed-off-by: Ondřej Surý <ondrej@sury.org>
---
src/rculfhash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/rculfhash.c b/src/rculfhash.c
index b456415..863387e 100644
--- a/src/rculfhash.c
+++ b/src/rculfhash.c
@@ -1198,7 +1198,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
* Knowing which wins the race will be known after the garbage
* collection phase, stay tuned!
*/
- uatomic_or(&node->next, REMOVED_FLAG);
+ uatomic_or((uintptr_t *)&node->next, REMOVED_FLAG);
/* We performed the (logical) deletion. */
/*
@@ -1441,7 +1441,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
dbg_printf("remove entry: order %lu index %lu hash %lu\n",
i, j, j);
/* Set the REMOVED_FLAG to freeze the ->next for gc */
- uatomic_or(&fini_bucket->next, REMOVED_FLAG);
+ uatomic_or((uintptr_t *)&fini_bucket->next, REMOVED_FLAG);
_cds_lfht_gc_bucket(parent_bucket, fini_bucket);
}
ht->flavor->read_unlock();
--
2.39.2
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-21 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 14:51 [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c Ondřej Surý via lttng-dev
2023-03-21 20:20 ` Mathieu Desnoyers via lttng-dev
-- strict thread matches above, loose matches on Subject: below --
2023-03-21 13:30 [lttng-dev] (no subject) Ondřej Surý via lttng-dev
2023-03-21 13:31 ` [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c Ondřej Surý via lttng-dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).