On Wed, Sep 14, 2022 at 09:09:10AM +0530, Anshuman Khandual wrote: > Something like the following change moves the buffer allocation off the stack, > although it requires updating the driver, and buffer assignment during a PMU > interrupt. But it does seem to work (will require some more testing). Yeah, looks like it should do the trick. > + > + events->branch_records = kmalloc(sizeof(struct brbe_records), flags); > + WARN_ON(!events->branch_records); No need for the WARN_ON(), if we run out of memory the memory management code is already very loud about it.