Received: from eggs.gnu.org ([2001:4830:134:3::10]:53182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwX77-0001OP-Qd for qemu-devel@nongnu.org; Tue, 18 Oct 2016 12:19:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwX74-0006T2-HH for qemu-devel@nongnu.org; Tue, 18 Oct 2016 12:19:41 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:15417 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwX74-0006SX-An for qemu-devel@nongnu.org; Tue, 18 Oct 2016 12:19:38 -0400 From: Alberto Garcia In-Reply-To: <161e02dc-2358-cd62-46b8-5f5d4eca6b67@huawei.com> References: <1474014817-41572-1-git-send-email-pradeep.jagadeesh@huawei.com> <161e02dc-2358-cd62-46b8-5f5d4eca6b67@huawei.com> Date: Tue, 18 Oct 2016 18:19:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3] fsdev: add IO throttle support to fsdev devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pradeep Jagadeesh , Pradeep Jagadeesh , "Aneesh Kumar K.V" , Greg Kurz Cc: qemu-devel@nongnu.org, Claudio Fontana On Mon 17 Oct 2016 11:19:11 AM CEST, Pradeep Jagadeesh wrote: >>> +typedef struct FsThrottle { >>> + ThrottleState ts; >>> + ThrottleTimers tt; >>> + AioContext *aioctx; >>> + ThrottleConfig cfg; >>> + bool enabled; >>> + CoQueue throttled_reqs[2]; >>> + unsigned pending_reqs[2]; >>> + bool any_timer_armed[2]; >>> + QemuMutex lock; >>> +} FsThrottle; >> >> You based your implementation on block/throttle-groups.c. I think >> yours can be made simpler because one of the problems with mine is >> that it needs to support multiple parallel I/O operations on the same >> throttling group, and that's why the locking rules are more >> complex. With a single user per ThrottleConfig this is not necessary. >> >> Have you checked if you really need them? My impression is that you >> might be able to get rid of the 'lock', 'any_timer_armed' and >> 'pending_reqs' fields. >> >> Please check commit 76f4afb40fa076ed23fe0ab42c7a768ddb71123f to see >> how was the transition from single-drive throttling to group >> throttling, specifically the bdrv_io_limits_intercept() function. You >> will see that it was simpler. > > I tried removing the lock, I got into rcu issues, and the qemu hangs. > Once I put them back, it works fine. Did you figure out why the lock is needed in this case? In the case of disk group throttling, it is because there is data shared by several disks which may be running at the same time. Berto