2 of 4 added 81 characters in body; added 166 characters in body

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. It also do not call more tham one killall per occurence of the searchstring. And If you put this into a script and 'nohup thescript &', thescript will run even after you quit your session. Once you are satisfied it works, you can (instead of runjing it inba shell with nohuo) make it a deamon script started in your current runlevel (... or use systemd?)