From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD478C43461 for ; Tue, 15 Sep 2020 22:05:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7505E20663 for ; Tue, 15 Sep 2020 22:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600207551; bh=RcX7srgKazxOFPGlCxfgFFi6K/03jNvn2kbyUwkVsRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dL0gUHLHIF24MPvKVVZrsp41XKT+1PrVh0l48AlPM6uzBok2GJ/mahLuVwgk8OZjg uiaudvVBH5uBUX/rKqGcwIcKjlckxjIBEm9Tv0jsgk1y8ePdOCwZ+XeX57SXeenGGa wg1tNtCjp3QhfacXB1aVv4k0MMwyL9B4DOqCaXE8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbgIOWFY (ORCPT ); Tue, 15 Sep 2020 18:05:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727987AbgIOU0w (ORCPT ); Tue, 15 Sep 2020 16:26:52 -0400 Received: from sx1.lan (c-24-6-56-119.hsd1.ca.comcast.net [24.6.56.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 936F32080C; Tue, 15 Sep 2020 20:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600201556; bh=RcX7srgKazxOFPGlCxfgFFi6K/03jNvn2kbyUwkVsRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QaBd8SZRoZCh5XYtQ/cI/14tDp1JHFZavbZ5Cx3icGypwBOh9uLpUOXCliBRuePTe woapDHbEt2R87ktSBD5Y+78rmI60GPoHGTH2x24iMVXhMKIp/AitprC0oBjCr+wFWR UZwzmfDp/QDfUFVXDV6Ik5Rl345QzYyJIi+xGY44= From: saeed@kernel.org To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Saeed Mahameed Subject: [net-next 06/16] net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow Date: Tue, 15 Sep 2020 13:25:23 -0700 Message-Id: <20200915202533.64389-7-saeed@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200915202533.64389-1-saeed@kernel.org> References: <20200915202533.64389-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha Before calling timecounter_cyc2time(), clock->lock must be taken. Use mlx5_timecounter_cyc2time instead which guarantees a safe access. Fixes: afc98a0b46d8 ("net/mlx5: Update ptp_clock_event foreach PPS event") Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index f8465e42b238..7fc59e01a353 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -557,8 +557,9 @@ static int mlx5_pps_event(struct notifier_block *nb, switch (clock->ptp_info.pin_config[pin].func) { case PTP_PF_EXTTS: ptp_event.index = pin; - ptp_event.timestamp = timecounter_cyc2time(&clock->tc, - be64_to_cpu(eqe->data.pps.time_stamp)); + ptp_event.timestamp = + mlx5_timecounter_cyc2time(clock, + be64_to_cpu(eqe->data.pps.time_stamp)); if (clock->pps_info.enabled) { ptp_event.type = PTP_CLOCK_PPSUSR; ptp_event.pps_times.ts_real = -- 2.26.2