Skip to contentSkip to conversation

mm/page_ref, crypto/async_pq: don't put_page from __exit

RFC PATCH In review Arnd Bergmann 2 participants 3 messages Feb 28, 2016 – Feb 29, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mm/page_ref, crypto/async_pq: don't put_page from __exit

The addition of tracepoints to the page reference tracking had an unfortunate side-effect in at least one driver that calls put_page from its exit function, resulting in a link error:

.exit.text' referenced in section __jump_table' of crypto/built-in.o: defined in discarded section `.exit.text' of crypto/built-in.o

I could not come up with a nice solution that ignores __jump_table entries in discarded code, so we probably now have to treat this as something a driver is not allowed to do. Removing the __exit annotation avoids the problem in this particular driver, but the same problem could come back any time in other code.

On a related problem regarding the runtime patching for SMP operations on ARM uniprocessor systems, we resorted to not drop the .exit section at link time, but that doesn't seem appropriate here.

Fixes 0f80830dd044 ("mm/page_ref: add tracepoint to track down page reference manipulation")
---
 crypto/async_tx/async_pq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/async_tx/async_pq.c +1 -1
index c0748bbd4c08..be167145aa55 100644
@@ -442,7 +442,7 @@ static int __init async_pq_init(void)
 	return -ENOMEM;
 }
 
-static void __exit async_pq_exit(void)
+static void async_pq_exit(void)
 {
 	put_page(pq_scribble_page);
 }
Signature · 1 line
2.7.0
#1 lore raw

2016-02-29 6:57 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 28 lines

The addition of tracepoints to the page reference tracking had an unfortunate side-effect in at least one driver that calls put_page from its exit function, resulting in a link error:

.exit.text' referenced in section __jump_table' of crypto/built-in.o: defined in discarded section `.exit.text' of crypto/built-in.o

I could not come up with a nice solution that ignores __jump_table entries in discarded code, so we probably now have to treat this as something a driver is not allowed to do. Removing the __exit annotation avoids the problem in this particular driver, but the same problem could come back any time in other code.

On a related problem regarding the runtime patching for SMP operations on ARM uniprocessor systems, we resorted to not drop the .exit section at link time, but that doesn't seem appropriate here.

Fixes 0f80830dd044 ("mm/page_ref: add tracepoint to track down page reference manipulation")
---
 crypto/async_tx/async_pq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/async_tx/async_pq.c +0 -0
index c0748bbd4c08..be167145aa55 100644

crypto/async_tx/async_pq.c static int __init async_pq_init(void) · line 448

Quoted 8 lines
crypto/async_tx/async_pq.c +1 -1
@@ -442,7 +442,7 @@ static int __init async_pq_init(void)
        return -ENOMEM;
 }
 
-static void __exit async_pq_exit(void)
+static void async_pq_exit(void)
 {
        put_page(pq_scribble_page);
 }

Hello, Arnd.

I think that we can avoid this error by using __free_page(). It would not be inlined so calling it would have no problem.

Could you test it, please?

Thanks.

#2 lore raw
Quoted 7 lines · On Monday 29 February 2016 16:40:02 Joonsoo Kim wrote:

Hello, Arnd.

I think that we can avoid this error by using __free_page(). It would not be inlined so calling it would have no problem.

Could you test it, please?

Yes, I suspect the driver should have done that anyway, new patch under way.

Arnd