Skip to contentSkip to conversation

ipath - misc driver support code

PATCH Roland Dreier 2 participants 6 messages Mar 9, 2006 – Mar 10, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review

Quoted 13 lines
(quoted diff) +13 -0
+static unsigned handle_frequent_errors(struct ipath_devdata *dd,
+				       ipath_err_t errs, char msg[512],
+				       int *noprint)
+{
+	cycles_t nc;
+	static cycles_t nextmsg_time;
+	static unsigned nmsgs, supp_msgs;
+
+	/*
+	 * throttle back "fast" messages to no more than 10 per 5 seconds
+	 * (1.4-2GHz clock).  This isn't perfect, but it's a reasonable
+	 * heuristic. If we get more than 10, give a 5x longer delay
+	 */

Could this be replaced by printk_ratelimit()?

- R.

#2 lore raw
Quoted 5 lines · Roland Dreier

Review

Quoted 3 lines
(quoted diff) +3 -0
+static unsigned handle_frequent_errors(struct ipath_devdata *dd,
+				       ipath_err_t errs, char msg[512],
+				       int *noprint)

Could this be replaced by printk_ratelimit()?

I looked into doing that a few weeks ago, and it really didn't look like a good fit at all.

	<b
#3 lore raw
In reply to a message not in the archive
Quoted 4 lines
(quoted diff) +4 -0
+/**
+ * ipath_unordered_wc - indicate whether write combining is ordered
+ *
+ * Because our performance depends on our ability to do write combining mmio

Review

Quoted 10 lines
(quoted diff) +10 -0
+ * writes in the most efficient way, we need to know if we are on an Intel
+ * or AMD x86_64 processor.  AMD x86_64 processors flush WC buffers out in
+ * the order completed, and so no special flushing is required to get
+ * correct ordering.  Intel processors, however, will flush write buffers
+ * out in "random" orders, and so explict ordering is needed at times.
+ */
+int ipath_unordered_wc(void)
+{
+	return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
+}

This is kind of theoritical, but it seems to me that it would be safer to write this as

	int ipath_unordered_wc(void)
	{
		return boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
	}

after all, Via is probably going to have an x86-64 CPU one of these days, and I doubt you've checked that their WC flush is ordered.

- R.

#4 lore raw
Quoted 10 lines · Roland Dreier

This is kind of theoritical, but it seems to me that it would be safer to write this as

	int ipath_unordered_wc(void)
	{
		return boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
	}

after all, Via is probably going to have an x86-64 CPU one of these days, and I doubt you've checked that their WC flush is ordered.

It's purely a performance optimisation. Since we tune very closely to each CPU, there's no point right now in sort-of-tuning for a CPU that doesn't yet exist :-)

	<b
#5 lore raw

Bryan> It's purely a performance optimisation. Since we tune very Bryan> closely to each CPU, there's no point right now in Bryan> sort-of-tuning for a CPU that doesn't yet exist :-)

I thought that if ipath_unordered_wc() returns false then you assume the writes through a WC mapping go in order. If Via behaves like Intel and reorders writes, but ipath_unordered_wc() returns false, then won't your driver break in a subtle way?

- R.

#6 lore raw
Quoted 3 lines · Roland Dreier

If Via behaves like
Intel and reorders writes, but ipath_unordered_wc() returns false, then won't your driver break in a subtle way?

No, it'll issue lots of error messages, because the chip will detect the bad access patterns and interrupt us.

	<b