From owner-svn-src-head@freebsd.org Fri Nov 15 18:09:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88A271AC290; Fri, 15 Nov 2019 18:09:18 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47F5vx0tWjz46jG; Fri, 15 Nov 2019 18:09:16 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0139E6F3; Fri, 15 Nov 2019 13:09:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 15 Nov 2019 13:09:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=/ K2DctMTNeyCmbq+RDLGpekQbI24oCLzELcBuGDeLrg=; b=QSydjZoPUlS4Whmqp gqDFZ2hElwwJ7Obv+PBb1MU4layXh+ue4zx/55CMlMcMRgiG6rlhpA+v36hC7dJp Gtj6kHU7Ipu2lRbsGJoo4Doqa5x14gLGN6E3NCY/cw6IohdNnQ7mgiMoezgaM2nT ZDw9hrYatxl0181vKilIeOuOn9g+3JPT+P9JYgCMpFMx8/LlTc3+YRlriPdXcKEp YGLn9yc3gQ7GpZP4RRxFTV5p6WY1jTIhVm1Lf72ldwbT2qMntmB2GbCQAoKQ+tww KgtdWxXMkAEm6MQX/UI3vF8t0RjJQtMBdEXYvGoiBMnoReXyO8ym/4EZOCWfkgZa i6Iaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=/K2DctMTNeyCmbq+RDLGpekQbI24oCLzELcBuGDeL rg=; b=tHPJvetd9Gv6BG6KDa2S4nQs11G8/4NJnmGfvrCsW1mCSxuR5EdDlw/YM G3vxCV5TMgvxfFGOQHj77g/g1lYNs7ZseWGQvBUQ1oz46/XYMOV/I0bx9XO2d5O7 IsJzgMLxIbEmBbuBwwFTqmIb+wb+tFK7WrjIeU+KCyClOLyDYVaPPznWWNVHAZIx IuKNo9B9iWV3Ia+eCI3BRZNKVKQqGkgAGqC+/2jF+aoemLclHftzpdfFIJCXWple bl+nG1DXq3ERIDUzBzz9BVN5NErEhStPchLebPXflAU4WsBRa7ZB7OC4PiSW4U9+ +bLMgI6M4FlB4sobbKVymY7EtHKzQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudefhedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtjeenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrd egiedrkeelrddvudefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehstghothhtlhesshgr mhhstghordhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.0.129] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id E363280059; Fri, 15 Nov 2019 13:09:12 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354703 - head/sys/dev/ioat From: Scott Long In-Reply-To: <20191115091837.GD2707@kib.kiev.ua> Date: Fri, 15 Nov 2019 11:09:12 -0700 Cc: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <842A5858-39B8-4196-8A94-018FA37DE75E@samsco.org> References: <201911140439.xAE4dngZ032224@repo.freebsd.org> <20191114101149.GA2707@kib.kiev.ua> <475757c6-3707-540b-0316-cbef278043c2@FreeBSD.org> <20191115091837.GD2707@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 47F5vx0tWjz46jG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm1 header.b=QSydjZoP; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=tHPJvetd; dmarc=none; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 64.147.123.24 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-5.59 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm1,messagingengine.com:s=fm1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.24]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[samsco.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; IP_SCORE(-3.49)[ip: (-9.79), ipnet: 64.147.123.0/24(-4.91), asn: 11403(-2.68), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_IN_DNSWL_LOW(-0.10)[24.123.147.64.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Fri, 15 Nov 2019 18:09:18 -0000 > On Nov 15, 2019, at 2:18 AM, Konstantin Belousov = wrote: >=20 > On Thu, Nov 14, 2019 at 09:41:36AM -0500, Alexander Motin wrote: >> On 14.11.2019 05:11, Konstantin Belousov wrote: >>> On Thu, Nov 14, 2019 at 04:39:49AM +0000, Alexander Motin wrote: >>>> Author: mav >>>> Date: Thu Nov 14 04:39:48 2019 >>>> New Revision: 354703 >>>> URL: https://svnweb.freebsd.org/changeset/base/354703 >>>>=20 >>>> Log: >>>> Pass more reasonable WAIT flags to bus_dma(9) calls. >>>>=20 >>>> MFC after: 2 weeks >>>>=20 >>>> Modified: >>>> head/sys/dev/ioat/ioat.c >>>>=20 >>>> Modified: head/sys/dev/ioat/ioat.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/dev/ioat/ioat.c Thu Nov 14 04:34:58 2019 = (r354702) >>>> +++ head/sys/dev/ioat/ioat.c Thu Nov 14 04:39:48 2019 = (r354703) >>>> @@ -555,13 +555,14 @@ ioat3_attach(device_t device) >>>> &ioat->comp_update_tag); >>>>=20 >>>> error =3D bus_dmamem_alloc(ioat->comp_update_tag, >>>> - (void **)&ioat->comp_update, BUS_DMA_ZERO, = &ioat->comp_update_map); >>>> + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, >>>> + &ioat->comp_update_map); >>> For waitok, you need to provide locking function in the tag. >>=20 >> I'm sorry, but why? It is alloc(), not load(). For load() it makes >> sense since it calls back, but this is just a form of malloc(), isn't >> it? I've looked through the both x86 implementations and found = nothing >> suspicious. >=20 > I see. Still, if you (or somebody else) ever decided to use WAITOK = loads,=20 > it would be much safer to provide the lock function now. >=20 Loads are always non-blocking, and the WAITOK flag is not part of that API. A load may defer its callback, and the asynchronous execution of = that callback is why we have the loaned lock. If a blocking alloc is = performed in a context where the caller holds a lock, then it=E2=80=99s the = caller=E2=80=99s responsibility to indicate NOWAIT and deal with the possible failure. Just like with malloc and contigmalloc, the API does not, nor will it ever, drop and require locks on behalf of the caller. The API tried to enforce the = practice that static resource allocation should happen at initialization time = when locks don=E2=80=99t need to be held. It=E2=80=99s unfortunate that the NOWAIT flag is overloaded for = different meanings in the load functions vs the alloc functions. Maybe this is what is = causing confusion? TL;DR: ALexander=E2=80=99s change is correct. Scott