Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp12435421ybl; Sat, 28 Dec 2019 12:16:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyoerPQx9BZmCZTaEONkyVTzIhHmIHJj3Z/3B53/qg0UG9oCpHowH0r3Sd7JfEGhYBLVG5H X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr66383345otp.346.1577564184680; Sat, 28 Dec 2019 12:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577564184; cv=none; d=google.com; s=arc-20160816; b=sru7Or2d4k3/LITj0glAfr65QAOzQV1+zqDfUiht5pOxc1Mi5EmI5XckXVBuYEM5Z3 wQ4nMFmPGEzYVDT/cciOkSGU9mykO9noKOSkXaJD8XrUjd6zKlcGwaA0mR0+N+YzSsVp 9hiEgM8KFTU+ZYe1WbmSZ3dUIOXnn2YV3onI23DUwz8WfUt8T7aPKJfbPjDlqebdA6n2 jJDWjiN0oVjotZ+L8JCjpPrhYKLVq2lWj9ha9pwMU2rQUMP68QyxxPIl1/Ug4ZpElSm3 3ahFN7eUwRJOKBpl89pkDZJcj4b2uwGFgDMjFnjpSZASEehEyrZeI3zzQ3VS0QWeqWFh DsFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oMtWXMleCRN/6fnMoLubWCUX2f8uRwXYKw/z+kqlLnM=; b=SDZEpl8mHiPiQ2lqLlf21n0IodjOzDwBmy8ZQiiBvcSiPm3IkQfiJiPEVDLN92D1s1 LupuR3HI22XD7eJCMULCJsQvdRDKmm1uezliDivb6JFcRWOmOj3eeSI0mpu5Tj6nHs7e sA05kQdwcKVnvaV1ZHISvwb3hVQSHXkRt++oVA5KjXZsT2480HPzkY+It8hvK9FQAneC 3KErBWwkqU64KW+CW386JLHqKEj14LzTCJd6fmdQ/JD83J9gYE1Xdf1837UxImmaJLeG El81rHPXc1OEmtCYUnn+4rB+/UFu+oktJsan0fe0xht9ampAC2+oUMV1jQU3LzKdc6SI tsbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aKnuh65S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si20343891otq.250.2019.12.28.12.16.10; Sat, 28 Dec 2019 12:16:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aKnuh65S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbfL1UPV (ORCPT + 99 others); Sat, 28 Dec 2019 15:15:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:52394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbfL1UPV (ORCPT ); Sat, 28 Dec 2019 15:15:21 -0500 Received: from zzz.localdomain (h75-100-12-111.burkwi.broadband.dynamic.tds.net [75.100.12.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 207D9207E0; Sat, 28 Dec 2019 20:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577564120; bh=hXgMYc8GBQ/inlmuUvwxM76ZQX3hIRNnBN51niq7Ou8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aKnuh65SExXA9hH1Y7TmxMELvhiLrtXSa6vSk40OdvcKf6On6WWedXTi1QyunTbs4 NqUOKS3E7AMdctymSQTJY9tWMz8QGf3TE7q1EboVLX8ATSFZiuuOtk1E1rxqq4sphA Jp6W8thQJsoR5hXwZ7Kd6b1zUPvxDK0dkPG+3KeI= Date: Sat, 28 Dec 2019 14:15:18 -0600 From: Eric Biggers To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Will Deacon , Elena Reshetova , Thomas Gleixner , Kees Cook , Anna-Maria Gleixner , Sebastian Andrzej Siewior Subject: Re: [PATCH] locking/refcount: add sparse annotations to dec-and-lock functions Message-ID: <20191228201518.GA266348@zzz.localdomain> References: <20191226152922.2034-1-ebiggers@kernel.org> <20191228114918.GU2827@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191228114918.GU2827@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 28, 2019 at 12:49:18PM +0100, Peter Zijlstra wrote: > On Thu, Dec 26, 2019 at 09:29:22AM -0600, Eric Biggers wrote: > > From: Eric Biggers > > > > Wrap refcount_dec_and_lock() and refcount_dec_and_lock_irqsave() with > > macros using __cond_lock() so that 'sparse' doesn't report warnings > > about unbalanced locking when using them. > > > > This is the same thing that's done for their atomic_t equivalents. > > > > Don't annotate refcount_dec_and_mutex_lock(), because mutexes don't > > currently have sparse annotations. > > I so f'ing hate that __cond_lock() crap. Previously I've suggested > fixing sparse instead of making such an atrocious trainwreck of the > code. What is your suggestion exactly? There has to be an annotation for this, because by design sparse only analyzes individual translation units; it's not a full-blown static analyzer that operates on the AST for the whole kernel. - Eric