Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp108719yba; Mon, 20 May 2019 05:52:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKr5AcIiCzWLwyeF7Psl7V5vprk9uWHluOClS40Yu6V8B89N/ktrl5EbzAgi/V3xtJI+O8 X-Received: by 2002:aa7:86c3:: with SMTP id h3mr78138486pfo.169.1558356741079; Mon, 20 May 2019 05:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356741; cv=none; d=google.com; s=arc-20160816; b=cG6Ho8w9R0YdPXqh6WK3p6wjD2nHa4GMdT8LLu0JBJqUWqRRGMOqwA3SWislfBQW2d krmLE+cRbPR0A+e7q28n+FDnuW/5ZiFe/Z6mprxHQacs3xsbJziIiT3WvGacUzrODTTo 3f9vS6nFtbw/qU31BeWs1fBpNTWo8Rp5wUa0Xtvk7w0LgZKNm2t0KgAKYrkNgo733qHh Woip38tw3u+iLxiZQl4fB2iKbQI0LDNcwPCYDK1xIFYy29Agvq8NSK1X8Nx4De9jpg2C Y2xyzRlvsVBi7pBGjsNv2syd6xtwu5OtzDKGPkJ96rz5qgRXpLOJQjCXMkFe/KMfw93N QCcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Qx87YI2gjVMlfmpnZTr12jvkaOAAGprsDuNFTZhY9mU=; b=ibUB1dGYGotPAH20r/4vhOw3Rs5VhLb/umafwIzTY4CO8x3F9u6EXOvr3bogJNdItp LIosI/Lk3OjjN+NjI1qJpke3d4J2yhZlzMOBxdx8T7BZVkm6a++DDWSc2goA1t214lNg ttqaCrffESJMu5zPVCUJBzBMNKM9GDcFpO8p8w0tLrkhpCeBOlR+To27VbthvJaXUE5s lAdOV92ZMpK5riKr/nIbW9Qvvq5p2Erqw4GUV6T346Pn936Ntp6b8vTYoEuHlX7R8SVY yI9wrSZxge9pCscTqga7dc4BktBldE2pX8SBWOk3FPNaC+SCVNKF1QifCrCnxz//pVlV Llsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lIwpRk82; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si17719507pgb.109.2019.05.20.05.52.06; Mon, 20 May 2019 05:52:21 -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=@linaro.org header.s=google header.b=lIwpRk82; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388557AbfETMu0 (ORCPT + 99 others); Mon, 20 May 2019 08:50:26 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:40416 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730404AbfETMuY (ORCPT ); Mon, 20 May 2019 08:50:24 -0400 Received: by mail-it1-f194.google.com with SMTP id h11so1244198itf.5 for ; Mon, 20 May 2019 05:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Qx87YI2gjVMlfmpnZTr12jvkaOAAGprsDuNFTZhY9mU=; b=lIwpRk82jVA169lGfPnbVTNNmG3yENbUfBAKq+tGpn8kWVNVKBNmGTnXt301hGMoJS kH+jQGss4CbbxeYSYpZ7IbzEbdhi/iFz0d2K65D9qCpunXtM+HlkmqnkJp9U4xI0H0iX TcUtQoc2d81L3velqghzct5aupzuvpjfhjdAGRg3iGDNEcQIyqLjOaAlJeQM/E0utx7E 1QojRPlj2tRGEvHtWzXvlIr2jOH12LfYpfnuZfZ5OX6mNmfD/XhyOe5Va/hCr9O7J31h kkFsMiS1/gTyAGrQJ17oKGupS8RVE2xFOX/J+AcpWiA0m3h9DnjVDvEjDF0zWYG0uh3u DvPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Qx87YI2gjVMlfmpnZTr12jvkaOAAGprsDuNFTZhY9mU=; b=VyewteQHnxfCWWm1MeGFNFr8T8BMcmSkWam+tcp90Ww1Nv8PTiMh8QNiXOpjDmqUAF k5zanMhqnAYe9wNpiDPv6x6B7nfRYqD0g3MMn+L/5tRnjhZZX6sVdelhXIPErDqKhq1O MtbJnj2Z78eKEXIEch0WJEe+eQXxjL1rJodIDJ+CZDe6JVgnEi0+pZqjqDm4mD58RyYr JrGoMoBckRoD2C4sojvOWu9gvVSq+AwYEgzUKvtGJ1BSXhK6dRLotc71l7nFQdXfTGQ1 UrHRJ2O4wul/FSJG8m434T1ZSlCU+aupb0vXWufln181MOE2Y15jcTFvvh9ZqG741nkH Q3Sg== X-Gm-Message-State: APjAAAXKJrR1//a255CDW0myqwK73j2Y1IE0tVIcIs+2GdJ/xoI8SmLr jjamHmeqqOw/BgjoDenPHz9rgGX5jR8= X-Received: by 2002:a05:660c:6c8:: with SMTP id z8mr29501887itk.51.1558356622660; Mon, 20 May 2019 05:50:22 -0700 (PDT) Received: from [172.22.22.26] (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.googlemail.com with ESMTPSA id 74sm4796440itk.3.2019.05.20.05.50.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 05:50:21 -0700 (PDT) Subject: Re: [PATCH 09/18] soc: qcom: ipa: GSI transactions To: Arnd Bergmann Cc: David Miller , Bjorn Andersson , Ilias Apalodimas , syadagir@codeaurora.org, mjavid@codeaurora.org, evgreen@chromium.org, Ben Chan , Eric Caruso , abhishek.esse@gmail.com, Linux Kernel Mailing List References: <20190512012508.10608-1-elder@linaro.org> <20190512012508.10608-10-elder@linaro.org> <14a040b6-8187-3fbc-754d-2e267d587858@linaro.org> <4a34d381-d31d-ea49-d6d3-3c4f632958e3@linaro.org> From: Alex Elder Message-ID: Date: Mon, 20 May 2019 07:50:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/19 4:25 AM, Arnd Bergmann wrote: > On Sun, May 19, 2019 at 7:11 PM Alex Elder wrote: >> On 5/17/19 1:44 PM, Alex Elder wrote: >>> On 5/17/19 1:33 PM, Arnd Bergmann wrote: >>>> On Fri, May 17, 2019 at 8:08 PM Alex Elder >> >> So it seems that I must *not* apply a volatile qualifier, >> because doing so restricts the compiler from making the >> single instruction optimization. > > Right, I guess that makes sense. > >> If I've missed something and you have another suggestion for >> me to try let me know and I'll try it. > > A memcpy() might do the right thing as well. Another idea would I find memcpy() does the right thing. > be a cast to __int128 like I find that my environment supports 128 bit integers. But... > #ifdef CONFIG_ARCH_SUPPORTS_INT128 > typedef __int128 tre128_t; > #else > typedef struct { __u64 a; __u64 b; } tre128_t; > #else > > static inline void set_tre(struct gsi_tre *dest_tre, struct gs_tre *src_tre) > { > *(volatile tre128_t *)dest_tre = *(tre128_t *)src_tre; > } ...this produces two 8-bit assignments. Could it be because it's implemented as two 64-bit values? I think so. Dropping the volatile qualifier produces a single "stp" instruction. The only other thing I thought I could do to encourage the compiler to do the right thing is define the type (or variables) to have 128-bit alignment. And doing that for the original simple assignment didn't change the (desirable) outcome, but I don't think it's really necessary in this case, considering the single instruction uses two 64-bit registers. I'm going to leave it as it was originally; it's the simplest: *dest_tre = tre; I added a comment about structuring the code this way with the intention of getting the single instruction. If a different compiler produces different result -Alex > > Arnd >