From owner-svn-src-head@freebsd.org Sun Nov 26 21:14:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11CF8DF0BCD; Sun, 26 Nov 2017 21:14:39 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFC9B7865E; Sun, 26 Nov 2017 21:14:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qk0-x233.google.com with SMTP id v137so30108777qkb.1; Sun, 26 Nov 2017 13:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ia+h9vrEgU/SZs78pAbsT9QeeNN3JmH23PO64UK6m1Q=; b=dbsKtjKG4eT9cYuG/CiQA+vOXLvxjlz4oQiNIUqbbmtBJmeL5ehJLKmRvGpT522oz+ 2GLKuZ1Y6D1hsmrJ37xiiWY/gv3S0YhlzAz/b/ngeEwa0R8O5BtrNwFbnE+rjJ1J78rm HJA2HKQesekiwCiX6MRgYCxzFU11O64qPalqDa2R2o9Jwn0uHry2nUPKaekOyfna1aF3 rhUDOl3y0x9aRTUlgDKxgQgf769KyZJqbKYe5bmWf/BbEl0ni877oP20M5zJxcbyT+mw PFasIt40J1IHf2vNfFS3asKzQShoLghcSoMzmkLA9Y8/DF0W/OmChKGonvGEip+b7xBk 2WJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ia+h9vrEgU/SZs78pAbsT9QeeNN3JmH23PO64UK6m1Q=; b=jkwmlUztNk6jeRRPN1MJoenGwn1kgdGLmsfm92bQndngtzGgJ0InpBrnKskcCicaJX U79gXSWjSJyB2EaJmN1pwebxaGqyFkSqWKC7AjJjsEBfm7CcltcOa7Ny8nJfdtGrbf1e muOH835PzYLdTaFK+xk0gbt8avsHK5Y2wA+7Q3Zz6sh1b1KmCZsoqF8/LqfOv8MSpMhl XI3W9t/IgUYZXkF+yMIW8MXhcO3XwcQln02syDGSFOuVWN3yxKQoNBYuczpHZokbJK9d 77k833rFoPu+fUvdB5zKnfXrowcyse9F9NIOJeEKrSirnDahchGmriS7n/VlTpOJTzmQ rZjA== X-Gm-Message-State: AJaThX5FEFcVDuCqfR8qRVdBrM5zSsKPzMVB8JK9eVTQdjWOD4kMlMsw lyZgkiNekDiKNz7T52lCJxdUAKBZtnNCX4KbaMI= X-Google-Smtp-Source: AGs4zMbtd5/qHgFYfNYwGO/GFfqe+NznxDbK/YAfDAq0aJeg1uDQHJWbVgSXgSZL62bAphjNhoFSpSyxuVe/oBQFDp4= X-Received: by 10.55.127.71 with SMTP id a68mr9911993qkd.90.1511730877803; Sun, 26 Nov 2017 13:14:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.29.17 with HTTP; Sun, 26 Nov 2017 13:14:37 -0800 (PST) In-Reply-To: <201711262110.vAQLAmNF043213@repo.freebsd.org> References: <201711262110.vAQLAmNF043213@repo.freebsd.org> From: Mateusz Guzik Date: Sun, 26 Nov 2017 22:14:37 +0100 Message-ID: Subject: Re: svn commit: r326237 - head/sys/kern To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Nov 2017 21:14:39 -0000 On Sun, Nov 26, 2017 at 10:10 PM, Mateusz Guzik wrote: > Author: mjg > Date: Sun Nov 26 21:10:47 2017 > New Revision: 326237 > URL: https://svnweb.freebsd.org/changeset/base/326237 > > Log: > rw: fix runlock_hard when new readers show up > > When waiters/writer spinner flags are set no new readers can show up > unless > they already have a different rw rock read locked. The change in r326195 > failed > to take that into account - in presence of new readers it would spin > until > they all drain, which would be lead to trouble if e.g. they go off cpu > and > can get scheduled because of this thread. > > Now that's an amazingly bad commit message. Typos and whatnot aside, I of course meant they *can't* get on the cpu. The thread in runlock slow path holds a spinlock and loops with it. > Reported by: pho > > Modified: > head/sys/kern/kern_rwlock.c > > Modified: head/sys/kern/kern_rwlock.c > ============================================================ > ================== > --- head/sys/kern/kern_rwlock.c Sun Nov 26 20:30:02 2017 (r326236) > +++ head/sys/kern/kern_rwlock.c Sun Nov 26 21:10:47 2017 (r326237) > @@ -769,6 +769,11 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td > turnstile_chain_lock(&rw->lock_object); > v = RW_READ_VALUE(rw); > retry_ts: > + if (__predict_false(RW_READERS(v) > 1)) { > + turnstile_chain_unlock(&rw->lock_object); > + continue; > + } > + > v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER); > MPASS(v & RW_LOCK_WAITERS); > > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > -- Mateusz Guzik