All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Hadar Hen-Zion <hadarh@dev.mellanox.co.il>
Cc: Shawn Bohrer <shawn.bohrer@gmail.com>,
	Tom Ketterhagen <tomk@rgmadvisors.com>,
	netdev <netdev@vger.kernel.org>, Amir Vadai <amirv@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Hadar Hen Zion <hadarh@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next 1/2] mlx4_en: Add PTP hardware clock
Date: Thu, 26 Dec 2013 15:49:08 +0100	[thread overview]
Message-ID: <20131226144908.GA4360@netboy> (raw)
In-Reply-To: <20131226144111.GB12695@mtl-eit-vdi-41.mtl.labs.mlnx>

On Thu, Dec 26, 2013 at 04:41:11PM +0200, Hadar Hen-Zion wrote:

> +u64 mlx4_en_timecounter_read(struct mlx4_en_dev *mdev)
> +{
> +	struct timecounter *new_tc, *old_tc;
> +	unsigned long flags;
> +	s64 now;
> +
> +	new_tc = kmalloc(sizeof(*new_tc), GFP_KERNEL);

So you want to call malloc/free on every clock read?
That is crazy.

> +	spin_lock_irqsave(&mdev->clock_lock, flags);
> +	old_tc = mdev->clock;
> +	*new_tc = *old_tc;
> +	now = timecounter_read(new_tc);
> +	rcu_assign_pointer(mdev->clock, new_tc);
> +	spin_unlock_irqrestore(&mdev->clock_lock, flags);
> +	synchronize_rcu();
> +	kfree(old_tc);
> +
> +	return now;
> +}

Thanks,
Richard

  reply	other threads:[~2013-12-26 14:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 20:32 [PATCH net-next 0/2] mlx4_en: Add PTP support Shawn Bohrer
2013-12-17 20:32 ` [PATCH net-next 1/2] mlx4_en: Add PTP hardware clock Shawn Bohrer
2013-12-17 21:04   ` Or Gerlitz
2013-12-17 21:46     ` Shawn Bohrer
2013-12-18  7:59       ` Or Gerlitz
2013-12-18 15:03         ` Shawn Bohrer
2013-12-22 13:13   ` Hadar Hen Zion
2013-12-23 16:29     ` Shawn Bohrer
2013-12-23 16:59       ` Shawn Bohrer
2013-12-24 15:38         ` Hadar Hen Zion
2013-12-25 11:49           ` Richard Cochran
2013-12-23 18:48     ` Richard Cochran
2013-12-24 13:58       ` Hadar Hen Zion
2013-12-25 11:53         ` Richard Cochran
     [not found]           ` <CAKBbMu33zXkG4+S1kP6zB+4iKMNNoy=XVBtoqZZEkqurRsgvQw@mail.gmail.com>
2013-12-25 17:02             ` Richard Cochran
2013-12-26  8:26           ` Hadar Hen Zion
2013-12-26  8:33             ` Hadar Hen Zion
2013-12-26  9:17               ` Richard Cochran
2013-12-26 14:41                 ` Hadar Hen-Zion
2013-12-26 14:49                   ` Richard Cochran [this message]
2013-12-17 20:32 ` [PATCH net-next 2/2] mlx4_en: Only cycle port if HW timestamp config changes Shawn Bohrer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131226144908.GA4360@netboy \
    --to=richardcochran@gmail.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=hadarh@dev.mellanox.co.il \
    --cc=hadarh@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=shawn.bohrer@gmail.com \
    --cc=tomk@rgmadvisors.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.