Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp267331pxj; Thu, 3 Jun 2021 06:16:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye8d73cgE4nZjameiRB4MRzM7oymUFIKeYyROAjG+zTN+GOPSQBeHSTWjaVv/kLgXCxqEE X-Received: by 2002:a05:6402:524b:: with SMTP id t11mr10546209edd.327.1622726210931; Thu, 03 Jun 2021 06:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622726210; cv=none; d=google.com; s=arc-20160816; b=NC6IfEK83IpVfvm56g5mvr6z5C01ZpXjzFh1/ADnpR5Hqon/cQTwRot9Z8OfG8A376 sP5EqN64ouDWVwFuruOf6OLuEF254drNXyeIS0OGt0kMe324B0g5PA233F0+3TjC9ATB 0Ch37hqMvIEouw5ipQQ5nIU2Uo3DyiT/Br+LaRpy+R8RoVYFhqoRKYHG3QbUmGMctLoL 91ww2vZpRqTjG2Tv4ocJV2rTnddS55DSzA3dtTT4iwB7Dmh1vl9ytib1yV4toHMVrnF0 TxbRESeNqJ5/Ly9lP0CWxTGfyG9SeCRyxI+SQjwm+ltXPXLUY3U98dhuCc0YmQR9om/y EqwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fBZJTdUeyr2PC5gYyTUryXoQTSj7Qok3gQumRrIu0a0=; b=hoinQ9FKSnabkJJeXOgUiIUCX5mvvNm8PvP1mnIy5K8c7WpVA4cjMG+1u8N4C81uQI NHwEbqOVDw9gwPBJ9xsXHueKylld3eJUH84J4JYvt54KrpFZX24oz9ev6xHjs/OzAMWl BJXw/nTtA8zSfNjVA5rFleA3VDf1RLtkUq/fIeffr6jO5Q+RG+Z/S3+KFy1cbqizsHi5 eo4VdCdSgCdNHxZ+B5RYkxbb0zeNEmBLPBEHq8D1BZmrw58HKuWT3hE9bl8ynt/Uw2wm RLQXxBW6nEX++Kg9y2t1eVpHor9znxMciT+PXx4j3YryWRc/3r1ITIEenQhyqZzSaMll Ih7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HLmHLeJH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si2408419ejl.414.2021.06.03.06.16.28; Thu, 03 Jun 2021 06:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HLmHLeJH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbhFCNQz (ORCPT + 99 others); Thu, 3 Jun 2021 09:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbhFCNQy (ORCPT ); Thu, 3 Jun 2021 09:16:54 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AE2CC06174A; Thu, 3 Jun 2021 06:14:56 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id x73so4846237pfc.8; Thu, 03 Jun 2021 06:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fBZJTdUeyr2PC5gYyTUryXoQTSj7Qok3gQumRrIu0a0=; b=HLmHLeJHhkSy2M1T5etFZSNqo3xvPd1u7R7Sa3lutKP4bDGIzQ2bPe1juOmclArj7M xW3iZw7ylIMBV8KjRJDHpJVw3ERQwORmDIQjvmdRi1ujVsDrZkguyihpsdyzy1GtLSAl oT95JVI8XG1BC8mvk1LPu3hCB5Vv6oMYtjCPwIDNUaAACOGJ4gl6tmf6jXISQYX1aKZb 676iI19Cfod9pghrn5Pey4UbdJTMMDMMXNTrr3nw4cVrkGCdNb8JWpD91cuxDM6Qme1L yVx4tffFMm90E7GLDMHU/Nyi49Po3fSB6fWLpYjhvDskJ2n9C9Qoyjv0pGYEWJFxmHFE ykyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fBZJTdUeyr2PC5gYyTUryXoQTSj7Qok3gQumRrIu0a0=; b=Ag2WI/bVpP42Kl7T04pNeOEEkCVoxBDMXIMWVVRPMu56xN1VpGa3maPomXrUhiBIXd QES67rcBfzEvhqW3UrUXxOvRFoLOc+l7GJvgXdlgHKZnyML/LVlNzw7jgX1Izet5cVbs Co8TlKGEqjpB0arv6VQ+YiJDMeNoLQ0Mttd67oK6DRe7AMUmYR2YMeL6zAOYyN5bFd9P LlKUx3pVE9nFikq6toUxctiAwLLX+W7l7gb6VM9PU2Qm1zyPmMMxQdpAWmp0/op1YRnO QQAJuhEkarq4hvd618ai29g6+HRJLvVpQB7GkHCa3Ae5spqWa5OqxrWpHBfJX+m5pMhD VSqw== X-Gm-Message-State: AOAM532x04QHKecnYM2fjlaPONfRPE26CfJ4WLI45M1QJGjlJVIAOxD0 ay1VQCgGE4s2m+OX9tsBjjs= X-Received: by 2002:a62:3344:0:b029:24c:735c:4546 with SMTP id z65-20020a6233440000b029024c735c4546mr32657627pfz.1.1622726095612; Thu, 03 Jun 2021 06:14:55 -0700 (PDT) Received: from hoboy.vegasvil.org ([2601:645:c000:35:e2d5:5eff:fea5:802f]) by smtp.gmail.com with ESMTPSA id y27sm633117pff.202.2021.06.03.06.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 06:14:55 -0700 (PDT) Date: Thu, 3 Jun 2021 06:14:52 -0700 From: Richard Cochran To: Guangbin Huang Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, salil.mehta@huawei.com, lipeng321@huawei.com, tanhuazhong@huawei.com Subject: Re: [RESEND net-next 1/2] net: hns3: add support for PTP Message-ID: <20210603131452.GA6216@hoboy.vegasvil.org> References: <1622602664-20274-1-git-send-email-huangguangbin2@huawei.com> <1622602664-20274-2-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622602664-20274-2-git-send-email-huangguangbin2@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 02, 2021 at 10:57:43AM +0800, Guangbin Huang wrote: > @@ -4342,12 +4352,34 @@ static void hclge_periodic_service_task(struct hclge_dev *hdev) > hclge_task_schedule(hdev, delta); > } > > +static void hclge_ptp_service_task(struct hclge_dev *hdev) > +{ > + if (!test_bit(HCLGE_STATE_PTP_EN, &hdev->state) || > + !test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state) || > + !time_is_before_jiffies(hdev->ptp->tx_start + HZ)) > + return; > + > + /* to prevent concurrence with the irq handler, disable vector0 > + * before handling ptp service task. > + */ > + disable_irq(hdev->misc_vector.vector_irq); This won't work. After all, the ISR thread might already be running. Use a proper spinlock instead. > + /* check HCLGE_STATE_PTP_TX_HANDLING here again, since the irq > + * handler may handle it just before disable_irq(). > + */ > + if (test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state)) > + hclge_ptp_clean_tx_hwts(hdev); > + > + enable_irq(hdev->misc_vector.vector_irq); > +} Thanks, Richard