From patchwork Fri Feb 4 15:24:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54CE9C433F5 for ; Fri, 4 Feb 2022 15:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6PqkztiJDxBqM18Gp+MfcuH5bJHKb7OZRKHfYdhPh9s=; b=hNuIWAxpsJK11z pYN2BGYrac3pHNy8xKGvvRyI/prz2lnsieIljw79LZJLT1GnLkvjFhoGRUrpjI4G0SJ7RBD2s1tV6 Tx4ZnTHoXQSsAVNgtj7ppsMFMJQjkX8ZsR3lrVwlpVw6bLHBr9FuMkLK0ap1e8JV3g+lkSl8aMPup dw1+XOoktF4JZ337tyU4rgoPX+P8NCCee0FMGvhlSgyUXT7NoFNo+M+5ZAhzZwurK70Au2cQec7jU 7eF9clA7M/4Q48v9WE3EV7xdSrO2/43Smw025cisBoc8xtmXIIN7u8NjA/4GWChmN6KMt2tU8pBEJ GWgZS0EnPmFAKYGtXwfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG0Ry-004ipV-U4; Fri, 04 Feb 2022 15:24:39 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG0Rn-004il8-Fp for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 15:24:28 +0000 Received: by mail-pl1-x62a.google.com with SMTP id h14so5434787plf.1 for ; Fri, 04 Feb 2022 07:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JBlM0fJPQdFbfZELyfGYDQMeIzp3LQS6pQHkYWuX8+E=; b=X9dUcNLOw092RvHVzkfzPS1gNBOrhNzF4xP71iXtrHvkaRqW2nTuThJXpAcz9y5B21 KoV9pnCaOh6YgT4o7+Hk2oENdB/GVyt6M6ugQWjUaLweghTWLCEv+i9+sBROt0qDm3wi poTuVRo4c0uG35TNM6PRmkT7dbUapI1Gn4N57UgrgD9yVv32iU/SljKcpp7QSoSnNtfu pXgtq+gWqvrWtfloS0/DLtPmN3qC3EbgWwh3jgLie39wUsb6Yc2Ion/ziNS6P5ANwE/c IBAr5gY4ZnFwRzxzbgKniEs+mPRr+T6M26MnrCGOJ2swBPjo6j1gSK4nvi1w56MKIdu/ Z92Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JBlM0fJPQdFbfZELyfGYDQMeIzp3LQS6pQHkYWuX8+E=; b=kQeHPfHva3tAM7t8DsIH8lq5Q9RgoICasqPmFxuLigEZGhoCd5jH6Ij8IbXW4yzMzv aiQRs1DRDd+DbZxtLoRh+E/n20n9/IY1t4x3DX5gRKvJJfgy/l+brSmKjI5iR0IcCwrF bZqM6p0dRMk8fZLL4IdppgAS5zVDzuBX3brdzBhLisYB1yl4+ZB8QhTYeBqBTkEsMOEi vVAzA1Am/F8GVUj5AvHyAD/k3cxE3rveB61BDs69xTiCsUCihXnHqUHKAdtrawOmWhIC ldaNboOF36UGHPGSbYRtk27mkmBzsrKklezOeHdY5xKZsy/8Xq6nEiZm6zDvd+8VqWQE pY/g== X-Gm-Message-State: AOAM533ceRsr9Q2TS50Ci7rQylrtF77oStUd2RNJQO7Q7cuTG5clwGlt 7A6fTU/zmEvyr/ZNkgHA0OXA4g== X-Google-Smtp-Source: ABdhPJyIBnN4dkIRd9M9D8tgwp/n04tEKjszNC29r+PG9jVXxmyMTXPE0hth4JQKWyim1uTygPiS8w== X-Received: by 2002:a17:902:7893:: with SMTP id q19mr3768988pll.9.1643988266284; Fri, 04 Feb 2022 07:24:26 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id me4sm14237079pjb.26.2022.02.04.07.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 07:24:25 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 RESEND 1/4] coresight: etm4x: Add lock for reading virtual context ID comparator Date: Fri, 4 Feb 2022 23:24:00 +0800 Message-Id: <20220204152403.71775-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204152403.71775-1-leo.yan@linaro.org> References: <20220204152403.71775-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220204_072427_557172_C0535968 X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Updates to the values and the index are protected via the spinlock. Ensure we use the same lock to read the value safely. Signed-off-by: Leo Yan Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index 10ef2a29006e..2f3b4eef8261 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -2111,7 +2111,9 @@ static ssize_t vmid_val_show(struct device *dev, struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); struct etmv4_config *config = &drvdata->config; + spin_lock(&drvdata->spinlock); val = (unsigned long)config->vmid_val[config->vmid_idx]; + spin_unlock(&drvdata->spinlock); return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); }