x86, UV: Shorten access to BAU statistics structure
[firefly-linux-kernel-4.4.55.git] / arch / x86 / include / asm / uv / uv_bau.h
index aa558ac0306e5859bc41863861cc5a1620cf0c1e..6a42d42eb8f9a1482285eb3d16491881a7dffc3d 100644 (file)
@@ -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
 #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 UV_BAU_TUNABLES_DIR            "sgi_uv"
+#define UV_BAU_TUNABLES_FILE           "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
 #define DESC_STATUS_DESTINATION_TIMEOUT        2
 #define DESC_STATUS_SOURCE_TIMEOUT     3
 
+#define TIMEOUT_DELAY                  10
 /*
- * source side threshholds at which message retries print a warning
- */
-#define SOURCE_TIMEOUT_LIMIT           20
-#define DESTINATION_TIMEOUT_LIMIT      20
-
-/*
- * misc. delays, in microseconds
+ * delay for 'plugged' timeout retries, 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
 #define FLUSH_GIVEUP                   3
 #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
@@ -310,15 +332,16 @@ struct bau_control {
        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 max_concurrent;
-       int max_concurrent_constant;
-       int retry_message_scans;
        int plugged_tries;
        int timeout_tries;
        int ipi_attempts;
        int conseccompletes;
+       int baudisabled;
+       int set_bau_off;
        short cpu;
        short uvhub_cpu;
        short uvhub;
@@ -331,6 +354,19 @@ struct bau_control {
        spinlock_t masks_lock;
        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;
 };
 
 /*
@@ -356,6 +392,8 @@ struct ptc_stats {
        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 */