x86, UV: BAU performance and error recovery
Subsystems (2)
PATCH v3 1/1 x86, UV: BAU performance and error recovery
Ingo,
This patch updates the patch of the same name, which is in your lastest -tip
b8f7fb1: x86, UV: Improve BAU performance and error recovery
It does not depend on any other patch.
This patch
- corrects several bugs:
o the lack of BAU messaging to blade 0 (an uninitialized field)
o correct message type for a normal shootdown message
o fix to recovery from timed-out s/w acknowledge resources
o calculation of the actual destination timeout so that a 'short' timeout can be identified
o fix mishandling of non-consecutive hub and socket numbers
o identification of a cpu's socket number
o removal of the check for the h/w stay-busy bug, as under extreme pressure it cannot be accurately detected
o fall back to IPI-method when extreme pressure makes numalink very slow, and then resume BAU-method after an interval
- adds BAU broadcasting to the cpu's on the local node
- simplifies the returning of the original cpu bitmap when the BAU attempt is given up entirely
- adds modification of tuning variables through /proc/sgi_uv
Diffed against 2.6.34 -tip (Sheep on Meth)
--- arch/x86/include/asm/uv/uv_bau.h | 154 +++++-- arch/x86/kernel/tlb_uv.c | 760 +++++++++++++++++++++++++++++---------- 2 files changed, 685 insertions(+), 229 deletions(-)
arch/x86/include/asm/uv/uv_bau.h +105 -49
@@ -34,6 +34,7 @@*/ #define UV_ITEMS_PER_DESCRIPTOR 8 +/* the 'throttle' to prevent the hardware stay-busy bug */ #define MAX_BAU_CONCURRENT 3#define UV_CPUS_PER_ACT_STATUS 32#define UV_ACT_STATUS_MASK 0x3
@@ -45,10 +46,24 @@#define UV_DESC_BASE_PNODE_SHIFT 49#define UV_PAYLOADQ_PNODE_SHIFT 49#define UV_PTC_BASENAME "sgi_uv/ptc_statistics" +#define UV_BAU_BASENAME "sgi_uv/bau_tunables" +#define WHITESPACE " \t\n"#define uv_physnodeaddr (x) ((__pa((unsigned long)(x)) & uv_mmask))#define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16 -#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL +#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x0000000009UL +/* [19:16] SOFT_ACK timeout period 19: 1 is urgency 7 17:16 1 is multiplier */ +#define BAU_MISC_CONTROL_MULT_MASK 3 + +#define UVH_AGING_PRESCALE_SEL 0x000000b000UL +/* [30:28] URGENCY_7 an index into a table of times */ +#define BAU_URGENCY_7_SHIFT 28 +#define BAU_URGENCY_7_MASK 7 + +#define UVH_TRANSACTION_TIMEOUT 0x000000b200UL +/* [45:40] BAU - BAU transaction timeout select - a multiplier */ +#define BAU_TRANS_SHIFT 40 +#define BAU_TRANS_MASK 0x3f/* * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1
@@ -59,24 +74,21 @@#define DESC_STATUS_SOURCE_TIMEOUT 3/* -* source side threshholds at which message retries print a warning +* delay for 'plugged' timeout retries, in microseconds */ -#define SOURCE_TIMEOUT_LIMIT 20 -#define DESTINATION_TIMEOUT_LIMIT 20 - -/* -* misc. delays, in microseconds -*/ -#define THROTTLE_DELAY 10 -#define TIMEOUT_DELAY 10 -#define BIOS_TO 1000 -/* BIOS is assumed to set the destination timeout to 1003520 nanoseconds */ +#define PLUGGED_DELAY 10/* * threshholds at which to use IPI to free resources */ +/* after this # consecutive 'plugged' timeouts, use IPI to release resources */ #define PLUGSB4RESET 100 -#define TIMEOUTSB4RESET 100 +/* after this many consecutive timeouts, use IPI to release resources */ +#define TIMEOUTSB4RESET 1 +/* at this number uses of IPI to release resources, giveup the request */ +#define IPI_RESET_LIMIT 1 +/* after this # consecutive successes, bump up the throttle if it was lowered */ +#define COMPLETE_THRESHOLD 5/* * number of entries in the destination side payload queue
@@ -96,6 +108,13 @@#define FLUSH_COMPLETE 4/* +* tuning the action when the numalink network is extremely delayed +*/ +#define CONGESTED_RESPONSE_US 1000/* 'long' response time, in microseconds */ +#define CONGESTED_REPS 10/* long delays averaged over this many broadcasts */ +#define CONGESTED_PERIOD 30/* time for the bau to be disabled, in seconds */ + +/* * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor) * If the 'multilevel' flag in the header portion of the descriptor * has been set to 0, then endpoint multi-unicast mode is selected.
@@ -300,37 +319,16 @@ struct bau_payload_queue_entry {/* bytes 24-31 */ }; -/* -* one per-cpu; to locate the software tables -*/ -struct bau_control { -struct bau_desc *descriptor_base; +struct msg_desc { +struct bau_payload_queue_entry *msg; +int msg_slot; +int sw_ack_slot;struct bau_payload_queue_entry *va_queue_first;struct bau_payload_queue_entry *va_queue_last; -struct bau_payload_queue_entry *bau_msg_head; -struct bau_control *uvhub_master; -struct bau_control *socket_master; -unsigned long timeout_interval; -atomic_t active_descriptor_count; -int max_concurrent; -int max_concurrent_constant; -int retry_message_scans; -int plugged_tries; -int timeout_tries; -int ipi_attempts; -int conseccompletes; -short cpu; -short uvhub_cpu; -short uvhub; -short cpus_in_socket; -short cpus_in_uvhub; -unsigned short message_number; -unsigned short uvhub_quiesce; -short socket_acknowledge_count[DEST_Q_SIZE ]; -cycles_t send_message; -spinlock_t masks_lock; -spinlock_t uvhub_lock; -spinlock_t queue_lock; +}; + +struct reset_args { +int sender; };/*
@@ -344,18 +342,25 @@ struct ptc_stats {unsigned long s_dtimeout;/* destination side timeouts */ unsigned long s_time;/* time spent in sending side */ unsigned long s_retriesok;/* successful retries */ -unsigned long s_ntargcpu;/* number of cpus targeted */ -unsigned long s_ntarguvhub;/* number of uvhubs targeted */ -unsigned long s_ntarguvhub16;/* number of times >= 16 target hubs */ -unsigned long s_ntarguvhub8;/* number of times >= 8 target hubs */ -unsigned long s_ntarguvhub4;/* number of times >= 4 target hubs */ -unsigned long s_ntarguvhub2;/* number of times >= 2 target hubs */ -unsigned long s_ntarguvhub1;/* number of times == 1 target hub */ +unsigned long s_ntargcpu;/* total number of cpu's targeted */ +unsigned long s_ntargself;/* times the sending cpu was targeted */ +unsigned long s_ntarglocals;/* targets of cpus on the local blade */ +unsigned long s_ntargremotes;/* targets of cpus on remote blades */ +unsigned long s_ntarglocaluvhub;/* targets of the local hub */ +unsigned long s_ntargremoteuvhub;/* remotes hubs targeted */ +unsigned long s_ntarguvhub;/* total number of uvhubs targeted */ +unsigned long s_ntarguvhub16;/* number of times target hubs >= 16*/ +unsigned long s_ntarguvhub8;/* number of times target hubs >= 8 */ +unsigned long s_ntarguvhub4;/* number of times target hubs >= 4 */ +unsigned long s_ntarguvhub2;/* number of times target hubs >= 2 */ +unsigned long s_ntarguvhub1;/* number of times target hubs == 1 */ unsigned long s_resets_plug;/* ipi-style resets from plug state */ unsigned long s_resets_timeout;/* ipi-style resets from timeouts */ unsigned long s_busy;/* status stayed busy past s/w timer */ unsigned long s_throttles;/* waits in throttle */ unsigned long s_retry_messages;/* retry broadcasts */ +unsigned long s_bau_reenabled;/* for bau enable/disable */ +unsigned long s_bau_disabled;/* for bau enable/disable */ /* destination statistics */ unsigned long d_alltlb;/* times all tlb's on this cpu were flushed */ unsigned long d_onetlb;/* times just one tlb on this cpu was flushed */
@@ -368,6 +373,57 @@ struct ptc_stats {unsigned long d_nocanceled;/* retries that found nothing to cancel */ unsigned long d_resets;/* number of ipi-style requests processed */ unsigned long d_rcanceled;/* number of messages canceled by resets */ +unsigned long s_ipis; +unsigned long s_ipitime; +}; + +/* +* one per-cpu; to locate the software tables +*/ +struct bau_control { +struct bau_desc *descriptor_base; +struct bau_payload_queue_entry *va_queue_first; +struct bau_payload_queue_entry *va_queue_last; +struct bau_payload_queue_entry *bau_msg_head; +struct bau_control *uvhub_master; +struct bau_control *socket_master; +struct ptc_stats *statp; +unsigned long timeout_interval; +unsigned long set_bau_on_time; +atomic_t active_descriptor_count; +int plugged_tries; +int timeout_tries; +int ipi_attempts; +int conseccompletes; +int nobau; +int bauon; +int recovery; +int baudisabled; +int set_bau_off; +short cpu; +short uvhub_cpu; +short uvhub; +short cpus_in_socket; +short cpus_in_uvhub; +unsigned short message_number; +unsigned short uvhub_quiesce; +short socket_acknowledge_count[DEST_Q_SIZE ]; +cycles_t send_message; +spinlock_t uvhub_lock; +spinlock_t queue_lock; +/* tunables */ +int max_bau_concurrent; +int max_bau_concurrent_constant; +int plugged_delay; +int plugsb4reset; +int timeoutsb4reset; +int ipi_reset_limit; +int complete_threshold; +int congested_response_us; +int congested_reps; +int congested_period; +cycles_t period_time; +long period_requests; };static inline int bau_uvhub_isset (int uvhub,struct bau_target_uvhubmask *dstp)
arch/x86/kernel/tlb_uv.c +580 -180
1,151 lines not on this page · raw message
H. Peter Anvin
reviewerQuoted 1 line · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uv
Adding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
The other thing, please don't mix bug fixes and new features. They should be separate features.
-hpa
Quoted 8 lines · H. Peter Anvin
Quoted 1 line · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
Quoted 10 lines · Greg KH
Quoted 8 lines · H. Peter Anvin
Quoted 1 line · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Quoted 7 lines
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
There is an SGI-specific directory in sysfs: /sys/firmware/sgi_uv though the tuning variables for the handling of the hardware Broadcast Assist Unit don't fit there very logically.
The BAU's statistics are already displayed through the UV-only /proc/sgi_uv/ptc_statistics. This was deemed necessary because of the potentially very large size of that file --- it is still true that a /sys file is limited to one page, is it not? We wanted to minimize the overhead of the monitoring tools that read those statistics.
And the BAU tuning is related to those statistics. That's why I chose to put them along side, in /proc/sgi_uv/bau_tunables.
Even though it is a very small file.
Does that logic hold any water?
-Cliff
Signature · 4 lines
Cliff Wickman SGI [email protected] (651) 683-3824
Quoted 20 lines · Cliff Wickman
Quoted 10 lines · Greg KH
Quoted 8 lines · H. Peter Anvin
Quoted 1 line · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Quoted 7 lines
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
Quoted 8 lines
There is an SGI-specific directory in sysfs:
/sys/firmware/sgi_uvthough the tuning variables for the handling of the hardware Broadcast Assist Unit don't fit there very logically.The BAU's statistics are already displayed through the UV-only
/proc/sgi_uv/ptc_statistics. This was deemed necessary because of the potentially very large size of that file --- it is still true that a /sys file is limited to one page, is it not?
It is limited to one single value, which would never be larger than a page, so yes, it is limited to one page.
What kind of information are you showing here? Should this thing just be in debugfs instead? You can do whatever you want there.
thanks,
greg k-h
Quoted 33 lines · Greg KH
Quoted 20 lines · Cliff Wickman
Quoted 10 lines · Greg KH
Quoted 8 lines · H. Peter Anvin
Quoted 1 line · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Quoted 7 lines
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
Quoted 8 lines
There is an SGI-specific directory in sysfs:
/sys/firmware/sgi_uvthough the tuning variables for the handling of the hardware Broadcast Assist Unit don't fit there very logically.The BAU's statistics are already displayed through the UV-only
/proc/sgi_uv/ptc_statistics. This was deemed necessary because of the potentially very large size of that file --- it is still true that a /sys file is limited to one page, is it not?It is limited to one single value, which would never be larger than a page, so yes, it is limited to one page.
Quoted 6 lines
What kind of information are you showing here? Should this thing just be in debugfs instead? You can do whatever you want there.
thanks,
greg k-h
/proc/sgi_uv/bau_tunables would be a read/write file to display and change nine threshold and delay values for tuning the BAU driver.
I like debugfs, except that a distro may not build the kernel with it configured on. The tunables should be available as administrative options on a customer kernel, not just as a development tool.
And in our case the distros are already building with other such writable options in /proc/sgi_uv. We'd like to postpone a wholesale move of such options (assuming there will be some better place) and stay with the existing location for this release.
I know we (the community) would like to move non-process info out of /proc. It seems to me that we need a similar filesystem for large and/or administrative files. That's my perspective.
-Cliff
Signature · 4 lines
Cliff Wickman SGI [email protected] (651) 683-3824
Quoted 57 lines · Cliff Wickman
Quoted 36 lines · Greg KH
Quoted 22 lines · Cliff Wickman
Quoted 12 lines · Greg KH
Quoted 10 lines · H. Peter Anvin
Quoted 2 lines · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Quoted 8 lines
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
Quoted 9 lines
There is an SGI-specific directory in sysfs:
/sys/firmware/sgi_uvthough the tuning variables for the handling of the hardware Broadcast Assist Unit don't fit there very logically.The BAU's statistics are already displayed through the UV-only
/proc/sgi_uv/ptc_statistics. This was deemed necessary because of the potentially very large size of that file --- it is still true that a /sys file is limited to one page, is it not?It is limited to one single value, which would never be larger than a page, so yes, it is limited to one page.
Quoted 7 lines
What kind of information are you showing here? Should this thing just be in debugfs instead? You can do whatever you want there.
thanks,
greg k-h
/proc/sgi_uv/bau_tunableswould be a read/write file to display and change nine threshold and delay values for tuning the BAU driver.I like debugfs, except that a distro may not build the kernel with it configured on. The tunables should be available as administrative options on a customer kernel, not just as a development tool.
And in our case the distros are already building with other such writable options in
/proc/sgi_uv. We'd like to postpone a wholesale move of such options (assuming there will be some better place) and stay with the existing location for this release.
Quoted 6 lines
I know we (the community) would like to move non-process info out of /proc. It seems to me that we need a similar filesystem for large and/or administrative files. That's my perspective.
-Cliff
Would the similar filesystem you propose be backed by permanent storage, unlike /proc?
Quoted 60 lines · JD
Quoted 57 lines · Cliff Wickman
Quoted 36 lines · Greg KH
Quoted 22 lines · Cliff Wickman
Quoted 12 lines · Greg KH
Quoted 10 lines · H. Peter Anvin
Quoted 2 lines · Cliff Wickman
- adds modification of tuning variables through
/proc/sgi_uvAdding new directories in /proc for a proprietary architecture is frowned upon, to put it mildly. At the very least try to find a place in sysfs for it.
[Cc: gregkh in order to find a place in sysfs]
Quoted 8 lines
Hm, what type of files are you needing here? Do they corrispond with any specific hardware devices? If so, just put them on the hardware devices in sysfs.
thanks,
greg k-h
Quoted 9 lines
There is an SGI-specific directory in sysfs:
/sys/firmware/sgi_uvthough the tuning variables for the handling of the hardware Broadcast Assist Unit don't fit there very logically.The BAU's statistics are already displayed through the UV-only
/proc/sgi_uv/ptc_statistics. This was deemed necessary because of the potentially very large size of that file --- it is still true that a /sys file is limited to one page, is it not?It is limited to one single value, which would never be larger than a page, so yes, it is limited to one page.
Quoted 7 lines
What kind of information are you showing here? Should this thing just be in debugfs instead? You can do whatever you want there.
thanks,
greg k-h
/proc/sgi_uv/bau_tunableswould be a read/write file to display and change nine threshold and delay values for tuning the BAU driver.I like debugfs, except that a distro may not build the kernel with it configured on. The tunables should be available as administrative options on a customer kernel, not just as a development tool.
And in our case the distros are already building with other such writable options in
/proc/sgi_uv. We'd like to postpone a wholesale move of such options (assuming there will be some better place) and stay with the existing location for this release.
Quoted 8 lines
Quoted 6 lines
I know we (the community) would like to move non-process info out of /proc. It seems to me that we need a similar filesystem for large and/or administrative files. That's my perspective.
-Cliff
Would the similar filesystem you propose be backed by permanent storage, unlike /proc?
I withdraw my proposal for any new filesystem type, as debugfs works fine for what I'm talking about, as long as it is configured on by all the distributions.
No, a permanent storage backed filesystem was not what I had in mind.
Signature · 4 lines
Cliff Wickman SGI [email protected] (651) 683-3824
Quoted 6 lines · Cliff Wickman
/proc/sgi_uv/bau_tunableswould be a read/write file to display and change nine threshold and delay values for tuning the BAU driver.I like debugfs, except that a distro may not build the kernel with it configured on. The tunables should be available as administrative options on a customer kernel, not just as a development tool.
All distros have debugfs turned on now, and mounted, due to the perf interface there, as well as a lot of other good debug information that is present.
So you don't have to worry about that.
Quoted 4 lines
And in our case the distros are already building with other such writable options in
/proc/sgi_uv. We'd like to postpone a wholesale move of such options (assuming there will be some better place) and stay with the existing location for this release.
So because some distro took a non-upstream patch, you want upstream to accept the patch despite it being the incorrect place to put such a file? Heh, you might want to rethink that...
Quoted 1 line
I know we (the community) would like to move non-process info out of /proc.
Yes. We also don't want new files added there that are not dealing with processes.
Quoted 2 lines
It seems to me that we need a similar filesystem for large and/or administrative files. That's my perspective.
I do not know of any other such "large administrative" file that needs to be added to the system at such a time, becides this one, do you?
So please, just put it in debugfs.
thanks,
greg k-h
Quoted 8 lines · Greg KH
Quoted 6 lines · Cliff Wickman
/proc/sgi_uv/bau_tunableswould be a read/write file to display and change nine threshold and delay values for tuning the BAU driver.I like debugfs, except that a distro may not build the kernel with it configured on. The tunables should be available as administrative options on a customer kernel, not just as a development tool.
Quoted 5 lines
All distros have debugfs turned on now, and mounted, due to the perf interface there, as well as a lot of other good debug information that is present.
So you don't have to worry about that.
Good to hear. That makes the choice simple.
Quoted 1 line
...
Quoted 6 lines
So please, just put it in debugfs.
thanks,
greg k-h
Okay. I moved the file to debugfs, and will re-submit the patch momentarily.
-Cliff
Signature · 4 lines
Cliff Wickman SGI [email protected] (651) 683-3824