Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2266500imm; Sat, 15 Sep 2018 12:59:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZcs7pdp+vRcxlNk8EuCbEwTJYA1P2P4zrkTaUX2NQ6lsAnnrVe+F+bYf+K/tZrp5wHIda5 X-Received: by 2002:a17:902:5a87:: with SMTP id r7-v6mr17917701pli.247.1537041539952; Sat, 15 Sep 2018 12:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537041539; cv=none; d=google.com; s=arc-20160816; b=h6V/ixD4W1b/h2w7gS4rYpnvvXFNKBLJSIMxUZABzuOJaYEOohtjMYmzN+1xaOzuvl pF7yCC/Af2jfhlcCsePmmtEjdElm1GPwok1oBqsmqjnMLKjatXXToXlTMbBioWh56txm Om/Kkjc1p/6haI+2juhRXxskmUL21h7wobNz5ki98eSpDP3TT0ecrwPm+kwOpDFZ9BeP fIjPDkIq5uOZOS1+OKzfgGNDn4xMc4I5QG65eYy3Lrwy/fghi3Rqm+McVFgrgYZMr/V/ 9WABwqnkZCJ98EgBbLYM/Rb4S2nJVsVZUloa01/qLqPtQ08mrEEW6fgGu+huHG5JZCz7 dM9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=Hz1gf38z/x7qPN6bSE11FNVRsPuUS609D7FsSWqoOTI=; b=uXB4HQ5b4Z2xR0OTus3B4pWBS2CwmRVEHmkaXGzJ9/7gHD33alAS/N3+aGF/3nDqMl +gPUU9JTNMeZuvC+AEsPaLO4a2FzHlO8tsZ3VulaVgyFj3PhDUB20QPlbLMyIwxVPArv o2t/KQMvQB/KyNfS7pYHoiw1RDeLF4BNfo4oH8m16iI+hrbzD2xD/5auFOjmNZiRVmy1 yshYrGZT6c5gOXt6k9jqqnAnuiEabRM/XDFJ/i8DU+6D5ZK+fY4Rv+Ufy0WUrEl1Ozhh Yzc+V8ee5TOOglEqVpzB32Y4Ms6+w2TUDuM13JBudBfiH4kLs9S/cR/kCrKYZYHAx6UO WiBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=fhOquIgq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q132-v6si11799873pfc.159.2018.09.15.12.58.30; Sat, 15 Sep 2018 12:58:59 -0700 (PDT) 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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=fhOquIgq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727847AbeIPBSe (ORCPT + 99 others); Sat, 15 Sep 2018 21:18:34 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38840 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbeIPBSd (ORCPT ); Sat, 15 Sep 2018 21:18:33 -0400 Received: by mail-pl1-f195.google.com with SMTP id u11-v6so5656014plq.5 for ; Sat, 15 Sep 2018 12:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Hz1gf38z/x7qPN6bSE11FNVRsPuUS609D7FsSWqoOTI=; b=fhOquIgqyIx6Cmkc6QKltR0TvUMQZiiLxU+vSNzU84e7hcyuLgPo/yWeqMGJ7Eh7zc U4LtSM+C4aQWEMKXh8Ljehl6RqaC9HbkUtXggfuDY5Wpad3TjdlXKss0SxUSuKtLlgDe cSd/32nkwjNdiOfWdMDVWdaKuZ7Nf6ATkG510iAjsp7vCPkGRAQxtt8Q0hqXKjILB8dP 4JyqxwfVhPZnibtZG4MGjjuoBDMuD32NsOmqBMIW2StJnrj6ziGut90rikHQNDK7bXMv a2TnGbwfCyRi78uunE3Zf5XbvVIilIqB4hh/vyuDotvqBDxaPUtUkSCvLTA9NNfZcpHN LcPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Hz1gf38z/x7qPN6bSE11FNVRsPuUS609D7FsSWqoOTI=; b=tkc0Ngltu/lBbAg2iu8hXvxgvkc+SPR+g48XCBRr3Uutv/QsjFo/z43KVICuTQHBDj jzvGnh8XrSEXqr7fXEwvYw3VzyiKM2aNp9ZbS7hdkle5jsMRJdjcPe4FESpoL+xY8o5n kI2EZxwVSyLkEDCs4wc6PRY1FkblPf63FFGI9bmSduE320Ra12pFXQa901/3JFIz+fVn 0rAd7G3yFkPCd8kpVHICwA/C9E2f4pwFc7X9es3WkaIDxsBEf+4I5Fkl3EPpZ10VfId1 Y8ItUNYY6tEgsVdR8FTp1toCF03iPdpE6LnB9EqCRAXCtWIsvFdNzD59fodpCVz6DH/I 5KfQ== X-Gm-Message-State: APzg51BpYtoNGkmmngdyeFm3zxFyMcq6bG+WWCl5HwBwKPsuLyra4e/Q 1i3X40B3ix2IZ/U6MDSJXA3FBA== X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr18009258plb.108.1537041504411; Sat, 15 Sep 2018 12:58:24 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:e00c:94b8:58e8:8ffb? ([2601:646:c200:7429:e00c:94b8:58e8:8ffb]) by smtp.gmail.com with ESMTPSA id v19-v6sm15420019pgn.94.2018.09.15.12.58.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 12:58:22 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH net-next v3 01/17] asm: simd context helper API From: Andy Lutomirski X-Mailer: iPhone Mail (15G77) In-Reply-To: Date: Sat, 15 Sep 2018 12:58:21 -0700 Cc: kevin@guarana.org, Andrew Lutomirski , LKML , Netdev , David Miller , Greg Kroah-Hartman , Thomas Gleixner , Samuel Neves , linux-arch@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <61B4DFD6-9BB5-4B81-BD0E-ACF112EA8AF7@amacapital.net> References: <20180911010838.8818-1-Jason@zx2c4.com> <20180911010838.8818-2-Jason@zx2c4.com> <20180912061433.GA8484@ip-172-31-15-78> <20180913050301.GA26367@ip-172-31-15-78> To: "Jason A. Donenfeld" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 13, 2018, at 6:52 AM, Jason A. Donenfeld wrote: >=20 >> On Thu, Sep 13, 2018 at 7:03 AM Kevin Easton wrote: >> Yes. It's also how most get/put APIs already work in the kernel, eg >> kref_get/put (mostly because they tend to be 'getting/putting' an >> already-initialized object, though). >=20 > Right; in this case the object wouldn't be initialized yet, which > might defeat the purpose, since one advantage of the & way you > mentioned is _put modifies the context. >=20 > Andy - any opinions on this? The tl;dr is: >=20 > 1) what we have now: >=20 > simd_context_t simd_context =3D simd_get(); > for (item in items) { > do_something(item); > simd_context =3D simd_relax(simd_context); > } > simd_put(); >=20 > 2) what kevin is proposing: >=20 > simd_context_t simd_context; >=20 > simd_get(&simd_context); > for (item in items) { > do_something(item); > simd_relax(&simd_context); > } > simd_put(&simd_context); >=20 > I can see pros and cons of each approach. I have no strong opinion, except that, if you paint the bikeshed =E2=80=9Cpa= ss by value=E2=80=9D, then simd_get and simd_relax should probably have warn= _unused_result set.=