Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp268230yba; Wed, 15 May 2019 00:37:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2Dh7dSi/d1j5YBnUFZQu36RDLALh9JIqajr2LeHFK0EVfFh9L8XxFMXgn/fCxD5OfsK85 X-Received: by 2002:a17:902:7885:: with SMTP id q5mr42438076pll.12.1557905862741; Wed, 15 May 2019 00:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557905862; cv=none; d=google.com; s=arc-20160816; b=lvr5o0JQ827wmZfegahu08UkpX/zi3euQ/Z0W+fU/pBgielKHun4ScR1PQ9bm+TxMU rNLuw5J1Z4A5neiIgJ5auvZI+q5RvSX3QWsKrsTHW4p/aHmRF459z2jFhCNoKv0ptKvA 8TsHJziJGP0DwNxLUBLEr0TzzkAVL0hzbmdqPt1qQ4u/0JwKAfZEO4d4nnKoW3eVllvh wLBZ6mS/2ughnrQHHoz56fQwZRz1od7jkcxUghXmcI42+nfUnGO2qRTNNteeknh4K9Gd TWwcDV7Kosix/W5C3bS1CZKdtJTY8O0YJRLLY4GxaMABtpnxHTog92ealMcQIin4+F5n CfNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=6n0k/DOfSXPUPs6qYK5+autUkRQX+GLsSk+sDuHBK6Q=; b=b5oLToCxT4PZC6wOGadmUInOR9oe77sF7YOJ4zMbVdwfIZKq17eIVhjrScoj0Wfsqm gOCt9KX5PsJrkj6OKwPUY/9t85rAAbReHazoVUOpX9tnT9L6rKLL+iKHcZdJzCdt6M2k urWML1GZFtQVinFX1563H+12J+4Gx8YOAc6HFgR6FlJEQJ4mM2nowUm4IZmRoV2TvQjb MkXw4FozVJjeT0VrkOVWQuqukthGe0uvnZDdf2znVGLyqIeZOXnBSoRkP5hBt4Cn17Jd Fr8l2nVNM73Iw8MX/K1nyzFST14bBUn86blPPJ32puNDfv9+01gsH8wL3INFDL3amSNU xEAg== ARC-Authentication-Results: i=1; mx.google.com; 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 t3si1130116pgv.447.2019.05.15.00.37.27; Wed, 15 May 2019 00:37:42 -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; 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 S1726410AbfEOHfB (ORCPT + 99 others); Wed, 15 May 2019 03:35:01 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43211 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726032AbfEOHfB (ORCPT ); Wed, 15 May 2019 03:35:01 -0400 Received: by mail-qt1-f195.google.com with SMTP id i26so279807qtr.10 for ; Wed, 15 May 2019 00:35:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6n0k/DOfSXPUPs6qYK5+autUkRQX+GLsSk+sDuHBK6Q=; b=EOCtLZP0keg8xYpvw2DxffGZxVROcdT9nbI1lEwcvZQBRyPfrsC1SFhdP02RQgyR2A inn5McuSJqxb822IZJmWMeyodim5v8qvOn1uPJbtLSkUrFqKC2AjTr2H8Von5RqGXYs5 fAGm4O7zuCXeQmfsV1HGXi9d0GEWp+mlWumL9VZmY9Z7SZ6hRW7larmdbl0yfPCM+/X0 He2as5AB+SMbIj14AmaDazpTNbCqv1QETYmZP3fq5RpAzQs2+O9zEyjqnyN2EB31or0r 06Tg5TLAnGo23RXEsA0m/sewoVSi6A5t9AoAGZxLOAgWekhSoD6Y6P5AxK+7f2f0hUjA Ordg== X-Gm-Message-State: APjAAAWQ1fUa4Sn+b9i8y0fjeadYej5DwW7MvlLEQHecMITAzEgiL7Os w08cruD4s7VQsMuPLTw4o+oVRXBZAIfGnZp1aFY= X-Received: by 2002:a0c:980b:: with SMTP id c11mr32876068qvd.115.1557905700248; Wed, 15 May 2019 00:35:00 -0700 (PDT) MIME-Version: 1.0 References: <20190512012508.10608-1-elder@linaro.org> <20190512012508.10608-10-elder@linaro.org> In-Reply-To: <20190512012508.10608-10-elder@linaro.org> From: Arnd Bergmann Date: Wed, 15 May 2019 09:34:44 +0200 Message-ID: Subject: Re: [PATCH 09/18] soc: qcom: ipa: GSI transactions To: Alex Elder Cc: David Miller , Bjorn Andersson , Ilias Apalodimas , syadagir@codeaurora.org, mjavid@codeaurora.org, evgreen@chromium.org, benchan@google.com, ejcaruso@google.com, abhishek.esse@gmail.com, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static void gsi_trans_tre_fill(struct gsi_tre *dest_tre, dma_addr_t addr, > + u32 len, bool last_tre, bool bei, > + enum ipa_cmd_opcode opcode) > +{ > + struct gsi_tre tre; > + > + tre.addr = cpu_to_le64(addr); > + tre.len_opcode = gsi_tre_len_opcode(opcode, len); > + tre.reserved = 0; > + tre.flags = gsi_tre_flags(last_tre, bei, opcode); > + > + *dest_tre = tre; /* Write TRE as a single (16-byte) unit */ > +} Have you checked that the atomic write is actually what happens here, but looking at the compiler output? You might need to add a 'volatile' qualifier to the dest_tre argument so the temporary structure doesn't get optimized away here. > +/* Cancel a channel's pending transactions */ > +void gsi_channel_trans_cancel_pending(struct gsi_channel *channel) > +{ > + struct gsi_trans_info *trans_info = &channel->trans_info; > + u32 evt_ring_id = channel->evt_ring_id; > + struct gsi *gsi = channel->gsi; > + struct gsi_evt_ring *evt_ring; > + struct gsi_trans *trans; > + unsigned long flags; > + > + evt_ring = &gsi->evt_ring[evt_ring_id]; > + > + spin_lock_irqsave(&evt_ring->ring.spinlock, flags); > + > + list_for_each_entry(trans, &trans_info->pending, links) > + trans->result = -ECANCELED; > + > + list_splice_tail_init(&trans_info->pending, &trans_info->complete); > + > + spin_unlock_irqrestore(&evt_ring->ring.spinlock, flags); > + > + spin_lock_irqsave(&gsi->spinlock, flags); > + > + if (gsi->event_enable_bitmap & BIT(evt_ring_id)) > + gsi_event_handle(gsi, evt_ring_id); > + > + spin_unlock_irqrestore(&gsi->spinlock, flags); > +} That is a lot of irqsave()/irqrestore() operations. Do you actually call all of these functions from hardirq context? Arnd