From owner-freebsd-arch@freebsd.org Mon May 27 18:10:37 2019 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7455115A74B7 for ; Mon, 27 May 2019 18:10:37 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DEF1E779A2; Mon, 27 May 2019 18:10:32 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 36F3D8D4A166; Mon, 27 May 2019 18:10:31 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 0463AE70890; Mon, 27 May 2019 18:10:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id neqYqdNcLIbs; Mon, 27 May 2019 18:10:28 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:2ef0:eeff:fe03:ee34]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6E462E7088F; Mon, 27 May 2019 18:10:28 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Andriy Gapon" Cc: freebsd-arch@FreeBSD.ORG Subject: Re: proposal: require ivar accessors to succeed Date: Mon, 27 May 2019 18:10:28 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: In-Reply-To: <2b2ab28f-45c5-1c28-f923-170d95c20c3d@FreeBSD.org> References: <2b2ab28f-45c5-1c28-f923-170d95c20c3d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DEF1E779A2 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 2a01:4f8:13b:39f::9f:25 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-5.73 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f8:13b:39f::9f:25]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[zabbadoz.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.46)[ip: (-8.55), ipnet: 2a01:4f8::/29(-2.00), asn: 24940(-1.74), country: DE(-0.00)]; MX_GOOD(-0.01)[cross.sbone.de]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2019 18:10:37 -0000 On 27 May 2019, at 5:44, Andriy Gapon wrote: > __BUS_ACCESSOR() macro is used to define accessors to bus IVAR > variables. > Unfortunately, accessors defined in such a fashion completely ignore > return > values of BUS_READ_IVAR() and BUS_WRITE_IVAR() method calls. There is > no way to > see if a call is successful. Typically, this should not be a problem > as a > device driver targets a specific bus (sometimes, buses) and it should > know what > IVARs the bus has. So, the driver should make only those IVAR calls > that are > supposed to always succeed on the bus. > But sometimes things can go wrong as with everything else. > > So, I am proposing to add some code to __BUS_ACCESSOR to verify the > success. > For example, we can panic when a call fails. The checks could be > under > INVARIANTS or under DIAGNOSTICS or under a new kernel option. > A less drastic option is to print a warning message on an error. > > This is mostly intended to help driver writers and maintainers. > > Opinions, suggestions, etc are welcome. What about “fixing” the KPI (possibly adding a 2nd one), deprecating the old one, and (slowly over time) migrating old stuff over? /bz