Dump and restore PP config in upgrade path

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial 2019-09-10 16:26:50 +02:00
parent 0810df2a0e
commit bb1e554dac

View File

@ -66,6 +66,10 @@ bool cas_upgrade_is_in_upgrade(void)
* |core | core_X_path | string | * |core | core_X_path | string |
* |core | core_X_type | uint | * |core | core_X_type | uint |
* |------------|-------------------------------|---------------| * |------------|-------------------------------|---------------|
* |promotion | promotion_policy | uint |
* |promotion | nhit_insertion_threshold| uint |
* |promotion | nhit_insertion_trigger | uint |
* |------------|-------------------------------|---------------|
* |flush | flush_cleaning_policy | uint | * |flush | flush_cleaning_policy | uint |
* |flush | flush_wake_up_time | uint | * |flush | flush_wake_up_time | uint |
* |flush | flush_staleness_time | uint | * |flush | flush_staleness_time | uint |
@ -99,6 +103,10 @@ bool cas_upgrade_is_in_upgrade(void)
#define CORE_SEQ_CUTOFF_THRESHOLD_STR "core_%lu_seq_cutoff_thresh" #define CORE_SEQ_CUTOFF_THRESHOLD_STR "core_%lu_seq_cutoff_thresh"
#define CORE_SEQ_CUTOFF_POLICY_STR "core_%lu_seq_cutoff_policy" #define CORE_SEQ_CUTOFF_POLICY_STR "core_%lu_seq_cutoff_policy"
#define PROMOTION_POLICY_STR "promotion_policy"
#define PROMOTION_NHIT_INSERTION_STR "nhit_insertion_threshold"
#define PROMOTION_NHIT_TRIGGER_STR "nhit_trigger_threshold"
#define CLEANING_POLICY_STR "flush_cleaning_policy" #define CLEANING_POLICY_STR "flush_cleaning_policy"
#define CLEANING_ALRU_WAKEUP_TIME_STR "flush_wakeup_time" #define CLEANING_ALRU_WAKEUP_TIME_STR "flush_wakeup_time"
#define CLEANING_ALRU_STALENESS_TIME_STR "flush_staleness_time" #define CLEANING_ALRU_STALENESS_TIME_STR "flush_staleness_time"
@ -116,7 +124,8 @@ bool cas_upgrade_is_in_upgrade(void)
#define IO_CLASS_CACHE_MODE_STR "io_class_%lu_cache_mode" #define IO_CLASS_CACHE_MODE_STR "io_class_%lu_cache_mode"
#define CAS_UPGRADE_IFACE_VERSION_19_03_00 190300 #define CAS_UPGRADE_IFACE_VERSION_19_03_00 190300
#define CAS_UPGRADE_IFACE_CURRENT_VERSION CAS_UPGRADE_IFACE_VERSION_19_03_00 #define CAS_UPGRADE_IFACE_VERSION_19_09_00 190900
#define CAS_UPGRADE_IFACE_CURRENT_VERSION CAS_UPGRADE_IFACE_VERSION_19_09_00
static int _cas_upgrade_dump_cache_conf_main(ocf_cache_t cache, static int _cas_upgrade_dump_cache_conf_main(ocf_cache_t cache,
struct cas_properties *cache_props) struct cas_properties *cache_props)
@ -305,6 +314,72 @@ err:
return result; return result;
} }
static int _cas_upgrade_dump_cache_conf_promotion(ocf_cache_t cache,
struct cas_properties *cache_props)
{
uint32_t promotion_type = ocf_promotion_default;
uint32_t nhit_insertion_threshold;
uint32_t nhit_trigger_threshold;
int result = 0;
result = cache_mngt_get_promotion_policy(cache, &promotion_type);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT
"Unable to get promotion policy type\n");
return result;
}
if (promotion_type == ocf_promotion_nhit) {
result |= cache_mngt_get_promotion_param(cache,
ocf_nhit_insertion_threshold,
&nhit_insertion_threshold);
result |= cache_mngt_get_promotion_param(cache,
ocf_nhit_trigger_threshold,
&nhit_trigger_threshold);
}
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT
"Unable to get promotion policy params\n");
return result;
}
result = cas_properties_add_uint(cache_props, PROMOTION_POLICY_STR,
promotion_type, CAS_PROPERTIES_CONST);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT
"Error during adding promotion policy type\n");
return result;
}
if (promotion_type == ocf_promotion_nhit) {
result = cas_properties_add_uint(cache_props,
PROMOTION_NHIT_INSERTION_STR,
nhit_insertion_threshold,
CAS_PROPERTIES_CONST);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT
"Error during adding nhit insertion "
"threshold\n");
return result;
}
result = cas_properties_add_uint(cache_props,
PROMOTION_NHIT_TRIGGER_STR,
nhit_trigger_threshold,
CAS_PROPERTIES_CONST);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT
"Error during adding nhit trigger "
"threshold\n");
return result;
}
}
return result;
}
static int _cas_upgrade_dump_cache_conf_flush(ocf_cache_t cache, static int _cas_upgrade_dump_cache_conf_flush(ocf_cache_t cache,
struct cas_properties *cache_props) struct cas_properties *cache_props)
{ {
@ -315,6 +390,7 @@ static int _cas_upgrade_dump_cache_conf_flush(ocf_cache_t cache,
uint32_t alru_activity_threshold; uint32_t alru_activity_threshold;
uint32_t acp_thread_wakeup_time; uint32_t acp_thread_wakeup_time;
uint32_t acp_flush_max_buffers; uint32_t acp_flush_max_buffers;
int result = 0; int result = 0;
CAS_DEBUG_TRACE(); CAS_DEBUG_TRACE();
@ -586,6 +662,10 @@ static int _cas_upgrade_dump_cache_conf(ocf_cache_t device,
if (result) if (result)
return result; return result;
result = _cas_upgrade_dump_cache_conf_promotion(device, cache_props);
if (result)
return result;
result = _cas_upgrade_dump_cache_conf_io_class(device, cache_props); result = _cas_upgrade_dump_cache_conf_io_class(device, cache_props);
if (result) if (result)
return result; return result;
@ -1078,6 +1158,68 @@ static int _cas_upgrade_restore_conf_flush(struct cas_properties *cache_props,
return result; return result;
} }
static int _cas_upgrade_restore_conf_promotion(struct cas_properties *cache_props,
ocf_cache_t cache)
{
uint64_t promotion_type;
uint64_t nhit_insertion_threshold;
uint64_t nhit_trigger_threshold;
int result = 0;
result = cas_properties_get_uint(cache_props, PROMOTION_POLICY_STR,
&promotion_type);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't retrieve promotion "
"policy type \n");
goto out;
}
result = cache_mngt_set_promotion_policy(cache, promotion_type);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set promotion policy\n");
goto out;
}
if (promotion_type != ocf_promotion_nhit)
goto out;
result = cas_properties_get_uint(cache_props,
PROMOTION_NHIT_INSERTION_STR, &nhit_insertion_threshold);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't retrieve NHIT insertion "
"threshold parameter \n");
goto out;
}
result = cas_properties_get_uint(cache_props,
PROMOTION_NHIT_TRIGGER_STR, &nhit_trigger_threshold);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't retrieve NHIT insertion "
"trigger parameter \n");
goto out;
}
result = cache_mngt_set_promotion_param(cache, ocf_nhit_insertion_threshold,
nhit_insertion_threshold);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT insertion "
"threshold parameter \n");
goto out;
}
result = cache_mngt_set_promotion_param(cache, ocf_nhit_trigger_threshold,
nhit_trigger_threshold);
if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT trigger "
"threshold parameter \n");
goto out;
}
out:
return result;
}
static int _cas_upgrade_restore_conf_io_class( static int _cas_upgrade_restore_conf_io_class(
struct cas_properties *cache_props, ocf_cache_t cache) struct cas_properties *cache_props, ocf_cache_t cache)
{ {
@ -1210,6 +1352,10 @@ static int _cas_upgrade_restore_cache(struct cas_properties *cache_props)
if (result) if (result)
goto error; goto error;
result = _cas_upgrade_restore_conf_promotion(cache_props, cache);
if (result)
goto error;
result = _cas_upgrade_restore_conf_io_class(cache_props, cache); result = _cas_upgrade_restore_conf_io_class(cache_props, cache);
if (result) if (result)
goto error; goto error;