Re: [PATCH 2.6 1/5] tg3: Add basic register access function pointers
On Thu, Jul 28, 2005 at 10:33:12AM -0700, Michael Chan wrote: If on the other hand, tg3 is loaded on different chips all using different access function pointers, and there is steady and equal amount of traffic going through all these chips, I suppose the call destinations will no longer be predictable most of the time. But in this scenario, I doubt that conditional branches with direct calls will fare any better. I concur w/ that assessment. Combine that w/ the potential ugliness of profligate expansion of if...else if...else if...else if...else style branches, and I think using the function pointers is acceptable and probably preferrable. John -- John W. Linville [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2.6 1/5] tg3: Add basic register access function pointers
Michael Chan wrote: This patch adds the basic function pointers to do register accesses in the fast path. This was suggested by David Miller. The idea is that various register access methods for different hardware errata can easily be implemented with these function pointers and performance will not be degraded on chips that use normal register access methods. Is this theory, or it has been actually measured? In x86-based CPUs at least (the largest tg3 platform), branch prediction often prefers if (...) direct_func_1() else direct_func_2() to tp-func() For hot paths, branch prediction will almost always predict the correct path, without any need for deferenced, indirect jumps. The latter example may look more clean, but the former is probably faster in Real Life(tm). Jeff - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2.6 1/5] tg3: Add basic register access function pointers
From: Jeff Garzik [EMAIL PROTECTED] Date: Wed, 27 Jul 2005 23:44:51 -0400 In x86-based CPUs at least (the largest tg3 platform), branch prediction often prefers if (...) direct_func_1() else direct_func_2() to tp-func() Indirect function calls also kill cpus such as ia64, which cannot avoid the implicit branch prediction miss unless the function method target is prefetched several instruction groups before the call and gcc does not emit the necessary directives to achieve this even if it were possible. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2.6 1/5] tg3: Add basic register access function pointers
Jeff Garzik wrote: Is this theory, or it has been actually measured? In x86-based CPUs at least (the largest tg3 platform), branch prediction often prefers if (...) direct_func_1() else direct_func_2() to tp-func() For hot paths, branch prediction will almost always predict the correct path, without any need for deferenced, indirect jumps. The latter example may look more clean, but the former is probably faster in Real Life(tm). Not measured. But with so many different workaround methods (TG3_FLAG_MBOX_WRITE_REORDER, TG3_FLAG_TXD_MBOX_HWBUG, TG3_FLG2_ICH_WORKAROUND, TG3_FLAG_5701_REG_WRITE_BUG, etc), it's more like: if (...) direct_func_1() else if (...) direct_func_2() else if (...) direct_func_3() else direct_func_4() At some point I suspect the indirect function pointer method will become better. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2.6 1/5] tg3: Add basic register access function pointers
From: Michael Chan [EMAIL PROTECTED] Date: Wed, 27 Jul 2005 22:33:32 -0700 But with so many different workaround methods (TG3_FLAG_MBOX_WRITE_REORDER, TG3_FLAG_TXD_MBOX_HWBUG, TG3_FLG2_ICH_WORKAROUND, TG3_FLAG_5701_REG_WRITE_BUG, etc), it's more like: if (...) direct_func_1() else if (...) direct_func_2() else if (...) direct_func_3() else direct_func_4() At some point I suspect the indirect function pointer method will become better. That's a good point. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html