Re: [PATCH V7 01/16] rv: Add Runtime Verification (RV) interface

From: Tao Zhou
Date: Wed Jul 27 2022 - 12:10:29 EST


On Mon, Jul 25, 2022 at 10:11:13PM +0200, Daniel Bristot de Oliveira wrote:

> +void rv_put_task_monitor_slot(int slot)
> +{
> + lockdep_assert_held(&rv_interface_lock);
> +
> + if (slot < 0 || slot >= RV_PER_TASK_MONITORS) {
> + WARN_ONCE(1, "RV releasing an invalid slot!: %d\n", slot);
> + return;
> + }
> +
> + WARN_ONCE(!task_monitor_slots[slot], "RV releasing unused task_monitor_slots: %d\n",
> + slot);
> +
> + task_monitor_count--;
> + task_monitor_slots[slot] = false;
> +}

I would say this can be implemented using bits. Also is an optimization.
But now here just use bool and seems not that needed.

> +static void turn_monitoring_off(void)
> +{
> + WRITE_ONCE(monitoring_on, false);
> + /* monitoring_on */
> + smp_wmb();

Absolutely the sync I can not see.
If not store another after smp_wmb(), even you have smp_wmb() pair,
it is not valid in my poor mind that there is no another load before
loading of monitoring_on that ensure something like if the another
load is *what* then the after load is ensured to be *what* statement
(I am sure I am poor on these, but just some words input yeah).