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] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTilW6KptXsYtKDiPaYZPwQKkPR9L0CO2Nc-39TpA@mail.gmail.com>
Date:	Tue, 18 May 2010 13:51:15 +0530
From:	Jaswinder Singh Rajput <jaswinderlinux@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, "H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL, v2] x86/cpu changes for v2.6.35

Hello,

On Tue, May 18, 2010 at 4:24 AM, Ingo Molnar <mingo@...e.hu> wrote:
>
> * Ingo Molnar <mingo@...e.hu> wrote:
>
>> Linus,
>>
>> Please pull the latest x86-cleanups-for-linus git tree from:
>
> Correction, the above URI is still the previous pull
> request - the one for x86-cleanups-for-linus is:
>
> Please pull the latest x86-cpu-for-linus git tree from:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-cpu-for-linus
>
>
> diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
> index b3eeb66..33eae20 100644
> --- a/arch/x86/kernel/cpu/intel_cacheinfo.c
> +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
> @@ -148,13 +148,19 @@ union _cpuid4_leaf_ecx {
>        u32 full;
>  };
>
> +struct amd_l3_cache {
> +       struct   pci_dev *dev;
> +       bool     can_disable;
> +       unsigned indices;
> +       u8       subcaches[4];
> +};
> +
>  struct _cpuid4_info {
>        union _cpuid4_leaf_eax eax;
>        union _cpuid4_leaf_ebx ebx;
>        union _cpuid4_leaf_ecx ecx;
>        unsigned long size;
> -       bool can_disable;
> -       unsigned int l3_indices;
> +       struct amd_l3_cache *l3;
>        DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
>  };
>
> @@ -164,8 +170,7 @@ struct _cpuid4_info_regs {
>        union _cpuid4_leaf_ebx ebx;
>        union _cpuid4_leaf_ecx ecx;
>        unsigned long size;
> -       bool can_disable;
> -       unsigned int l3_indices;
> +       struct amd_l3_cache *l3;
>  };
>
>  unsigned short                 num_cache_leaves;
> @@ -302,87 +307,163 @@ struct _cache_attr {
>  };
>
>  #ifdef CONFIG_CPU_SUP_AMD
> -static unsigned int __cpuinit amd_calc_l3_indices(void)
> +
> +/*
> + * L3 cache descriptors
> + */
> +static struct amd_l3_cache **__cpuinitdata l3_caches;
> +
> +static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3)
>  {
> -       /*
> -        * We're called over smp_call_function_single() and therefore
> -        * are on the correct cpu.
> -        */
> -       int cpu = smp_processor_id();
> -       int node = cpu_to_node(cpu);
> -       struct pci_dev *dev = node_to_k8_nb_misc(node);
>        unsigned int sc0, sc1, sc2, sc3;
>        u32 val = 0;
>
> -       pci_read_config_dword(dev, 0x1C4, &val);
> +       pci_read_config_dword(l3->dev, 0x1C4, &val);
>
>        /* calculate subcache sizes */
> -       sc0 = !(val & BIT(0));
> -       sc1 = !(val & BIT(4));
> -       sc2 = !(val & BIT(8))  + !(val & BIT(9));
> -       sc3 = !(val & BIT(12)) + !(val & BIT(13));
> +       l3->subcaches[0] = sc0 = !(val & BIT(0));
> +       l3->subcaches[1] = sc1 = !(val & BIT(4));
> +       l3->subcaches[2] = sc2 = !(val & BIT(8))  + !(val & BIT(9));
> +       l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13));
>
> -       return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1;
> +       l3->indices = (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1;
> +}
> +
> +static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node)
> +{
> +       struct amd_l3_cache *l3;
> +       struct pci_dev *dev = node_to_k8_nb_misc(node);
> +
> +       l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC);
> +       if (!l3) {
> +               printk(KERN_WARNING "Error allocating L3 struct\n");
> +               return NULL;
> +       }
> +
> +       l3->dev = dev;

This is still Buggy. You are not checking whether dev is NULL or not.
If dev is NULL you should return.

Thanks,
--
Jaswinder Singh.
--
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