perfctr_stop: add flags to no 'disable_intens'
The original fujitsu code added a whole new ihk_mc_perfctr_stop_first function, duplicating a lot of code - add a flag to existing function instead. Change-Id: Ic9ce0236d68f967ff72cf88e5d9f1bda5c98aa1b Fujitsu: POSTK_DEBUG_ARCH_DEP_107
This commit is contained in:
committed by
Dominique Martinet
parent
d0d99adfb3
commit
34a995d290
@@ -148,30 +148,32 @@ int ihk_mc_perfctr_start(unsigned long counter_mask)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_stop(unsigned long counter_mask)
|
int ihk_mc_perfctr_stop(unsigned long counter_mask, int flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int i = 0;
|
||||||
int counter;
|
|
||||||
unsigned long counter_bit;
|
|
||||||
|
|
||||||
for (counter = 0, counter_bit = 1;
|
for (i = 0; i < sizeof(counter_mask) * BITS_PER_BYTE; i++) {
|
||||||
counter_bit < counter_mask;
|
if (!(counter_mask & (1UL << i)))
|
||||||
counter++, counter_bit <<= 1) {
|
|
||||||
if (!(counter_mask & counter_bit))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = cpu_pmu.disable_counter(counter);
|
int ret = 0;
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// ihk_mc_perfctr_startが呼ばれるときには、
|
ret = cpu_pmu.disable_counter(i);
|
||||||
// init系関数が呼ばれるのでdisableにする。
|
if (ret < 0) {
|
||||||
ret = cpu_pmu.disable_intens(counter);
|
continue;
|
||||||
if (ret < 0)
|
}
|
||||||
break;
|
|
||||||
|
if (flags & IHK_MC_PERFCTR_DISABLE_INTERRUPT) {
|
||||||
|
// when ihk_mc_perfctr_start is called,
|
||||||
|
// ihk_mc_perfctr_init is also called so disable
|
||||||
|
// interrupt
|
||||||
|
ret = cpu_pmu.disable_intens(i);
|
||||||
|
if (ret < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
return ret < 0 ? ret : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_reset(int counter)
|
int ihk_mc_perfctr_reset(int counter)
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ int ihk_mc_perfctr_start(unsigned long counter_mask)
|
|||||||
goto fn_exit;
|
goto fn_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_stop(unsigned long counter_mask)
|
int ihk_mc_perfctr_stop(unsigned long counter_mask, int flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ihk_mc_perfctr_stop(1 << pcd->target_cntr);
|
ret = ihk_mc_perfctr_stop(1 << pcd->target_cntr, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -742,7 +742,8 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PERF_CTRL_DISABLE:
|
case PERF_CTRL_DISABLE:
|
||||||
ret = ihk_mc_perfctr_stop(pcd->target_cntr_mask);
|
ret = ihk_mc_perfctr_stop(pcd->target_cntr_mask,
|
||||||
|
IHK_MC_PERFCTR_DISABLE_INTERRUPT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PERF_CTRL_GET:
|
case PERF_CTRL_GET:
|
||||||
|
|||||||
@@ -3974,7 +3974,7 @@ perf_stop(struct mc_perf_event *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (counter_mask) {
|
if (counter_mask) {
|
||||||
ihk_mc_perfctr_stop(counter_mask);
|
ihk_mc_perfctr_stop(counter_mask, 0);
|
||||||
cpu_local_var(current)->proc->monitoring_event = NULL;
|
cpu_local_var(current)->proc->monitoring_event = NULL;
|
||||||
cpu_local_var(current)->proc->perf_status = PP_NONE;
|
cpu_local_var(current)->proc->perf_status = PP_NONE;
|
||||||
}
|
}
|
||||||
@@ -9302,13 +9302,15 @@ SYSCALL_DECLARE(pmc_start)
|
|||||||
SYSCALL_DECLARE(pmc_stop)
|
SYSCALL_DECLARE(pmc_stop)
|
||||||
{
|
{
|
||||||
unsigned long counter = ihk_mc_syscall_arg0(ctx);
|
unsigned long counter = ihk_mc_syscall_arg0(ctx);
|
||||||
return ihk_mc_perfctr_stop((int)counter);
|
return ihk_mc_perfctr_stop((int)counter,
|
||||||
|
IHK_MC_PERFCTR_DISABLE_INTERRUPT);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
SYSCALL_DECLARE(pmc_stop)
|
SYSCALL_DECLARE(pmc_stop)
|
||||||
{
|
{
|
||||||
unsigned long counter = ihk_mc_syscall_arg0(ctx);
|
unsigned long counter = ihk_mc_syscall_arg0(ctx);
|
||||||
return ihk_mc_perfctr_stop(1 << counter);
|
return ihk_mc_perfctr_stop(1 << counter,
|
||||||
|
IHK_MC_PERFCTR_DISABLE_INTERRUPT);
|
||||||
}
|
}
|
||||||
#endif /*POSTK_DEBUG_TEMP_FIX_30*/
|
#endif /*POSTK_DEBUG_TEMP_FIX_30*/
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ enum ihk_perfctr_type {
|
|||||||
PERFCTR_MAX_TYPE,
|
PERFCTR_MAX_TYPE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IHK_MC_PERFCTR_DISABLE_INTERRUPT 1
|
||||||
|
|
||||||
#ifdef POSTK_DEBUG_TEMP_FIX_29
|
#ifdef POSTK_DEBUG_TEMP_FIX_29
|
||||||
int ihk_mc_perfctr_init(int counter, uint64_t config, int mode);
|
int ihk_mc_perfctr_init(int counter, uint64_t config, int mode);
|
||||||
int ihk_mc_perfctr_init_raw(int counter, uint64_t config, int mode);
|
int ihk_mc_perfctr_init_raw(int counter, uint64_t config, int mode);
|
||||||
@@ -64,7 +66,7 @@ int ihk_mc_perfctr_init_raw(int counter, unsigned int code, int mode);
|
|||||||
#endif/*POSTK_DEBUG_TEMP_FIX_29*/
|
#endif/*POSTK_DEBUG_TEMP_FIX_29*/
|
||||||
int ihk_mc_perfctr_set_extra(struct mc_perf_event *event);
|
int ihk_mc_perfctr_set_extra(struct mc_perf_event *event);
|
||||||
int ihk_mc_perfctr_start(unsigned long counter_mask);
|
int ihk_mc_perfctr_start(unsigned long counter_mask);
|
||||||
int ihk_mc_perfctr_stop(unsigned long counter_mask);
|
int ihk_mc_perfctr_stop(unsigned long counter_mask, int flags);
|
||||||
int ihk_mc_perfctr_reset(int counter);
|
int ihk_mc_perfctr_reset(int counter);
|
||||||
int ihk_mc_perfctr_set(int counter, long value);
|
int ihk_mc_perfctr_set(int counter, long value);
|
||||||
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
||||||
|
|||||||
Reference in New Issue
Block a user