linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Bristot de Oliveira <bristot@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
	Kate Carcia <kcarcia@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>, Ingo Molnar <mingo@redhat.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Gabriele Paoloni <gabriele.paoloni@intel.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Clark Williams <williams@redhat.com>,
	linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH 04/16] rv/include: Add deterministic automata monitor definition via C macros
Date: Thu, 20 May 2021 09:13:50 +0200	[thread overview]
Message-ID: <c638d724-c9d8-d640-eb99-8e684e2d594b@redhat.com> (raw)
In-Reply-To: <20210519182739.GG21560@worktop.programming.kicks-ass.net>

On 5/19/21 8:27 PM, Peter Zijlstra wrote:
> On Wed, May 19, 2021 at 01:36:25PM +0200, Daniel Bristot de Oliveira wrote:
> 
>> +struct da_monitor {
>> +	char curr_state;
>> +	bool monitoring;
>> +	void *model;
>> +};
>> +
>> +#define MAX_PID		 1024000
> 
>> +/*
>> + * Functions to define, init and get a per-task monitor.
>> + *
>> + * XXX: Make it dynamic? make it part of the task structure?
> 
> Yes !
> 
> I'd start with maybe adding a list_head to da_monitor and embedding a
> single copy into task_struct and link from there. Yes lists suck, but
> how many monitors do you realistically expect to run concurrently?

Good to know I can use the task struct! This will make my life easier. I did it
this way because I started doing the code all "out-of-tree," as modules... but
being in kernel gives such possibilities.

I will try to implement your idea! I do not see many concurrent monitors
running, and as the list search will be linear to the number of active
monitors... it might not even justify any more complex data structure.

Thanks Peter!

-- Daniel

>> + */
>> +#define DECLARE_DA_MON_INIT_PER_TASK(name, type)				\
>> +										\
>> +struct da_monitor da_mon_##name[MAX_PID];					\
> 
> That's ~16M of memory, which seems somewhat silly.
> 
>> +										\
>> +static inline struct da_monitor *da_get_monitor_##name(pid_t pid)		\
>> +{										\
>> +	return &da_mon_##name[pid];						\
>> +}										\
>> +										\
>> +void da_monitor_reset_all_##name(void)						\
>> +{										\
>> +	struct da_monitor *mon = da_mon_##name;					\
>> +	int i;									\
>> +	for (i = 0; i < MAX_PID; i++)						\
>> +		da_monitor_reset_##name(&mon[i]);				\
>> +}										\
>> +										\
>> +static void da_monitor_init_##name(void)					\
>> +{										\
>> +	struct da_monitor *mon = da_mon_##name;					\
>> +	int i;									\
>> +										\
>> +	for (i = 0; i < MAX_PID; i++) {						\
>> +		mon[i].curr_state = model_get_init_state_##name();		\
>> +		mon[i].monitoring = 0;						\
>> +		mon[i].model = model_get_model_##name();			\
>> +	}									\
>> +}										\
> 


  reply	other threads:[~2021-05-20  7:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 11:36 [RFC PATCH 00/16] The Runtime Verification (RV) interface Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 01/16] rv: Add " Daniel Bristot de Oliveira
2021-05-19 18:10   ` Randy Dunlap
2021-05-20  6:54     ` Daniel Bristot de Oliveira
2021-08-04  1:31       ` Steven Rostedt
2021-05-19 11:36 ` [RFC PATCH 02/16] rv: Add runtime reactors interface Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 03/16] rv/include: Add helper functions for deterministic automata Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 04/16] rv/include: Add deterministic automata monitor definition via C macros Daniel Bristot de Oliveira
2021-05-19 18:27   ` Peter Zijlstra
2021-05-20  7:13     ` Daniel Bristot de Oliveira [this message]
2021-05-19 11:36 ` [RFC PATCH 05/16] rv/include: Add tracing helper functions Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 06/16] tools/rv: Add dot2c Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 07/16] tools/rv: Add dot2k Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 08/16] rv/monitors: Add the wip monitor skeleton created by dot2k Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 09/16] rv/monitors: wip instrumentation and Makefile/Kconfig entries Daniel Bristot de Oliveira
2021-05-19 18:14   ` Randy Dunlap
2021-05-20  6:57     ` Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 10/16] rv/monitors: Add the wwnr monitor skeleton created by dot2k Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 11/16] rv/monitors: wwnr instrumentation and Makefile/Kconfig entries Daniel Bristot de Oliveira
2021-05-19 18:16   ` Randy Dunlap
2021-05-20  6:59     ` Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 12/16] rv/reactors: Add the printk reactor Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 13/16] rv/reactors: Add the panic reactor Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 14/16] rv/docs: Add a basic documentation Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 15/16] rv/docs: Add deterministic automata monitor synthesis documentation Daniel Bristot de Oliveira
2021-05-19 11:36 ` [RFC PATCH 16/16] rv/docs: Add deterministic automata instrumentation documentation Daniel Bristot de Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c638d724-c9d8-d640-eb99-8e684e2d594b@redhat.com \
    --to=bristot@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=gabriele.paoloni@intel.com \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=kcarcia@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mchehab@kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tommaso.cucinotta@santannapisa.it \
    --cc=will@kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).