Re: How to unwind stack to seek for specific caller?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




03.08.2018, 15:42, "valdis.kletnieks@xxxxxx" <valdis.kletnieks@xxxxxx>:
> On Fri, 03 Aug 2018 15:14:45 +0300, Lev Olshvang said:
>
>>  But I need to find out whether my function y() was called from linux kernel
>>  function x().\
>
> What problem are you trying to solve? If it's your function, don't you already
> *know* which functions call it?
>
> And if being called from code A requires different behavior than if it was
> called from B, the *right* answer is to create a flag and pass it. That
> requires less code, is simpler than trying to unwind the stack, and makes it
> easier if 6 months from now you call a call from routine C.
>
> For an example, see the memory-allocation flags GFP_ATOMIC and similar - if
> you're adding another call site that needs it, you just add GFP_ATOMIC to the
> flags.
>
> And I'm willing to bet that most of those GFP_ flags were *all* originally "we
> have to do something special if we try to do memory allocation from That One
> Problem Spot. :)

Hi Valdis,

Thanks for the reply.
Now I see i miised to explain that my function x() in my module might be called from kernel functions foo() or bar() which I do not own
( function my_x() is sort of callback) . Since  I can not change foo()) or bar() code and add flags I need to inspect the stack.

I am confused to see in kernel code that there is a new to me objects of type kernel dumper who need to be registered in order to get dump_stack() 
output.

Saw I applied yo list wisdom to seek for an advise.

Thanks All.
Lev


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux