Re: Killing Giant for 13

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Tue, 13 Jul 2021 15:13:08 UTC
Hi,

I've been pondering with some ideas around Giant removal too.

First of all, I think the first step getting rid of Giant, is to move 
all Giant usage related to newbus into two own global functions, so we 
can start working on what and how the device tree should be protected 
separately. Personally I would prefer a sleepable EPOCH (See 
https://reviews.freebsd.org/D30376), because that would interact nicely 
with freeing the device softc and other internal structures.

void
device_tree_lock()
{
     mtx_lock(&Giant);
}

void
device_tree_unlock()
{
     mtx_unlock(&Giant);
}

Secondly I think that if we can remove all code sleeping with Giant, so 
to speak, either by using msleep(&Giant) or by using M_NOWAIT, we can 
get rid of the DROP and PICKUP Giant macros, and get Giant out of the 
fast path in all of the kernel. Then if Giant i still around as a mutex, 
it won't have that much impact!

Warner, what is the status of your Giant work?

--HPS