Software management of TLB misses? I'm reading an OS textbook and it was talking about TLB misses being handled by software. I'm very new to all this by the way. So there's a context switch to some kernel procedure. But surely in this case the TLB is not flushed, and the kernel code doesn't itself use the TLB, since that would defeat the purpose? But then how exactly does it work? I don't know why the text wouldn't address such a seemingly obvious question.

Plus you're still using virtual memory, right? So you would be doing two context switches, a bunch of page table lookups in memory, in addition to the actual kernel instructions, per missing TLB entry. It just seems counterintuitive to do all that work to make use of something that's supposed to save you work. Sorry if I'm getting something completely wrong here. Thank you in advance.
Textbooks don’t have to include everything. There should be room for you to figure out things yourself. Otherwise, how would we ever create things not found in today’s textbooks?

Maintaining the TLB is a tiny bit of code in the operating system. But every single instruction accessing memory relies on the TLB. Do you think the TLB does NOT save enormous amounts of work? 99.99% of all memory accesses are fast because the TLB tells you immediately where the data is. Having to update the TLB sometimes is a very small price to pay.