Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 24 Jul 2002 09:32:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 24 Jul 2002 09:32:42 -0400 Received: from mion.elka.pw.edu.pl ([194.29.160.35]:36826 "EHLO mion.elka.pw.edu.pl") by vger.kernel.org with ESMTP id ; Wed, 24 Jul 2002 09:32:41 -0400 Date: Wed, 24 Jul 2002 15:35:38 +0200 (MET DST) From: Bartlomiej Zolnierkiewicz To: Jens Axboe cc: , Subject: Re: please DON'T run 2.5.27 with IDE! In-Reply-To: <20020724132529.GD15201@suse.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2036 Lines: 57 On Wed, 24 Jul 2002, Jens Axboe wrote: > On Wed, Jul 24 2002, Marcin Dalecki wrote: > > Jens Axboe wrote: > > > > >>>>2.5.27:drivers/block/ll_rw_blk.c > > >>>>void blk_start_queue(request_queue_t *q) > > >>>>{ > > >>>> if (test_and_clear_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) { > > >>>> unsigned long flags; > > >>>> > > >>>> spin_lock_irqsave(q->queue_lock, flags); > > >>>> if (!elv_queue_empty(q)) > > >>>> q->request_fn(q); > > >>>> spin_unlock_irqrestore(q->queue_lock, flags); > > >>>> } > > >>>>} > > > > >There were buggy versions at one point, however they may not have made it > > >into a full release. In that case it was just bk version of 2.5.19-pre > > >effectively. I forget the details :-) > > > > Naj - it's far more trivial I just looked at wrong tree at hand... > > But anyway. What happens if somone does set QUEUE_FLAG_STOPPED > > between the test_and_claer_bit and taking the spin_lock? Setting > > the QUEUE_FLAG_STOPPED isn't maintaining the spin_lock protection! > > It doesn't matter. If QUEUE_FLAG_STOPPED was set when entering > blk_start_queue(), it will call into the request_fn. If blk_stop_queue() > is called between clearing QUEUE_FLAG_STOPPED in blk_start_queue() and > grabbing the spin_lock, the worst that can happen is a spurios extra > request_fn call. > > > My goal is to make sure that the QUEUE_FLAG_STOPPED has a valid value > > *inside* the q->request_fn call. > > So you want the queue_lock to protect the flags as well... I don't > really see the point of this. If driver corectly uses blk_start/stop_queue() it is not needed. Whole point of introducing this flag was not to take lock to check status of queue. -- Bartlomiej > -- > Jens Axboe - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/