lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070607080132.GB14081@frankl.hpl.hp.com>
Date:	Thu, 7 Jun 2007 01:01:32 -0700
From:	Stephane Eranian <eranian@....hp.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/22] 2.6.22-rc3 perfmon2 : PMU context switch support

David,

On Mon, Jun 04, 2007 at 07:50:27AM -0700, David Rientjes wrote:
> > + * 02111-1307 USA
> > + */
> > +#include <linux/kernel.h>
> > +#include <linux/perfmon.h>
> > +
> > +/*
> > + * used only in UP mode
> > + */
> > +void pfm_save_prev_context(struct pfm_context *ctxp)
> > +{
> 
> Is this comment still valid even though there's a call to this function in 
> the self-monitoring case in __pfm_load_context()?
> 
Yes. I have added the #ifndef CONFIG_SMP if __pfm_load_context(). The reason
for this is that in UP mode we use lazy save/restore on context switch. Thus
when you come in to load a context on the PMU, you may need to push the previous
context out.

> > +
> > +void pfm_save_pmds(struct pfm_context *ctx, struct pfm_event_set *set)
> > +{
> > +	u64 val, hw_val, *pmds, ovfl_mask;
> > +	u64 *used_mask, *cnt_mask;
> > +	u16 i, num;
> > +
> > +	ovfl_mask = pfm_pmu_conf->ovfl_mask;
> > +	num = set->nused_pmds;
> > +	cnt_mask = pfm_pmu_conf->cnt_pmds;
> > +	used_mask = set->used_pmds;
> > +	pmds = set->view->set_pmds;
> > +
> > +	for (i = 0; num; i++) {
> 
> This should probably be "i++, num--".
> 
No. Num represents the number of PMD registers we need to read. We only
read the PMD registers we use. Thus num needs to be decremented only when
i is the index of a *used* PM register.

> > +		if (test_bit(i, ulp(used_mask))) {
> > +			hw_val = val = pfm_read_pmd(ctx, i);
> > +			if (likely(test_bit(i, ulp(cnt_mask))))
> > +				val = (pmds[i] & ~ovfl_mask) |
> > +					(hw_val & ovfl_mask);
> > +			pmds[i] = val;
> > +			num--;
> > +		}
> > +	}
> > +}
> 
> You can elimiate the hw_val automatic by eliminating its assignment and 
> replacing its use with val.
> 
Done.

Thanks for your feedback.

-- 

-Stephane
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ