Re: [PATCH v1 2/2] powerpc/debug: hook to user return notifier infrastructure

From: Christophe Leroy
Date: Wed Aug 28 2024 - 03:27:33 EST




Le 28/08/2024 à 08:50, Luming Yu a écrit :
On Wed, Aug 28, 2024 at 07:46:52AM +0200, Christophe Leroy wrote:
Hi,

Le 28/08/2024 à 05:17, 虞陆铭 a écrit :
Hi,

it appears the little feature might require a little bit more work to find its value of the patch.

Using the following debug module , some debugging shows the TIF_USER_RETURN_NOTIFY
bit is propagated in __switch_to among tasks , but USER_RETURN_NOTIFY call back seems to
be dropped somewhere on somone who carries the bit return to user space.
side notes:
there is an issue that the module symbols is not appended to /sys/kernel/debug/tracing/available_filter_functions
which should be sovled first to make it easier for further debuggig.

As far as I can see, user return notifier infrastructure was implemented in
2009 for KVM on x86, see
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F1253105134-8862-1-git-send-email-avi%40redhat.com%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C260e5ecf10764312459c08dcc72dc2f5%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638604246584044745%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3hjAzcVu3xOq0QNK5WINQ8trLd9Xp7XCiQjw2htabpQ%3D&reserved=0

Can you explain what is your usage of that infrastructure with your patch ?
You are talking about debug, what's the added value, what is it used for ?
one example: I was thinking to live patch kernel at the moment that all cpus are
either returning to user space or going into idle. But I'm not sure if it is truly
valuable. secondly, it can help us get more accurate user/system time
accounting via tracing rather than through sampling technique.
The third: it could have similar usages in kvm for ppc as x86 for tsc_aux.
etc :-)

Thanks.

Don't we already have a very accurate user/system time accounting with CONFIG_VIRT_CPU_ACCOUNTING_NATIVE ?

Christophe