Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-22 Thread Jessica Yu
+++ Peter Zijlstra [22/03/21 17:54 +0100]: On Mon, Mar 22, 2021 at 03:50:14PM +0100, Jessica Yu wrote: It should be doable. If you want the exit sections to be treated the same as module init, the following patch should stuff any exit sections into the module init "region" (completely

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-22 Thread Peter Zijlstra
On Mon, Mar 22, 2021 at 03:50:14PM +0100, Jessica Yu wrote: > It should be doable. If you want the exit sections to be treated the same as > module init, the following patch should stuff any exit sections into the > module > init "region" (completely untested). Hence it should be freed together

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-22 Thread Jessica Yu
+++ Steven Rostedt [19/03/21 16:57 -0400]: On Fri, 19 Mar 2021 20:34:24 +0100 Peter Zijlstra wrote: On Fri, Mar 19, 2021 at 02:00:05PM -0400, Steven Rostedt wrote: > Would making __exit code the same as init code work? That is, load it just > like module init code is loaded, and free it when

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-22 Thread Peter Zijlstra
On Mon, Mar 22, 2021 at 02:07:54PM +0100, Jessica Yu wrote: > +++ Steven Rostedt [19/03/21 14:00 -0400]: > > On Fri, 19 Mar 2021 13:57:38 +0100 > > Peter Zijlstra wrote: > > > > > Jessica, can you explain how !MODULE_UNLOAD is supposed to work? > > > Alternatives, jump_labels and static_call all

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-22 Thread Jessica Yu
+++ Steven Rostedt [19/03/21 14:00 -0400]: On Fri, 19 Mar 2021 13:57:38 +0100 Peter Zijlstra wrote: Jessica, can you explain how !MODULE_UNLOAD is supposed to work? Alternatives, jump_labels and static_call all can have relocations into __exit code. Not loading it at all would be BAD.

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-19 Thread Steven Rostedt
On Fri, 19 Mar 2021 20:34:24 +0100 Peter Zijlstra wrote: > On Fri, Mar 19, 2021 at 02:00:05PM -0400, Steven Rostedt wrote: > > Would making __exit code the same as init code work? That is, load it just > > like module init code is loaded, and free it when the init code is freed > > As stated,

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-19 Thread Peter Zijlstra
On Fri, Mar 19, 2021 at 02:00:05PM -0400, Steven Rostedt wrote: > Would making __exit code the same as init code work? That is, load it just > like module init code is loaded, and free it when the init code is freed As stated, yes. But it must then also identify as init through

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-19 Thread Steven Rostedt
On Fri, 19 Mar 2021 13:57:38 +0100 Peter Zijlstra wrote: > Jessica, can you explain how !MODULE_UNLOAD is supposed to work? > Alternatives, jump_labels and static_call all can have relocations into > __exit code. Not loading it at all would be BAD. According to the description: " Without this

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-19 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 05:58:38PM +0100, Peter Zijlstra wrote: > > For CONFIG_MODULE_UNLOAD, the code ends up in the normal text area, so > > static_call_is_init() is false and kernel_text_address() is true. > > > > For !CONFIG_MODULE_UNLOAD, the code gets discarded during module load, > > so

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-18 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 11:13:08AM -0500, Josh Poimboeuf wrote: > On Thu, Mar 18, 2021 at 12:31:59PM +0100, Peter Zijlstra wrote: > > if (!kernel_text_address((unsigned long)site_addr)) { > > - WARN_ONCE(1, "can't patch static call site at > > %pS", >

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-18 Thread Josh Poimboeuf
On Thu, Mar 18, 2021 at 12:31:59PM +0100, Peter Zijlstra wrote: > if (!kernel_text_address((unsigned long)site_addr)) { > - WARN_ONCE(1, "can't patch static call site at > %pS", > + /* > + *

Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-18 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 12:31:59PM +0100, Peter Zijlstra wrote: > Sites that match init_section_contains() get marked as INIT. For > built-in code init_sections contains both __init and __exit text. OTOH > kernel_text_address() only explicitly includes __init text (and there > are no __exit text

[PATCH 3/3] static_call: Fix static_call_update() sanity check

2021-03-18 Thread Peter Zijlstra
Sites that match init_section_contains() get marked as INIT. For built-in code init_sections contains both __init and __exit text. OTOH kernel_text_address() only explicitly includes __init text (and there are no __exit text markers). Match what jump_label already does and ignore the warning for