lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131226144908.GA4360@netboy>
Date:	Thu, 26 Dec 2013 15:49:08 +0100
From:	Richard Cochran <richardcochran@...il.com>
To:	Hadar Hen-Zion <hadarh@....mellanox.co.il>
Cc:	Shawn Bohrer <shawn.bohrer@...il.com>,
	Tom Ketterhagen <tomk@...advisors.com>,
	netdev <netdev@...r.kernel.org>, Amir Vadai <amirv@...lanox.com>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Hadar Hen Zion <hadarh@...lanox.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next 1/2] mlx4_en: Add PTP hardware clock

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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ