1 of 4

A variant of @l0b0's answer:

dmesg --follow | awk '
   /BUG: workqueue lockup/  { system ("killall someprocessname") ; rem="done at each occurrence. You could add further things, like print to a logfile, etc.,"

This let's awk do the looping, and it will work until that process dies. If you put this into a script and 'nohup thescript &', thescript will run even after you quit your session.