Re: [PATCHv7 06/12] ARM: tegra: create a DT header defining SWGROUP ID

2013-12-18 Thread Mark Zhang
On 12/12/2013 03:57 PM, Hiroshi Doyu wrote:
> Create a header file to define the swgroup IDs used by the IOMMU(SMMU)
> binding. "swgroup" is a group of H/W clients which a Tegra SoC
> supports. This unique ID can be used to calculate MC_SMMU_ name>_ASID_0 register offset and MC__HOTRESET_*_0
> register bit. This will allow the same header to be used by both
> device tree files, and drivers implementing this binding, which
> guarantees that the two stay in sync. This also makes device trees
> more readable by using names instead of magic numbers. For HOTRESET
> bit shifting we need another conversion table, which will come later.
> 
> Signed-off-by: Hiroshi Doyu 
> ---
> v6:
> Use 0x instead of ~0UL since dtc expand this to ~0ULL.
> 
> v5:
> Added new macro TEGRA_SWGROUP_CELLS() and WO_U32_OF_U64().
> 
> v4:
> This is almost same as the previous v3. Just TEGRA_SWGROUP_MAX is
> added.
>   [PATCHv3 15/19] ARM: tegra: Create a DT header defining SWGROUP ID
> 
> Signed-off-by: Hiroshi Doyu 
> ---
>  include/dt-bindings/memory/tegra-swgroup.h | 50 
> ++
>  1 file changed, 50 insertions(+)
>  create mode 100644 include/dt-bindings/memory/tegra-swgroup.h
> 
> diff --git a/include/dt-bindings/memory/tegra-swgroup.h 
> b/include/dt-bindings/memory/tegra-swgroup.h
> new file mode 100644
> index 000..9c279f1
> --- /dev/null
> +++ b/include/dt-bindings/memory/tegra-swgroup.h
> @@ -0,0 +1,50 @@
> +/*
> + * This header provides constants for binding nvidia,swgroup ID
> + */
> +
> +#ifndef _DT_BINDINGS_MEMORY_TEGRA_SWGROUP_H
> +#define _DT_BINDINGS_MEMORY_TEGRA_SWGROUP_H
> +
> +#define TEGRA_SWGROUP_AFI0   /* 0x238 */
> +#define TEGRA_SWGROUP_AVPC   1   /* 0x23c */
> +#define TEGRA_SWGROUP_DC 2   /* 0x240 */
> +#define TEGRA_SWGROUP_DCB3   /* 0x244 */
> +#define TEGRA_SWGROUP_EPP4   /* 0x248 */
> +#define TEGRA_SWGROUP_G2 5   /* 0x24c */
> +#define TEGRA_SWGROUP_HC 6   /* 0x250 */
> +#define TEGRA_SWGROUP_HDA7   /* 0x254 */
> +#define TEGRA_SWGROUP_ISP8   /* 0x258 */
> +#define TEGRA_SWGROUP_ISP2   SWGROUP_ISP
> +#define TEGRA_SWGROUP_DC14   9   /* 0x490 *//* Exceptional non-linear */
> +#define TEGRA_SWGROUP_DC12   10  /* 0xa88 *//* Exceptional non-linear */
> +#define TEGRA_SWGROUP_MPE11  /* 0x264 */
> +#define TEGRA_SWGROUP_MSENC  SWGROUP_MPE

Need to change this to:

#define TEGRA_SWGROUP_MSENC 11

The reason is that, this makes "TEGRA_SWGROUP_BIT" doesn't work. So if I
write "TEGRA_SWGROUP_CELLS(MSENC)" in dt, that causes a dt compiling error.

"TEGRA_SWGROUP_ISP2" has the same issue.

Mark
> +#define TEGRA_SWGROUP_NV 12  /* 0x268 */
> +#define TEGRA_SWGROUP_NV213  /* 0x26c */
> +#define TEGRA_SWGROUP_PPCS   14  /* 0x270 */
> +#define TEGRA_SWGROUP_SATA2  15  /* 0x274 */
> +#define TEGRA_SWGROUP_SATA   16  /* 0x278 */
> +#define TEGRA_SWGROUP_VDE17  /* 0x27c */
> +#define TEGRA_SWGROUP_VI 18  /* 0x280 */
> +#define TEGRA_SWGROUP_VIC19  /* 0x284 */
> +#define TEGRA_SWGROUP_XUSB_HOST  20  /* 0x288 */
> +#define TEGRA_SWGROUP_XUSB_DEV   21  /* 0x28c */
> +#define TEGRA_SWGROUP_A9AVP  22  /* 0x290 */
> +#define TEGRA_SWGROUP_TSEC   23  /* 0x294 */
> +#define TEGRA_SWGROUP_PPCS1  24  /* 0x298 */
> +#define TEGRA_SWGROUP_SDMMC1A25  /* 0xa94 *//* Linear shift 
> again */
> +#define TEGRA_SWGROUP_SDMMC2A26  /* 0xa98 */
> +#define TEGRA_SWGROUP_SDMMC3A27  /* 0xa9c */
> +#define TEGRA_SWGROUP_SDMMC4A28  /* 0xaa0 */
> +#define TEGRA_SWGROUP_ISP2B  29  /* 0xaa4 */
> +#define TEGRA_SWGROUP_GPU30  /* 0xaa8 */
> +#define TEGRA_SWGROUP_GPUB   31  /* 0xaac */
> +#define TEGRA_SWGROUP_PPCS2  32  /* 0xab0 */
> +
> +#define TWO_U32_OF_U64(x)((x) & 0x) ((x) >> 32)
> +#define TEGRA_SWGROUP_BIT(x) (1ULL << TEGRA_SWGROUP_##x)
> +#define TEGRA_SWGROUP_CELLS(x)   TWO_U32_OF_U64(TEGRA_SWGROUP_BIT(x))
> +
> +#define TEGRA_SWGROUP_MAX64
> +
> +#endif /* _DT_BINDINGS_MEMORY_TEGRA_SWGROUP_H */
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] don't select EFI from certain special ACPI drivers

2013-12-18 Thread Jan Beulich
>>> On 17.12.13 at 23:34, "Luck, Tony"  wrote:
>>  No, it hasn't. But I explicitly checked the relevant EFI=n and EFI=y
>> cases.
> 
> I pushed your patch into my "next" tree - the robots will notice soon and 
> send us e-mail if they find any issues.

Thanks, Tony. I'm afraid though that fixing this only in 3.14 would
be a little late: Any "select" in a Kconfig results in the user not being
asked again when that "select" goes away, so people having got EFI
forcibly enabled in 3.13 and updating their configs to 3.14 would
then need to remember to manually disable CONFIG_EFI again (of
course that's already true for anyone using 3.13-rc?, but those
should mostly be people more knowledgeable than folks just
consuming final releases).

I think it should generally be the exception to "select" options that
have visible prompts (i.e. are user configurable).

Jan

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


Re: [PATCH v2] drm/bochs: new driver

2013-12-18 Thread David Herrmann
Hi

On Wed, Dec 18, 2013 at 8:37 AM, Gerd Hoffmann  wrote:
> On Mi, 2013-12-18 at 11:52 +1000, Dave Airlie wrote:
>> On Wed, Dec 18, 2013 at 3:04 AM, Gerd Hoffmann  wrote:
>> > DRM driver for (virtual) vga cards using the bochs dispi
>> > interface, such as the qemu standard vga (qemu -vga std).
>> >
>> > Don't bother supporting anything but 32bpp for now, even
>> > though the virtual hardware is able to do that.
>>
>> Hi Gerd,
>>
>> just took a quick look over this and it seems in pretty good shape,
>> the one worry I have is if you've tested with vesafb loaded, since you
>> do some pci_request_regions and fail hard, if vesafb has some of the
>> resources this can end up failing the driver load for no good reason.
>> I haven't verified there is a problem here its just something we've
>> had in the past.
>
> Tested, works.  bochs_pci_probe handles it before calling
> drm_get_pci_dev, simliar to cirrus.

It fails with CONFIG_X86_SYSFB=y and CONFIG_FB_SIMPLE=y. But imho that
should get fixed in sysfb, not the drivers loaded on top.

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


Re: 3.12: kernel panic when resuming from suspend to RAM (x86_64)

2013-12-18 Thread Francis Moreau
On 12/18/2013 05:05 AM, micky wrote:
> Hi:
> 
> It seems that the card-reader was removed during suspend or resume, is 
> that right? or did you removed by hand?

yes during a suspend/resume cycle.

> I want to know with Thomas' patch, after resume, is the card-reader and 
> card-reader driver still exist?

I'm not sure but IIRC it's still loaded in the kernel after resuming.

> if not exist, I also want to know which function called first, 
> rtsx_pci_resume or rtsx_pci_remove, can you determine it?
> And IRQ16 seems not handled by rtsx_pci driver, so with Thomas' patch, 
> is there still some go wrong?
> 

No idea, I'm simply an unfortunate user of that driver.

Aren't the information you're asking for already answered in the
previous posts ?

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


Re: [PATCH 0/4] Input: ABS2 and friends

2013-12-18 Thread David Herrmann
Hi

On Tue, Dec 17, 2013 at 10:28 PM,   wrote:
>> Hi
>>
>> This implements the recently discussed ABS2 API. It's working fine on my
>> machine with libevdev. Comments welcome!
>
> Just looking at the documentation file, I have a couple of suggestions.
>
> 1). Make a note on the direction of gravity wrt the example image. Ie what
> which axis/value will be positive with the device laid flat/stationary on
> a desk. Might just prevent some confusion later.

Yepp, can add that to the Accelerometer section.

> 2). Calibration, Accels and Gyros are noisy in different ways. Gyros tend
> to be wrong in the long term, giving some consistant bias which should be
> calibrated out. Accels are noisy in the short term, but generally right
> over a long period.

I'm not entirely sure where to put calibration/normalization. Letting
user-space deal with that should simplify things a lot. We could even
add it to libevdev. Comments welcome..

> Am I correct that the event framework will provide time-stamping of data,
> thus making computation of relative movements possible.

Yes, part of the evdev API.

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


Re: [RFC Patch v1 11/13] ACPI, i915: replace open-coded _DSM specific code with helper functions

2013-12-18 Thread Daniel Vetter
On Wed, Dec 18, 2013 at 02:58:19PM +0800, Jiang Liu wrote:
> Use helper functions to simplify _DSM related code in i915 driver.
> 
> Function intel_dsm() is used to check functions supported by ACPI _DSM
> method, but it has strange check for special value 0x8002. After
> digging into nouveau driver, I think the check is copied from nouveau
> driver and is useless for i915 driver, so remove it.
> 
> Signed-off-by: Jiang Liu 

Looks like a neat cleanup, so ack from my side. I don't have any clue
about the special case, cc'ing Dave maybe he remembers.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_acpi.c |  144 
> -
>  1 file changed, 30 insertions(+), 114 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_acpi.c 
> b/drivers/gpu/drm/i915/intel_acpi.c
> index dfff090..1bfac94 100644
> --- a/drivers/gpu/drm/i915/intel_acpi.c
> +++ b/drivers/gpu/drm/i915/intel_acpi.c
> @@ -12,8 +12,6 @@
>  #include "i915_drv.h"
>  
>  #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */
> -
> -#define INTEL_DSM_FN_SUPPORTED_FUNCTIONS 0 /* No args */
>  #define INTEL_DSM_FN_PLATFORM_MUX_INFO 1 /* No args */
>  
>  static struct intel_dsm_priv {
> @@ -28,61 +26,6 @@ static const u8 intel_dsm_guid[] = {
>   0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c
>  };
>  
> -static int intel_dsm(acpi_handle handle, int func)
> -{
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - struct acpi_object_list input;
> - union acpi_object params[4];
> - union acpi_object *obj;
> - u32 result;
> - int ret = 0;
> -
> - input.count = 4;
> - input.pointer = params;
> - params[0].type = ACPI_TYPE_BUFFER;
> - params[0].buffer.length = sizeof(intel_dsm_guid);
> - params[0].buffer.pointer = (char *)intel_dsm_guid;
> - params[1].type = ACPI_TYPE_INTEGER;
> - params[1].integer.value = INTEL_DSM_REVISION_ID;
> - params[2].type = ACPI_TYPE_INTEGER;
> - params[2].integer.value = func;
> - params[3].type = ACPI_TYPE_PACKAGE;
> - params[3].package.count = 0;
> - params[3].package.elements = NULL;
> -
> - ret = acpi_evaluate_object(handle, "_DSM", &input, &output);
> - if (ret) {
> - DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
> - return ret;
> - }
> -
> - obj = (union acpi_object *)output.pointer;
> -
> - result = 0;
> - switch (obj->type) {
> - case ACPI_TYPE_INTEGER:
> - result = obj->integer.value;
> - break;
> -
> - case ACPI_TYPE_BUFFER:
> - if (obj->buffer.length == 4) {
> - result = (obj->buffer.pointer[0] |
> - (obj->buffer.pointer[1] <<  8) |
> - (obj->buffer.pointer[2] << 16) |
> - (obj->buffer.pointer[3] << 24));
> - break;
> - }
> - default:
> - ret = -EINVAL;
> - break;
> - }
> - if (result == 0x8002)
> - ret = -ENODEV;
> -
> - kfree(output.pointer);
> - return ret;
> -}
> -
>  static char *intel_dsm_port_name(u8 id)
>  {
>   switch (id) {
> @@ -137,83 +80,56 @@ static char *intel_dsm_mux_type(u8 type)
>  
>  static void intel_dsm_platform_mux_info(void)
>  {
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - struct acpi_object_list input;
> - union acpi_object params[4];
> - union acpi_object *pkg;
> - int i, ret;
> -
> - input.count = 4;
> - input.pointer = params;
> - params[0].type = ACPI_TYPE_BUFFER;
> - params[0].buffer.length = sizeof(intel_dsm_guid);
> - params[0].buffer.pointer = (char *)intel_dsm_guid;
> - params[1].type = ACPI_TYPE_INTEGER;
> - params[1].integer.value = INTEL_DSM_REVISION_ID;
> - params[2].type = ACPI_TYPE_INTEGER;
> - params[2].integer.value = INTEL_DSM_FN_PLATFORM_MUX_INFO;
> - params[3].type = ACPI_TYPE_PACKAGE;
> - params[3].package.count = 0;
> - params[3].package.elements = NULL;
> -
> - ret = acpi_evaluate_object(intel_dsm_priv.dhandle, "_DSM", &input,
> -&output);
> - if (ret) {
> - DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
> - goto out;
> + int i;
> + union acpi_object *pkg, *connector_count;
> +
> + pkg = acpi_evaluate_dsm_typed(intel_dsm_priv.dhandle, intel_dsm_guid,
> + INTEL_DSM_REVISION_ID, INTEL_DSM_FN_PLATFORM_MUX_INFO,
> + NULL, ACPI_TYPE_PACKAGE);
> + if (!pkg) {
> + DRM_DEBUG_DRIVER("failed to evaluate _DSM\n");
> + return;
>   }
>  
> - pkg = (union acpi_object *)output.pointer;
> -
> - if (pkg->type == ACPI_TYPE_PACKAGE) {
> - union acpi_object *connector_count = &pkg->package.elements[0];
> - DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
> -   (unsigned long long)connector_

Re: [PATCHv3] mmc: atmel-mci: add vmmc-supply support

2013-12-18 Thread Ludovic Desroches
Hi Alexandre,

On Tue, Dec 17, 2013 at 08:03:12PM +0100, Alexandre Belloni wrote:
> Hi,
> 
> It seems that patch never made it to the mainline. Is it still missing
> something ?

No reason on my side, maybe because my ack is missing but I thought I
gave it on a previous version, maybe I am wrong.

So Acked-by: Ludovic Desroches 


Regards

Ludovic

> 
> Regards,
> 
> On 17/10/2013 15:56, Ulf Hansson wrote:
> > On 17 October 2013 12:46, Alexandre Belloni
> >  wrote:
> >> Other MMC hosts handle a regulator named vmmc-supply that allows to power 
> >> the
> >> MMC card or SDIO device before communicating on the bus.
> >>
> >> Signed-off-by: Alexandre Belloni 
> > Acked-by: Ulf Hansson 
> >
> >> ---
> >>
> >> Changes in v2:
> >>  - use mmc_regulator_get_supply instead of devm_regulator_get
> >>
> >> Changes in v3:
> >>  - en/disable the regulator in .set_ios using mmc_regulator_set_ocr
> >>
> >>  drivers/mmc/host/atmel-mci.c | 7 +++
> >>  1 file changed, 7 insertions(+)
> >>
> >> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> >> index 69e438e..a9e1ba6 100644
> >> --- a/drivers/mmc/host/atmel-mci.c
> >> +++ b/drivers/mmc/host/atmel-mci.c
> >> @@ -1385,8 +1385,14 @@ static void atmci_set_ios(struct mmc_host *mmc, 
> >> struct mmc_ios *ios)
> >> clk_unprepare(host->mck);
> >>
> >> switch (ios->power_mode) {
> >> +   case MMC_POWER_OFF:
> >> +   if (!IS_ERR(mmc->supply.vmmc))
> >> +   mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
> >> +   break;
> >> case MMC_POWER_UP:
> >> set_bit(ATMCI_CARD_NEED_INIT, &slot->flags);
> >> +   if (!IS_ERR(mmc->supply.vmmc))
> >> +   mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 
> >> ios->vdd);
> >> break;
> >> default:
> >> /*
> >> @@ -2196,6 +2202,7 @@ static int __init atmci_init_slot(struct atmel_mci 
> >> *host,
> >> }
> >>
> >> host->slot[id] = slot;
> >> +   mmc_regulator_get_supply(mmc);
> >> mmc_add_host(mmc);
> >>
> >> if (gpio_is_valid(slot->detect_pin)) {
> >> --
> >> 1.8.1.2
> >>
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> -- 
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread David Herrmann
Hi

On Wed, Dec 18, 2013 at 8:42 AM, Takashi Iwai  wrote:
> Hi,
>
> with the recent enablement of simplefb on x86, cirrusdrmfb on QEMU/KVM
> gets broken now, as reported at:
> https://bugzilla.novell.com/show_bug.cgi?id=855821
>
> The cirrus VGA resource is reserved at first as "BOOTFB" in
> arch/x86/kernel/sysfb_simplefb.c, which is taken by simplefb platform
> device.  This resource is, however, never released until the platform
> device is destroyed, and the framebuffer switching doesn't trigger
> it.  It calls fb's destroy callback, at most.  Then, cirrus driver
> tries to assign the resource, fails and gives up, resulting in a
> complete blank screen.
>
> The same problem should exist on other KMS drivers like mgag200 or
> ast, not only cirrus.  Intel graphics doesn't hit this problem just
> because the reserved iomem by BOOTFB isn't required by i915 driver.
>
> The patch below is a quick attempt to solve the issue.  It adds a new
> API function for releasing resources of platform_device, and call it
> in destroy op of simplefb.  But, forcibly releasing resources of a
> parent device doesn't sound like a correct design.  We may take such
> as a band aid, but definitely need a more fundamental fix.
>
> Any thoughts?

That bug always existed, simplefb is just the first driver to hit it
(vesafb/efifb didn't use resources). I'm aware of the issue but as a
workaround you can simply disable CONFIG_X86_SYSFB. That restores the
old behavior.

As a proper fix, I'd propose something like:
  dev = platform_find_device("platform-framebuffer");
  platform_remove_device(dev);

And we wrap this as:
  sysfb_remove_framebuffers()
in arch/x86/kernel/sysfb.c

This should cause a ->remove() event for the platform-driver and
correctly release the resources. Comments?
I will try to write a patch and send it later.

Thanks
David

>
> thanks,
>
> Takashi
>
> ---
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 3a94b79..f939236 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -267,6 +267,23 @@ int platform_device_add_data(struct platform_device 
> *pdev, const void *data,
>  }
>  EXPORT_SYMBOL_GPL(platform_device_add_data);
>
> +static void do_release_resources(struct platform_device *pdev, int nums)
> +{
> +   int i;
> +
> +   for (i = 0; i < nums; i++) {
> +   struct resource *r = &pdev->resource[i];
> +   unsigned long type = resource_type(r);
> +
> +   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> +   release_resource(r);
> +   }
> +
> +   kfree(pdev->resource);
> +   pdev->resource = NULL;
> +   pdev->num_resources = 0;
> +}
> +
>  /**
>   * platform_device_add - add a platform device to device hierarchy
>   * @pdev: platform device we're adding
> @@ -342,13 +359,7 @@ int platform_device_add(struct platform_device *pdev)
> pdev->id = PLATFORM_DEVID_AUTO;
> }
>
> -   while (--i >= 0) {
> -   struct resource *r = &pdev->resource[i];
> -   unsigned long type = resource_type(r);
> -
> -   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> -   release_resource(r);
> -   }
> +   do_release_resources(pdev, i - 1);
>
>   err_out:
> return ret;
> @@ -365,8 +376,6 @@ EXPORT_SYMBOL_GPL(platform_device_add);
>   */
>  void platform_device_del(struct platform_device *pdev)
>  {
> -   int i;
> -
> if (pdev) {
> device_del(&pdev->dev);
>
> @@ -375,17 +384,17 @@ void platform_device_del(struct platform_device *pdev)
> pdev->id = PLATFORM_DEVID_AUTO;
> }
>
> -   for (i = 0; i < pdev->num_resources; i++) {
> -   struct resource *r = &pdev->resource[i];
> -   unsigned long type = resource_type(r);
> -
> -   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> -   release_resource(r);
> -   }
> +   do_release_resources(pdev, pdev->num_resources);
> }
>  }
>  EXPORT_SYMBOL_GPL(platform_device_del);
>
> +void platform_device_release_resources(struct platform_device *pdev)
> +{
> +   do_release_resources(pdev, pdev->num_resources);
> +}
> +EXPORT_SYMBOL_GPL(platform_device_release_resources);
> +
>  /**
>   * platform_device_register - add a platform-level device
>   * @pdev: platform device we're adding
> diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
> index 210f3a0..fbf5e89 100644
> --- a/drivers/video/simplefb.c
> +++ b/drivers/video/simplefb.c
> @@ -70,6 +70,7 @@ static void simplefb_destroy(struct fb_info *info)
>  {
> if (info->screen_base)
> iounmap(info->screen_base);
> +   platform_device_release_resources(to_platform_device(info->device));
>  }
>
>  static struct fb_ops simplefb_ops = {
> diff --git a/include/linux/platform_device.h b/include

Re: linux-next: build failure after merge of the net-next tree

2013-12-18 Thread Geert Uytterhoeven
On Wed, Dec 18, 2013 at 3:30 AM, David Miller  wrote:
> diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
> index f01fb50..a73a8e2 100644
> --- a/arch/alpha/include/asm/Kbuild
> +++ b/arch/alpha/include/asm/Kbuild
> @@ -4,3 +4,4 @@ generic-y += clkdev.h
>  generic-y += exec.h
>  generic-y += trace_clock.h
>  generic-y += preempt.h
> +generic-y += hash.h

Please keep them sorted.

Yes, Peter violated that too, when adding preempt.h.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread Takashi Iwai
At Wed, 18 Dec 2013 09:21:28 +0100,
David Herrmann wrote:
> 
> Hi
> 
> On Wed, Dec 18, 2013 at 8:42 AM, Takashi Iwai  wrote:
> > Hi,
> >
> > with the recent enablement of simplefb on x86, cirrusdrmfb on QEMU/KVM
> > gets broken now, as reported at:
> > https://bugzilla.novell.com/show_bug.cgi?id=855821
> >
> > The cirrus VGA resource is reserved at first as "BOOTFB" in
> > arch/x86/kernel/sysfb_simplefb.c, which is taken by simplefb platform
> > device.  This resource is, however, never released until the platform
> > device is destroyed, and the framebuffer switching doesn't trigger
> > it.  It calls fb's destroy callback, at most.  Then, cirrus driver
> > tries to assign the resource, fails and gives up, resulting in a
> > complete blank screen.
> >
> > The same problem should exist on other KMS drivers like mgag200 or
> > ast, not only cirrus.  Intel graphics doesn't hit this problem just
> > because the reserved iomem by BOOTFB isn't required by i915 driver.
> >
> > The patch below is a quick attempt to solve the issue.  It adds a new
> > API function for releasing resources of platform_device, and call it
> > in destroy op of simplefb.  But, forcibly releasing resources of a
> > parent device doesn't sound like a correct design.  We may take such
> > as a band aid, but definitely need a more fundamental fix.
> >
> > Any thoughts?
> 
> That bug always existed, simplefb is just the first driver to hit it
> (vesafb/efifb didn't use resources).

Heh, the bug didn't "exist" because no other grabbed the resource
before.  The way the cirrus driver allocates the resource is no bug,
per se.  But the proper resource takeover is missing.

> I'm aware of the issue but as a
> workaround you can simply disable CONFIG_X86_SYSFB. That restores the
> old behavior.

Yes, but CONFIG_X86_SYSFB breaks things as of now.  Shouldn't it be
mentioned or give some kconfig hints instead of silently giving a
broken output, if any quick fix isn't possible?

> As a proper fix, I'd propose something like:
>   dev = platform_find_device("platform-framebuffer");
>   platform_remove_device(dev);
> 
> And we wrap this as:
>   sysfb_remove_framebuffers()
> in arch/x86/kernel/sysfb.c
> 
> This should cause a ->remove() event for the platform-driver and
> correctly release the resources. Comments?

Who will call this?  From destroy callback?
Or can we simply do put_device() the bound platform device instead?

> I will try to write a patch and send it later.

Thanks!


Takashi

> 
> Thanks
> David
> 
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> > index 3a94b79..f939236 100644
> > --- a/drivers/base/platform.c
> > +++ b/drivers/base/platform.c
> > @@ -267,6 +267,23 @@ int platform_device_add_data(struct platform_device 
> > *pdev, const void *data,
> >  }
> >  EXPORT_SYMBOL_GPL(platform_device_add_data);
> >
> > +static void do_release_resources(struct platform_device *pdev, int nums)
> > +{
> > +   int i;
> > +
> > +   for (i = 0; i < nums; i++) {
> > +   struct resource *r = &pdev->resource[i];
> > +   unsigned long type = resource_type(r);
> > +
> > +   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> > +   release_resource(r);
> > +   }
> > +
> > +   kfree(pdev->resource);
> > +   pdev->resource = NULL;
> > +   pdev->num_resources = 0;
> > +}
> > +
> >  /**
> >   * platform_device_add - add a platform device to device hierarchy
> >   * @pdev: platform device we're adding
> > @@ -342,13 +359,7 @@ int platform_device_add(struct platform_device *pdev)
> > pdev->id = PLATFORM_DEVID_AUTO;
> > }
> >
> > -   while (--i >= 0) {
> > -   struct resource *r = &pdev->resource[i];
> > -   unsigned long type = resource_type(r);
> > -
> > -   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> > -   release_resource(r);
> > -   }
> > +   do_release_resources(pdev, i - 1);
> >
> >   err_out:
> > return ret;
> > @@ -365,8 +376,6 @@ EXPORT_SYMBOL_GPL(platform_device_add);
> >   */
> >  void platform_device_del(struct platform_device *pdev)
> >  {
> > -   int i;
> > -
> > if (pdev) {
> > device_del(&pdev->dev);
> >
> > @@ -375,17 +384,17 @@ void platform_device_del(struct platform_device *pdev)
> > pdev->id = PLATFORM_DEVID_AUTO;
> > }
> >
> > -   for (i = 0; i < pdev->num_resources; i++) {
> > -   struct resource *r = &pdev->resource[i];
> > -   unsigned long type = resource_type(r);
> > -
> > -   if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
> > -   release_resource(r);
> > -   }
> > +   do_release_resources(pdev, pdev->num_resources);
> > }
> >  }
> >  EXPORT_SYMBOL_GPL(platform_device_del);
> 

Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread Geert Uytterhoeven
On Wed, Dec 18, 2013 at 9:44 AM, Takashi Iwai  wrote:
>> That bug always existed, simplefb is just the first driver to hit it
>> (vesafb/efifb didn't use resources).
>
> Heh, the bug didn't "exist" because no other grabbed the resource
> before.  The way the cirrus driver allocates the resource is no bug,
> per se.  But the proper resource takeover is missing.
>
>> I'm aware of the issue but as a
>> workaround you can simply disable CONFIG_X86_SYSFB. That restores the
>> old behavior.
>
> Yes, but CONFIG_X86_SYSFB breaks things as of now.  Shouldn't it be
> mentioned or give some kconfig hints instead of silently giving a
> broken output, if any quick fix isn't possible?

Indeed. That's called a "regression" in distro/allmodconfig kernels.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


changes caused by 0d11e6ac("blk-mq: fix use-after-free of request")

2013-12-18 Thread Yuanhan Liu
Hi,

FYI, we noticed some changes caused by 0d11e6ac("blk-mq: fix use-after-free of 
request"):

- 959a35f13eb785f982d7 is parent of 0d11e6aca396e679c07b
- kbuildx and vpx are KVM testbox

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
40592.80  +314.1%168112.22  
kbuildx/sysbench/fileio/600s-100%-1HDD-xfs-64G-1024-seqrewr-sync
19763.87  +941.6%205868.32  
kbuildx/sysbench/fileio/600s-100%-1HDD-xfs-64G-1024-seqwr-sync
60356.68  +519.6%373980.55  TOTAL iostat.vdb.wkB/s

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.64  +345.7% 2.87  
kbuildx/sysbench/fileio/600s-100%-1HDD-xfs-64G-1024-seqrewr-sync
0.64  +345.7% 2.87  TOTAL iostat.vdb.wrqm/s

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.00303.01  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
0.00252.31  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
0.00163.05  
vpx/micro/xfstests/4HDD-ext4-generic-mid
0.00   2442.01  
vpx/micro/xfstests/4HDD-xfs-generic-127
0.00507.41  
vpx/micro/xfstests/4HDD-xfs-generic-mid
0.00404.00  
vpx/micro/xfstests/4HDD-xfs-generic-quick
0.00   4071.80  TOTAL iostat.vda.r/s

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.00860.50  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
0.00112.49  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
0.00360.58  
vpx/micro/xfstests/4HDD-ext4-generic-mid
0.00   4937.56  
vpx/micro/xfstests/4HDD-xfs-generic-127
0.00   2070.37  
vpx/micro/xfstests/4HDD-xfs-generic-mid
0.00106.65  
vpx/micro/xfstests/4HDD-xfs-generic-quick
0.00   8448.15  TOTAL iostat.vda.w/s

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
   166400.75  0.45  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
13934.99  0.12  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
 5483.25  0.83  
vpx/micro/xfstests/4HDD-ext4-generic-mid
   168450.24  0.51  
vpx/micro/xfstests/4HDD-xfs-generic-127
   316831.98  0.32  
vpx/micro/xfstests/4HDD-xfs-generic-mid
28037.99  0.23  
vpx/micro/xfstests/4HDD-xfs-generic-quick
   699139.21  2.45  TOTAL iostat.vda.avgqu-sz

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.00326.86  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
0.00281.25  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
0.00811.90  
vpx/micro/xfstests/4HDD-ext4-generic-mid
0.00 47.78  
vpx/micro/xfstests/4HDD-xfs-generic-127
0.00   2117.30  
vpx/micro/xfstests/4HDD-xfs-generic-mid
0.00163.09  
vpx/micro/xfstests/4HDD-xfs-generic-quick
0.00   3748.18  TOTAL iostat.vda.await

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.00301.60  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
0.00249.16  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
0.00 51.45  
vpx/micro/xfstests/4HDD-ext4-generic-mid
0.00 91.51  
vpx/micro/xfstests/4HDD-xfs-generic-127
0.00   1919.27  
vpx/micro/xfstests/4HDD-xfs-generic-mid
0.00121.04  
vpx/micro/xfstests/4HDD-xfs-generic-quick
0.00   2734.03  TOTAL iostat.vda.r_await

959a35f13eb785f982d7  0d11e6aca396e679c07b  
    
0.00406.12  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
0.00433.66  
vpx/micro/xfstests/4HDD-btrfs-generic-quick
0.00807.7

Re: [PATCH 2/3] [RESEND]sparc64: convert spinloc_t to raw_spinlock_t in mmu_context_t

2013-12-18 Thread Sebastian Andrzej Siewior
On 12/18/2013 06:42 AM, Allen Pais wrote:
> index 554995d..aae5aa9 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -27,6 +27,7 @@ config SPARC
>   select HAVE_DMA_API_DEBUG
>   select HAVE_ARCH_JUMP_LABEL
>   select HAVE_GENERIC_HARDIRQS
> + select IRQ_FORCED_THREADING
>   select GENERIC_IRQ_SHOW
>   select ARCH_WANT_IPC_PARSE_VERSION
>   select USE_GENERIC_SMP_HELPERS if SMP

Sorry for not noticing this earlier but this has nothing to do with the
remaining part of the patch.
To be able to set this flag, you need to mark timer & perf interrupts.
If you already use IRQF_TIMER for the timer and perf interrupts are
already coming as NMU then you are done. But please split this out as a
separate patch.

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


Re: [RFC][PATCH 0/7] re-shrink 'struct page' when SLUB is on.

2013-12-18 Thread Pekka Enberg

On 12/17/2013 02:45 AM, Dave Hansen wrote:

I'll do some testing and see if I can coax out any delta from the
optimization myself.  Christoph went to a lot of trouble to put this
together, so I assumed that he had a really good reason, although the
changelogs don't really mention any.


IIRC it's commit 8a5ec0b ("Lockless (and preemptless) fastpaths for 
slub") that documents the performance gains.


The page alignment patches came later once we discovered that we broke 
the world...


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


Re: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs

2013-12-18 Thread Vlastimil Babka

On 12/17/2013 09:05 AM, Wanpeng Li wrote:

objrmap doesn't work for nonlinear VMAs because the assumption that 
offset-into-file
correlates with offset-into-virtual-addresses does not hold. Hence what
try_to_unmap_cluster does is a mini "virtual scan" of each nonlinear VMA which 
maps
the file to which the target page belongs. If vma locked, mlock the pages in the
cluster, rather than unmapping them. However, not all pages are guarantee page
locked instead of the check page. This patch fix the BUG by just confirm check 
page
hold page lock instead of all pages in the virtual scan window against nolinear 
VMAs.


This may fix the symptom, but I don't understand from the description 
why in this case is it ok not to have page locked for mlock_vma_page(), 
while in the other cases it's not ok.



[  253.869145] kernel BUG at mm/mlock.c:82!
[  253.869549] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[  253.870098] Dumping ftrace buffer:
[  253.870098](ftrace buffer empty)
[  253.870098] Modules linked in:
[  253.870098] CPU: 10 PID: 9162 Comm: trinity-child75 Tainted: GW
3.13.0-rc4-next-20131216-sasha-00011-g5f105ec-dirty #4137
[  253.873310] task: 8800c98cb000 ti: 8804d34e8000 task.ti: 
8804d34e8000
[  253.873310] RIP: 0010:[]  [] 
mlock_vma_page+0x18/0xc0
[  253.873310] RSP: :8804d34e99e8  EFLAGS: 00010246
[  253.873310] RAX: 006f8038002c RBX: ea00474944c0 RCX: 880807636000
[  253.873310] RDX: ea00 RSI: 7f17a9bca000 RDI: ea00474944c0
[  253.873310] RBP: 8804d34e99f8 R08: 88080702 R09: 
[  253.873310] R10: 0001 R11: 2000 R12: 7f17a9bca000
[  253.873310] R13: ea00474944c0 R14: 7f17a9be R15: 88080702
[  253.873310] FS:  7f17aa31a700() GS:8801c9c0() 
knlGS:
[  253.873310] CS:  0010 DS:  ES:  CR0: 8005003b
[  253.873310] CR2: 7f17a94fa000 CR3: 0004d3b02000 CR4: 06e0
[  253.873310] DR0: 7f17a74ca000 DR1:  DR2: 
[  253.873310] DR3:  DR6: 0ff0 DR7: 0600
[  253.873310] Stack:
[  253.873310]  000b3de28067 880b3de28e50 8804d34e9aa8 
8128bc31
[  253.873310]  0301 ea0011850220 8809a4039000 
ea0011850238
[  253.873310]  8804d34e9aa8 880807636060 0001 
880807636348
[  253.873310] Call Trace:
[  253.873310]  [] try_to_unmap_cluster+0x1c1/0x340
[  253.873310]  [] try_to_unmap_file+0x20a/0x2e0
[  253.873310]  [] try_to_unmap+0x73/0x90
[  253.873310]  [] __unmap_and_move+0x18d/0x250
[  253.873310]  [] unmap_and_move+0xb9/0x180
[  253.873310]  [] migrate_pages+0xeb/0x2f0
[  253.873310]  [] ? queue_pages_pte_range+0x1a0/0x1a0
[  253.873310]  [] migrate_to_node+0x9c/0xc0
[  253.873310]  [] do_migrate_pages+0x1b8/0x240
[  253.873310]  [] SYSC_migrate_pages+0x316/0x380
[  253.873310]  [] ? SYSC_migrate_pages+0xac/0x380
[  253.873310]  [] ? vtime_account_user+0x96/0xb0
[  253.873310]  [] SyS_migrate_pages+0xe/0x10
[  253.873310]  [] tracesys+0xdd/0xe2
[  253.873310] Code: 0f 1f 00 65 48 ff 04 25 10 25 1d 00 48 83 c4 08
5b c9 c3 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 07 48 89 fb
a8 01 75 10 <0f> 0b 66 0f 1f 44 00 00 eb fe 66 0f 1f 44 00 00 f0 0f ba
2f 15
[  253.873310] RIP  [] mlock_vma_page+0x18/0xc0
[  253.873310]  RSP 
[  253.904194] ---[ end trace be59c4a7f8edab3f ]---

Reported-by: Sasha Levin 
Signed-off-by: Wanpeng Li 
---
  mm/huge_memory.c | 2 +-
  mm/internal.h| 4 ++--
  mm/ksm.c | 2 +-
  mm/memory.c  | 2 +-
  mm/mlock.c   | 5 +++--
  mm/rmap.c| 4 ++--
  6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 33a5dc4..7a15b04 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1264,7 +1264,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct 
*vma,
if (page->mapping && trylock_page(page)) {
lru_add_drain();
if (page->mapping)
-   mlock_vma_page(page);
+   mlock_vma_page(page, true);
unlock_page(page);
}
}
diff --git a/mm/internal.h b/mm/internal.h
index a85a3ab..4ea2d4e 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -192,7 +192,7 @@ static inline int mlocked_vma_newpage(struct vm_area_struct 
*vma,
  /*
   * must be called with vma's mmap_sem held for read or write, and page locked.
   */
-extern void mlock_vma_page(struct page *page);
+extern void mlock_vma_page(struct page *page, bool check_page);
  extern unsigned int munlock_vma_page(struct page *page);

  /*
@@ -236,7 +236,7 @@ static inline int mlocked_vma_newpage(struct vm_area_struct 
*v, struct page *p)
return 0;
  }
  static inline void clear_page_mlock(struct page *page) { }
-static inline void mlock_vma_page(struct page *pag

Re: [cfg80211 / iwlwifi] setting wireless regulatory domain doesn't work.

2013-12-18 Thread Arend van Spriel
On 12/18/2013 08:50 AM, Pontus Fuchs wrote:
> On 2013-12-17 22:49, Sander Eikelenboom wrote:
>>
>> Indeed, I looked for a crda hook for initramfs-tools but didn't find
>> it, so skipped that idea
>> for the moment.
>>
>> So if i combine the two .. it's essentially just a very bad idea to
>> compile the wireless stuff in.
>> It needs a access to a userland program at module load time, or it
>> will block forever.
> 
> The canonical trick to have cfg80211 built in is to execute crda
> manually in your boot scripts. This will satisfy the initial request and
> resolve the block.

There is a Kconfig option to have the regulatory data built-in the
kernel as well. Obviously that makes a regulatory update more difficult.

net/wireless/Kconfig:
config CFG80211_INTERNAL_REGDB
bool "use statically compiled regulatory rules database" if EXPERT

Regards,
AvS

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


[RFC PATCH 02/15] ACPICA: Linux: Add configurability for external globals.

2013-12-18 Thread Lv Zheng
OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.

This patch configures ACPICA external globals out and defines them into
immediates when CONFIG_ACPI is not enabled.  Lv Zheng.

Known issues:
1. No possible referencs by !CONFIG_ACPI code
   We even don't need to define specific globals into immediates if it is
   impossible that there are references for them in !CONFIG_ACPI code.
   This patch just adds immediates for all of them from ACPICA's
   perspectives.

Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h   |   11 
 include/acpi/platform/aclinux.h |   53 +++
 2 files changed, 64 insertions(+)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 76df71d..2fc2094 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -74,13 +74,24 @@ extern u32 acpi_rsdt_forced;
 
 #else
 
+#ifndef ACPI_EXTERN
 #define ACPI_EXTERN extern
+#endif
+
+#ifndef ACPI_GLOBAL
 #define ACPI_GLOBAL(t,a) \
extern t a;
+#endif
+
+#ifndef ACPI_INIT_GLOBAL
 #define ACPI_INIT_GLOBAL(t,a,b) \
extern t a;
+#endif
+
+#ifndef ACPI_GLOBAL_FADT
 #define ACPI_GLOBAL_FADT \
extern struct acpi_table_fadt acpi_gbl_FADT;
+#endif
 
 #endif
 
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..68cda04 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -65,6 +65,59 @@
 #endif
 #include 
 
+#ifdef CONFIG_ACPI
+
+/*
+ * External acpi_gbl_FADT users will use Revision and Flags to test
+ * features, such code may not well protected by CONFIG_ACPI.
+ */
+#define acpi_get_fadt_revision()(acpi_gbl_FADT.header.revision)
+#define acpi_test_fadt_flags(__flags) (acpi_gbl_FADT.flags & (__flags))
+
+#else  /* CONFIG_ACPI */
+
+/* Extarnal globals for __KERNEL__, stubs is needed */
+
+#define ACPI_EXTERN
+#define ACPI_GLOBAL(t,a)
+#define ACPI_INIT_GLOBAL(t,a,b)
+#define ACPI_GLOBAL_FADT
+
+/* Immediates to protect global variables accesses */
+
+#define acpi_current_gpe_count  0
+#define acpi_gbl_trace_flags0
+#define acpi_gbl_trace_method_name  0
+#define acpi_gbl_system_awake_and_running   FALSE
+#define acpi_gbl_reduced_hardware   FALSE
+#define acpi_gbl_enable_interpreter_slack   FALSE
+#define acpi_gbl_all_methods_serialized FALSE
+#define acpi_gbl_create_osi_method  TRUE
+#define acpi_gbl_use_default_register_widths TRUE
+#define acpi_gbl_enable_aml_debug_objectFALSE
+#define acpi_gbl_copy_dsdt_locally  FALSE
+#define acpi_gbl_truncate_io_addresses  FALSE
+#define acpi_gbl_disable_auto_repairFALSE
+#define acpi_gbl_disable_ssdt_table_loadFALSE
+#define acpi_gbl_osi_data   0
+#define acpi_dbg_level  ACPI_DEBUG_DEFAULT
+#define acpi_dbg_layer  ACPI_COMPONENT_DEFAULT
+
+/* Helpers to protect acpi_gbl_FADT accesses */
+
+#define acpi_get_fadt_revision()0
+#define acpi_test_fadt_flags(__flags) 0
+
+#endif /* CONFIG_ACPI */
+
+#ifndef ACPI_DISASSEMBLER
+
+/* Immediates to protect global variables accesses */
+
+#define acpi_gbl_no_resource_disassemblyFALSE
+#define acpi_gbl_ignore_noop_operator   FALSE
+#endif
+
 /* Host-dependent types and defines for in-kernel ACPICA */
 
 #define ACPI_MACHINE_WIDTH  BITS_PER_LONG
-- 
1.7.10.4

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


[RFC PATCH 03/15] ACPICA: Linux: Add configurability for OSL APIs.

2013-12-18 Thread Lv Zheng
OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.
This patch configures ACPICA internal OSL prototypes out when ACPI is
disabled to facilitate Linux with such configurability.

Note that this patch is generated in the assumption that all ACPICA OSL
APIs should only be used by ACPICA itself.  While the real world is there
are some external ACPICA macros called ACPICA OSL APIs.  This patch
doesn't include protections around the OSL APIs that are used by such
ACPICA external macros.  Lv Zheng.

Signed-off-by: Lv Zheng 
---
 include/acpi/platform/aclinux.h |   63 +++
 1 file changed, 63 insertions(+)

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 68cda04..5e5de9c 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -108,6 +108,65 @@
 #define acpi_get_fadt_revision()0
 #define acpi_test_fadt_flags(__flags) 0
 
+/* OSL prototypes for __KERNEL__, hiding their declarations */
+
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
+
 #endif /* CONFIG_ACPI */
 
 #ifndef ACPI_DISASSEMBLER
@@ -164,6 +223,8 @@
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_ACPI
+
 /*
  * FIXME: Inclusion of actypes.h
  * Linux kernel need this before defining inline OSL interfaces as
@@ -296,6 +357,8 @@ void acpi_os_gpe_count(u32 gpe_number);
 
 void acpi_os_fixed_event_count(u32 fixed_event_number);
 
+#endif /* CONFIG_ACPI */
+
 #endif /* __KERNEL__ */
 
 #endif /* __ACLINUX_H__ */
-- 
1.7.10.4

--
To

[RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files.

2013-12-18 Thread Lv Zheng
Currently, there are issues in the ACPI subsystem:

1. ACPICA header files are lacking in stub protections.
   This makes all ACPICA header files could only be included for
   CONFIG_ACPI=y environment.  This infects new ACPI prototypes, if such
   prototypes referenced ACPICA defined types, they must be incldued only
   in the CONFIG_ACPI=y environment.  While CONFIG_SFI requires to include
   ACPICA headers to find generic table definitions when CONFIG_ACPI is not
   enabled.  This seems to be too complicated to achieve a cleaned SFI
   header.  So please check if this solution is acceptable.  And this patch
   set is thus marked as RFC.
2. ACPICA layer is lacking in its own architecture specific layer.
   The file  now is used as architecture specific layer of both
   in kernel ACPICA and Linux ACPI.  While Linux ACPI headers are always
   need to include ACPICA top level header  to find ACPICA
   defined types before including their own architecture specific layer.
   The mis-order of header inclusion will potentially infect
   arch/x86/include/asm folder, and defining prototypes using ACPICA types
   in  is not possible.

This patchset solves above issues to make ACPICA a law-abiding resident in
the Linux kernel.

The benefits of merging this series are:
1. We can sort all direct  inclusions from subsystems other
   than ACPICA out from the entire kernel source tree.
2. We are able to kill many "#ifdef CONFIG_ACPI" code from other kernel
   subsystems.
3. Using ACPICA types in  is possible.

PATCH 01-13 add stub protections for ACPICA headers.
  01-02 add stub support for ACPICA global variables
  03add stub support for ACPICA OSL prototypes
  04add stub support for ACPICA macros
  05-09 add stub support for ACPICA external functions
  10-13 remove  inclusion from ACPICA headers.
PATCH 14-15 remove wrong direct  inclusions.

NOTE: PATCH 01-08 are linuxized ACPICA commits, it is better to merge them
  into the ACPICA upstream first and integrate them into Linux during
  ACPICA release process.  Or the divergences generated by this series
  may hurt ACPICA release automation.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
  All drivers/acpi configurations
  All platform drivers
  All ACPI drivers
  4 DRM drivers that implement ACPI opregion
  All buses with ACPI bindings
  All cpufreq configurations
  All xen configurations
  All ACPI table drivers
They are tested twice with CONFIG_ACPI enabled/disabled.

Also allyes/allno/allmod tests are done for ARCH=i386 and ARCH=x86_64.

A boot test has been done to ARCH=x86_64 default configuration and it is
confirmed that the ACPI devices are successfully created under
/sys/bus/acpi/devices when CONFIG_ACPI is enabled.

Another test is to compose a .c file invoking all ACPICA globals,
functions, macros and built it with and without CONFIG_ACPI enabled.

Lv Zheng (15):
  ACPICA: OSL: Add configurability mechanism for global variables.
  ACPICA: Linux: Add configurability for external globals.
  ACPICA: Linux: Add configurability for OSL APIs.
  ACPICA: OSL: Cleanup external macros and add stubs for macros.
  ACPICA: OSL: Add configurability to error message functions.
  ACPICA: OSL: Add configurability to debug output functions.
  ACPICA: OSL: Add configurability mechanism for external APIs.
  ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages for external APIs.
  ACPICA: Linux: Add stub support for Linux specific variables and
functions.
  ACPICA: Linux: Add architecture specific ACPICA headers in Linux.
  ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  ACPICA: Linux: Add configuration item to indicate the architecture
specific support.
  ACPICA: Linux: Remove  inclusion from ACPICA headers.
  ACPI/SFI: Fix wrong  inclusion in SFI/ACPI wrapper -
table definitions.
  ACPI/thinkpad: Fix wrong  inclusion in Thinkpad ACPI
users.

 arch/ia64/Kconfig|1 +
 arch/ia64/include/asm/acenv.h|   73 
 arch/ia64/include/asm/acpi.h |   50 ---
 arch/ia64/kernel/acpi.c  |1 -
 arch/x86/Kconfig |1 +
 arch/x86/include/asm/acenv.h |   70 +++
 arch/x86/include/asm/acpi.h  |   45 --
 arch/x86/kernel/acpi/boot.c  |1 -
 drivers/acpi/Kconfig |4 +
 drivers/acpi/acpica/acglobal.h   |  123 --
 drivers/acpi/acpica/utglobal.c   |6 -
 drivers/acpi/acpica/utxferror.c  |2 +
 drivers/acpi/bus.c   |3 -
 drivers/platform/x86/thinkpad_acpi.c |1 -
 include/acpi/acpixf.h|  782 +++---
 include/acpi/actypes.h   |   21 +
 include/acpi/platform/aclinux.h  |  182 +++-
 include/linux/acpi.h |   13 +-
 include/linux/acpica.h  

[RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.

2013-12-18 Thread Lv Zheng
This patch adds default 64-bit mathematics in aclinux.h using do_div.  As
do_div can be used for all Linux architectures, this can also be used as
stub macros for ACPICA 64-bit mathematics.

Signed-off-by: Lv Zheng 
---
 arch/ia64/include/asm/acenv.h   |2 ++
 arch/x86/include/asm/acenv.h|4 
 include/acpi/platform/aclinux.h |   29 +
 3 files changed, 35 insertions(+)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index eb13318..f142a9d 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -66,6 +66,8 @@ ia64_acpi_release_global_lock (unsigned int *lock)
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)\
((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 #endif
 
 #endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 2359989..a85b478 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -45,6 +45,8 @@ int __acpi_release_global_lock(unsigned int *lock);
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
((Acq) = __acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 /*
  * Math helper asm macros
  */
@@ -61,6 +63,8 @@ int __acpi_release_global_lock(unsigned int *lock);
: "=r"(n_hi), "=r"(n_lo)\
: "0"(n_hi), "1"(n_lo))
 
+#define ARCH_HAS_ACPI_MATH64_HELPER 1
+
 #endif
 
 #endif /* _ASM_X86_ACENV_H */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e9e6374..8176181 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -221,6 +221,35 @@
 #define acpi_spinlock   spinlock_t *
 #define acpi_cpu_flags  unsigned long
 
+#if ACPI_MACHINE_WIDTH == 64
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+/* Default to ACPI_USE_NATIVE_DIVIDE support */
+
+#define ARCH_HAS_ACPI_MATH64_HELPER
+
+#endif
+
+#endif
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+   do { \
+   u64 __dividend = (((u64)(n_hi) << 32) | (n_lo)); \
+   (r32) = do_div(__dividend, (d32)); \
+   (q32) = (u32)__dividend; \
+   } while (0)
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+   do { \
+   (n_lo) = ((n_lo) >> 1) | (((n_hi) & 1) << 31); \
+   (n_hi) >>= 1; \
+   } while (0)
+
+#endif
+
 #else  /* !__KERNEL__ */
 
 #include 
-- 
1.7.10.4

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


[RFC PATCH 10/15] ACPICA: Linux: Add architecture specific ACPICA headers in Linux.

2013-12-18 Thread Lv Zheng
Our target is allowing inclusion of  for CONFIG_ACPI=n build.

This patch tries to achieve this by splitting architecture specific ACPICA
implementation from  into  to improve
maintainability.  Then  could be treated as the architecture
specific part of , ,
.

We need to delete  from aclinux.h to achieve our CONFIG_ACPI=n
build target, but in order not to affect Linux build process, it requires
further cleanup on , ,
 inclusions be done before doing this.

Signed-off-by: Lv Zheng 
---
 arch/ia64/include/asm/acenv.h   |   71 +++
 arch/ia64/include/asm/acpi.h|   50 ---
 arch/x86/include/asm/acenv.h|   66 
 arch/x86/include/asm/acpi.h |   45 -
 include/acpi/platform/aclinux.h |1 +
 5 files changed, 138 insertions(+), 95 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 000..eb13318
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include 
+
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2013, Intel Corporation
+ *   Author: Lv Zheng 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define COMPILER_DEPENDENT_INT64   long
+#define COMPILER_DEPENDENT_UINT64  unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE- Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE  - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE  - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock (unsigned int *lock)
+{
+   unsigned int old, new, val;
+   do {
+   old = *lock;
+   new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+   val = ia64_cmpxchg4_acq(lock, new, old);
+   } while (unlikely (val != old));
+   return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock (unsigned int *lock)
+{
+   unsigned int old, new, val;
+   do {
+   old = *lock;
+   new = old & ~0x3;
+   val = ia64_cmpxchg4_acq(lock, new, old);
+   } while (unlikely (val != old));
+   return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)\
+   ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)\
+   ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index faa1bf0..84a6f04 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include 
 #include 
 
-#define COMPILER_DEPENDENT_INT64   long
-#define COMPILER_DEPENDENT_UINT64  unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE- Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE  - External ACPI interfaces
- * ACPI_INTERNAL_XFACE  - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-   unsigned int old, new, val;
-   do {
-   old = *lock;
-   new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-   val = ia64_cmpxchg4_acq(lock, new, old);
-   } while (unlikely (val != old));
-   return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-   unsigned int old, new, val;
-   do {
-   old = *lock;
-   new = old & ~0x3;
-   val = ia64_cmpxchg4_acq(lock, new, old);
-   } while (unlikely (val != old));
-   return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)\
-   ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)\
-   ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef CONFIG_ACPI
 #define acpi_disabled 0/* ACPI always enabled on IA64 */
 #define

[RFC PATCH 14/15] ACPI/SFI: Fix wrong inclusion in SFI/ACPI wrapper - table definitions.

2013-12-18 Thread Lv Zheng
This patch removes  inclusions from  as
 has already included it for CONFIG_ACPI=n builds.

Cc: Bjorn Helgaas 
Cc: Len Brown 
Cc: sfi-de...@simplefirmware.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Lv Zheng 
---
 include/linux/sfi_acpi.h |3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbf..a6e555c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
 #include 
 
 #ifdef CONFIG_SFI
-#include  /* FIXME: inclusion should be removed */
-
 extern int sfi_acpi_table_parse(char *signature, char *oem_id,
char *oem_table_id,
int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
return sfi_acpi_table_parse(signature, NULL, NULL, handler);
 }
 #else /* !CONFIG_SFI */
-
 static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
char *oem_table_id,
int (*handler)(struct acpi_table_header *))
-- 
1.7.10.4

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


Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust

2013-12-18 Thread Dave Young
On 12/17/13 at 12:36am, Borislav Petkov wrote:
> From: Borislav Petkov 
> 
> Currently, running SetVirtualAddressMap() and passing the physical
> address of the virtual map array was working only by a lucky coincidence
> because the memory was present in the EFI page table too. Until Toshi
> went and booted this on a big HP box - the krealloc() manner of resizing
> the memmap we're doing did allocate from such physical addresses which
> were not mapped anymore and boom:
> 
> http://lkml.kernel.org/r/1386806463.1791.295.ca...@misato.fc.hp.com
> 
> One way to take care of that issue is to reimplement the krealloc thing
> but with pages. We start with contiguous pages of order 1, i.e. 2 pages,
> and when we deplete that memory (shouldn't happen all that often but you
> know firmware) we realloc the next power-of-two pages.

How about firstly count the md numbers in the 1st loop, then get/roundup
the total size, alloc the pages, map the mds one by one in another loop.

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


[RFC PATCH 09/15] ACPICA: Linux: Add stub support for Linux specific variables and functions.

2013-12-18 Thread Lv Zheng
There are global variables and functions not upstreamed to the ACPICA code
base.  Such symbols still can referenced by external users as they are
listed in the acpixf.h.  This patch uses ACPI_GLOBAL and
ACPI_EXTERNAL_RETURN_STATUS mechanism to add stub support for such symbols.

Signed-off-by: Lv Zheng 
---
 arch/ia64/kernel/acpi.c |1 -
 arch/x86/kernel/acpi/boot.c |1 -
 drivers/acpi/bus.c  |3 ---
 include/acpi/acpixf.h   |   23 ++-
 include/acpi/platform/aclinux.h |3 +++
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 59d52e3..28dc6ba 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -61,7 +61,6 @@
 
 #define PREFIX "ACPI: "
 
-u32 acpi_rsdt_forced;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6c0b43b..c83a974 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -46,7 +46,6 @@
 
 #include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
 static int __initdata acpi_force = 0;
-u32 acpi_rsdt_forced;
 int acpi_disabled;
 EXPORT_SYMBOL(acpi_disabled);
 
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2c38ae2..68d3e70 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -429,9 +429,6 @@ static int __init acpi_bus_init_irq(void)
return 0;
 }
 
-u8 acpi_gbl_permanent_mmap;
-
-
 void __init acpi_early_init(void)
 {
acpi_status status;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 8f32dfe..1e93ef6 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -53,9 +53,6 @@
 #include 
 #include 
 
-extern u8 acpi_gbl_permanent_mmap;
-extern u32 acpi_rsdt_forced;
-
 /*
  * Ensure that the globals are actually defined and initialized only once.
  *
@@ -235,6 +232,10 @@ ACPI_GLOBAL(u8, acpi_gbl_reduced_hardware)
 ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
  ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE)
 #endif
+
+ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap)
+ACPI_GLOBAL(u32, acpi_rsdt_forced)
+
 /*
  * Hardware-reduced prototypes. All interfaces that use these macros will
  * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
@@ -361,7 +362,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init 
acpi_reallocate_root_table(void))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
acpi_find_root_pointer(acpi_size * rsdp_address))
 
-acpi_status acpi_unload_table_id(acpi_owner_id id);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_get_table_header(acpi_string signature,
@@ -369,10 +370,12 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  struct acpi_table_header
  *out_table_header))
 
-acpi_status
-acpi_get_table_with_size(acpi_string signature,
-  u32 instance, struct acpi_table_header **out_table,
-  acpi_size *tbl_size);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_get_table_with_size(acpi_string signature,
+u32 instance,
+struct acpi_table_header
+**out_table,
+acpi_size *tbl_size))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 acpi_get_table(acpi_string signature, u32 instance,
@@ -477,7 +480,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_get_type(acpi_handle object,
  acpi_object_type * out_type))
 
-acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_get_id(acpi_handle object,
+   acpi_owner_id * out_type))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_get_parent(acpi_handle object,
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 12ef8be..b1ddf5c 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -133,6 +133,9 @@
 #define acpi_dbg_level  ACPI_DEBUG_DEFAULT
 #define acpi_dbg_layer  ACPI_COMPONENT_DEFAULT
 
+#define acpi_gbl_permanent_mmap FALSE
+#define acpi_rsdt_forcedFALSE
+
 /* Helpers to protect acpi_gbl_FADT accesses */
 
 #define acpi_get_fadt_revision()0
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vg

Re: [PATCH] ssp/pxa2xx: add ssp support for mach-mmp

2013-12-18 Thread Mika Westerberg
On Wed, Dec 18, 2013 at 02:08:29PM +0800, Qiao Zhou wrote:
> mach-mmp also uses ssp request/free APIs. Add mach-mmp support.
> Otherwise there will be redefinition error.
> 
> Signed-off-by: Qiao Zhou 

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


[RFC PATCH 07/15] ACPICA: OSL: Add configurability mechanism for external APIs.

2013-12-18 Thread Lv Zheng
OSPMs like Linux trend to include all header files but leave empty inline
stub functions for a feature that is not configured during build.
This patch adds wrappers mechanism to be used around ACPICA external
interfaces to facilitate OSPM with such configurability.
This patch doesn't include code for Linux to use this mechanism.

Note that in order to the reduce the difficulties caused by the source code
differences between Linux and ACPICA upstream of maintaining large
ACPI_EXTERNAL_RETURN_x macro updates, actual ACPI_EXTERNAL_RETURN_x macro
usages are done and split into other commits.

ACPICA commits will be linuxized by the scripts. If there were divergences
in the middle of a diff block, the linuxized diff block should require
human intervention to be performed to make it possible to apply the
linuxized commit into Linux source tree.  Sometime such human intervention
will be very difficult as the linuxized commits will be messed up in
addition to the normal line offsettings by the patch/diff based utilities.
Lv Zheng.

Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h   |   33 ++---
 include/acpi/platform/aclinux.h |   13 +
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 08a1fdb..ed6c53b 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -95,6 +95,33 @@ extern u32 acpi_rsdt_forced;
 
 #endif
 
+/* ACPICA prototypes */
+
+#ifndef ACPI_EXTERNAL_RETURN_STATUS
+#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
+   prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_OK
+#define ACPI_EXTERNAL_RETURN_OK(prototype) \
+   prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_VOID
+#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
+   prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_UINT32
+#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
+   prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_PTR
+#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
+   prototype;
+#endif
+
 /* Public globals, available from outside ACPICA subsystem */
 
 /*
@@ -215,11 +242,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, 
FALSE)
  */
 #if (!ACPI_REDUCED_HARDWARE)
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
-   prototype;
+   ACPI_EXTERNAL_RETURN_STATUS(prototype)
 #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
-   prototype;
+   ACPI_EXTERNAL_RETURN_OK(prototype)
 #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
-   prototype;
+   ACPI_EXTERNAL_RETURN_VOID(prototype)
 #else
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 45df524..12ef8be 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -100,6 +100,19 @@
 #define ACPI_INIT_GLOBAL(t,a,b)
 #define ACPI_GLOBAL_FADT
 
+/* External interface for __KERNEL__, stub is needed */
+
+#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
+   static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
+#define ACPI_EXTERNAL_RETURN_OK(prototype) \
+   static ACPI_INLINE prototype {return(AE_OK);}
+#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
+   static ACPI_INLINE prototype {return;}
+#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
+   static ACPI_INLINE prototype {return(0);}
+#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
+   static ACPI_INLINE prototype {return(NULL);}
+
 /* Immediates to protect global variables accesses */
 
 #define acpi_current_gpe_count  0
-- 
1.7.10.4

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


[RFC PATCH 08/15] ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages for external APIs.

2013-12-18 Thread Lv Zheng
OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.

This patch configures ACPICA external APIs out and defines them into
function stubs when CONFIG_ACPI is not enabled.  Lv Zheng.

Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h |  429 ++---
 1 file changed, 262 insertions(+), 167 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index ed6c53b..8f32dfe 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -282,17 +282,19 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, 
FALSE)
 /*
  * Initialization
  */
-acpi_status __init
-acpi_initialize_tables(struct acpi_table_desc *initial_storage,
-  u32 initial_table_count, u8 allow_resize);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
+   acpi_initialize_tables(struct acpi_table_desc
+  *initial_storage,
+  u32 initial_table_count,
+  u8 allow_resize))
 
-acpi_status __init acpi_initialize_subsystem(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void))
 
-acpi_status __init acpi_enable_subsystem(u32 flags);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 
flags))
 
-acpi_status __init acpi_initialize_objects(u32 flags);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_objects(u32 
flags))
 
-acpi_status __init acpi_terminate(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void))
 
 /*
  * Miscellaneous global interfaces
@@ -300,152 +302,198 @@ acpi_status __init acpi_terminate(void);
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
+
 #ifdef ACPI_FUTURE_USAGE
- acpi_status acpi_subsystem_status(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void))
 #endif
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_get_system_info(struct acpi_buffer
+*ret_buffer))
 #endif
 
-acpi_status acpi_get_statistics(struct acpi_statistics *stats);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+acpi_get_statistics(struct acpi_statistics *stats))
 
-const char *acpi_format_exception(acpi_status exception);
+ACPI_EXTERNAL_RETURN_PTR(const char
+ *acpi_format_exception(acpi_status exception))
 
-acpi_status acpi_purge_cached_objects(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void))
 
-acpi_status acpi_install_interface(acpi_string interface_name);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_install_interface(acpi_string interface_name))
 
-acpi_status acpi_remove_interface(acpi_string interface_name);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_remove_interface(acpi_string interface_name))
 
-acpi_status acpi_update_interfaces(u8 action);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action))
 
-u32
-acpi_check_address_range(acpi_adr_space_type space_id,
-acpi_physical_address address,
-acpi_size length, u8 warn);
+ACPI_EXTERNAL_RETURN_UINT32(u32
+   acpi_check_address_range(acpi_adr_space_type
+space_id,
+acpi_physical_address
+address, acpi_size length,
+u8 warn))
 
-acpi_status
-acpi_decode_pld_buffer(u8 *in_buffer,
-  acpi_size length, struct acpi_pld_info **return_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+acpi_decode_pld_buffer(u8 *in_buffer,
+   acpi_size length,
+   struct acpi_pld_info
+   **return_buffer))
 
 /*
  * ACPI table load/unload interfaces
  */
-acpi_status acpi_load_table(struct acpi_table_header *table);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_load_table(struct acpi_table_header *table))
 
-acpi_status acpi_unload_parent_table(acpi_handle object);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+   acpi_unload_parent_table(acpi_handle object))
 
-acpi_status __init acpi_load_tables(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
 
 /*
  * ACPI table manipulation interfaces
  */
-acpi_status __init acpi_reallocate_root_table(void);
+A

[RFC PATCH 06/15] ACPICA: OSL: Add configurability to debug output functions.

2013-12-18 Thread Lv Zheng
This patch extends ACPI_HW_DEPENDENT_x mechanism to all debugging output
related functions so that the OSPMs can have full control to configure
them into stub functions.
This patch also includes code for Linux to use this new mechanism for
the code that is built without CONFIG_ACPI enabled.  Lv Zheng.

Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h   |   45 ---
 include/acpi/platform/aclinux.h |1 +
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 6c8619d..08a1fdb 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -241,6 +241,18 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, 
FALSE)
static ACPI_INLINE prototype {return;}
 #endif /* ACPI_NO_ERROR_MESSAGES */
 /*
+ * Debugging-output prototypes. All interfaces that use these macros will
+ * be configured out of the ACPICA build if the ACPI_DEBUG_OUTPUT flag is
+ * not defined.
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
+   prototype;
+#else
+#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
+   static ACPI_INLINE prototype {return;}
+#endif /* ACPI_DEBUG_OUTPUT */
+/*
  * Initialization
  */
 acpi_status __init
@@ -713,22 +725,21 @@ ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
 /*
  * Debug output
  */
-#ifdef ACPI_DEBUG_OUTPUT
-ACPI_PRINTF_LIKE(6)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print(u32 requested_debug_level,
-u32 line_number,
-const char *function_name,
-const char *module_name,
-u32 component_id, const char *format, ...);
-
-ACPI_PRINTF_LIKE(6)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print_raw(u32 requested_debug_level,
-u32 line_number,
-const char *function_name,
-const char *module_name,
-u32 component_id, const char *format, ...);
-#endif
+ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
+  void ACPI_INTERNAL_VAR_XFACE
+  acpi_debug_print(u32 requested_debug_level,
+   u32 line_number,
+   const char *function_name,
+   const char *module_name,
+   u32 component_id,
+   const char *format, ...))
 
+ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_debug_print_raw(u32 requested_debug_level,
+u32 line_number,
+const char *function_name,
+const char *module_name,
+u32 component_id,
+const char *format, ...))
 #endif /* __ACXFACE_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index c38929b..45df524 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -65,6 +65,7 @@
 /* Generating stubs for configurable ACPICA functions */
 
 #define ACPI_NO_ERROR_MESSAGES
+#undef ACPI_DEBUG_OUTPUT
 
 #endif
 
-- 
1.7.10.4

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


[PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs

2013-12-18 Thread Grygorii Strashko
The system may crash if:
- there are more then 1 bank
- unbanked irqs are enabled
- someone will call gpio_to_irq() for GPIO from bank2 or above

Hence, fix it by not creating irq_domain if unbanked irqs are enabled
and correct gpio_to_irq_banked() to handle this properly.

Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Sekhar Nori 

Acked-by: Santosh Shilimkar 
Signed-off-by: Grygorii Strashko 
---
 drivers/gpio/gpio-davinci.c |   34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 5d163c0..1b33806 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, 
unsigned offset)
 {
struct davinci_gpio_controller *d = chip2controller(chip);
 
-   return irq_create_mapping(d->irq_domain, d->chip.base + offset);
+   if (d->irq_domain)
+   return irq_create_mapping(d->irq_domain, d->chip.base + offset);
+   else
+   return -ENXIO;
 }
 
 static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
@@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
struct davinci_gpio_platform_data *pdata = dev->platform_data;
struct davinci_gpio_regs __iomem *g;
-   struct irq_domain   *irq_domain;
+   struct irq_domain   *irq_domain = NULL;
 
ngpio = pdata->ngpio;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
}
clk_prepare_enable(clk);
 
-   irq = irq_alloc_descs(-1, 0, ngpio, 0);
-   if (irq < 0) {
-   dev_err(dev, "Couldn't allocate IRQ numbers\n");
-   return irq;
-   }
+   if (!pdata->gpio_unbanked) {
+   irq = irq_alloc_descs(-1, 0, ngpio, 0);
+   if (irq < 0) {
+   dev_err(dev, "Couldn't allocate IRQ numbers\n");
+   return -ENODEV;
+   }
 
-   irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
-   &davinci_gpio_irq_ops,
-   chips);
-   if (!irq_domain) {
-   dev_err(dev, "Couldn't register an IRQ domain\n");
-   return -ENODEV;
+   irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
+   &davinci_gpio_irq_ops,
+   chips);
+   if (!irq_domain) {
+   dev_err(dev, "Couldn't register an IRQ domain\n");
+   return -ENODEV;
+   }
}
 
/*
@@ -475,8 +480,7 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
 */
for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) {
chips[bank].chip.to_irq = gpio_to_irq_banked;
-   if (!pdata->gpio_unbanked)
-   chips[bank].irq_domain = irq_domain;
+   chips[bank].irq_domain = irq_domain;
}
 
/*
-- 
1.7.9.5

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


Re: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs

2013-12-18 Thread Vlastimil Babka

On 12/18/2013 05:12 AM, Wanpeng Li wrote:

Hi Sasha,
On Tue, Dec 17, 2013 at 10:32:53PM -0500, Sasha Levin wrote:

On 12/17/2013 10:23 PM, Wanpeng Li wrote:

-   mlock_vma_page(page);   /* no-op if already mlocked */
-   if (page == check_page)
+   if (page != check_page && trylock_page(page)) {
+   mlock_vma_page(page);   /* no-op if already 
mlocked */
+   unlock_page(page);
+   } else if (page == check_page) {
+   mlock_vma_page(page);  /* no-op if already 
mlocked */
ret = SWAP_MLOCK;
+   }


Previously, if page != check_page and the page was locked, we'd call 
mlock_vma_page()
anyways. With this change, we don't. In fact, we'll just skip that entire block 
not doing
anything.


Thanks for pointing out. ;-)



If that's something that's never supposed to happen, can we add a

VM_BUG_ON(page != check_page && PageLocked(page))

Just to cover this new code path?



How about this one?


0001-3.patch


 From eab57d94c82fb3ab74b607a3ede0f5ce765ff2cc Mon Sep 17 00:00:00 2001
From: Wanpeng Li 
Date: Wed, 18 Dec 2013 12:05:59 +0800
Subject: [PATCH] mm/mlock: fix BUG_ON unlocked page for nolinear VMAs

objrmap doesn't work for nonlinear VMAs because the assumption that 
offset-into-file
correlates with offset-into-virtual-addresses does not hold. Hence what
try_to_unmap_cluster does is a mini "virtual scan" of each nonlinear VMA which 
maps
the file to which the target page belongs. If vma locked, mlock the pages in the
cluster, rather than unmapping them. However, not all pages are guarantee page
locked instead of the check page. This patch fix the BUG by try to lock !check 
page
if them are unlocked.

[  253.869145] kernel BUG at mm/mlock.c:82!
[  253.869549] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[  253.870098] Dumping ftrace buffer:
[  253.870098](ftrace buffer empty)
[  253.870098] Modules linked in:
[  253.870098] CPU: 10 PID: 9162 Comm: trinity-child75 Tainted: GW
3.13.0-rc4-next-20131216-sasha-00011-g5f105ec-dirty #4137
[  253.873310] task: 8800c98cb000 ti: 8804d34e8000 task.ti: 
8804d34e8000
[  253.873310] RIP: 0010:[]  [] 
mlock_vma_page+0x18/0xc0
[  253.873310] RSP: :8804d34e99e8  EFLAGS: 00010246
[  253.873310] RAX: 006f8038002c RBX: ea00474944c0 RCX: 880807636000
[  253.873310] RDX: ea00 RSI: 7f17a9bca000 RDI: ea00474944c0
[  253.873310] RBP: 8804d34e99f8 R08: 88080702 R09: 
[  253.873310] R10: 0001 R11: 2000 R12: 7f17a9bca000
[  253.873310] R13: ea00474944c0 R14: 7f17a9be R15: 88080702
[  253.873310] FS:  7f17aa31a700() GS:8801c9c0() 
knlGS:
[  253.873310] CS:  0010 DS:  ES:  CR0: 8005003b
[  253.873310] CR2: 7f17a94fa000 CR3: 0004d3b02000 CR4: 06e0
[  253.873310] DR0: 7f17a74ca000 DR1:  DR2: 
[  253.873310] DR3:  DR6: 0ff0 DR7: 0600
[  253.873310] Stack:
[  253.873310]  000b3de28067 880b3de28e50 8804d34e9aa8 
8128bc31
[  253.873310]  0301 ea0011850220 8809a4039000 
ea0011850238
[  253.873310]  8804d34e9aa8 880807636060 0001 
880807636348
[  253.873310] Call Trace:
[  253.873310]  [] try_to_unmap_cluster+0x1c1/0x340
[  253.873310]  [] try_to_unmap_file+0x20a/0x2e0
[  253.873310]  [] try_to_unmap+0x73/0x90
[  253.873310]  [] __unmap_and_move+0x18d/0x250
[  253.873310]  [] unmap_and_move+0xb9/0x180
[  253.873310]  [] migrate_pages+0xeb/0x2f0
[  253.873310]  [] ? queue_pages_pte_range+0x1a0/0x1a0
[  253.873310]  [] migrate_to_node+0x9c/0xc0
[  253.873310]  [] do_migrate_pages+0x1b8/0x240
[  253.873310]  [] SYSC_migrate_pages+0x316/0x380
[  253.873310]  [] ? SYSC_migrate_pages+0xac/0x380
[  253.873310]  [] ? vtime_account_user+0x96/0xb0
[  253.873310]  [] SyS_migrate_pages+0xe/0x10
[  253.873310]  [] tracesys+0xdd/0xe2
[  253.873310] Code: 0f 1f 00 65 48 ff 04 25 10 25 1d 00 48 83 c4 08
5b c9 c3 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 07 48 89 fb
a8 01 75 10 <0f> 0b 66 0f 1f 44 00 00 eb fe 66 0f 1f 44 00 00 f0 0f ba
2f 15
[  253.873310] RIP  [] mlock_vma_page+0x18/0xc0
[  253.873310]  RSP 
[  253.904194] ---[ end trace be59c4a7f8edab3f ]---

Reported-by: Sasha Levin 
Signed-off-by: Wanpeng Li 
---
  mm/rmap.c | 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 55c8b8d..1e24813 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1347,6 +1347,7 @@ static int try_to_unmap_cluster(unsigned long cursor, 
unsigned int *mapcount,
unsigned long end;
int ret = SWAP_AGAIN;
int locked_vma = 0;
+   int we_locked = 0;

address = (vma->

[PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC

2013-12-18 Thread Grygorii Strashko
The similar GPIO HW block is used by keystone SoCs as
in Davinci SoCs.
Hence, reuse Davinci GPIO driver for Keystone taking into
account that Keystone contains ARM GIC IRQ controller which
is implemented using IRQ Chip.

Documentation:
http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf

Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Sekhar Nori 
Cc: devicet...@vger.kernel.org

Acked-by: Santosh Shilimkar 
Signed-off-by: Grygorii Strashko 
---
 .../devicetree/bindings/gpio/gpio-davinci.txt  |4 +-
 drivers/gpio/gpio-davinci.c|   46 
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt 
b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
index a2e839d..4ce9862 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
@@ -1,7 +1,7 @@
-Davinci GPIO controller bindings
+Davinci/Keystone GPIO controller bindings
 
 Required Properties:
-- compatible: should be "ti,dm6441-gpio"
+- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio"
 
 - reg: Physical base address of the controller and the size of memory mapped
registers.
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 1b33806..38741cc 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -413,6 +413,26 @@ static const struct irq_domain_ops davinci_gpio_irq_ops = {
.xlate = irq_domain_xlate_onetwocell,
 };
 
+static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq)
+{
+   static struct irq_chip_type gpio_unbanked;
+
+   gpio_unbanked = *container_of(irq_get_chip(irq),
+ struct irq_chip_type, chip);
+
+   return &gpio_unbanked.chip;
+};
+
+static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq)
+{
+   static struct irq_chip gpio_unbanked;
+
+   gpio_unbanked = *irq_get_chip(irq);
+   return &gpio_unbanked;
+};
+
+static const struct of_device_id davinci_gpio_ids[];
+
 /*
  * NOTE:  for suspend/resume, probably best to make a platform_device with
  * suspend_late/resume_resume calls hooking into results of the set_wake()
@@ -433,6 +453,18 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
struct davinci_gpio_platform_data *pdata = dev->platform_data;
struct davinci_gpio_regs __iomem *g;
struct irq_domain   *irq_domain = NULL;
+   const struct of_device_id *match;
+   struct irq_chip *irq_chip;
+   struct irq_chip *(*gpio_get_irq_chip)(unsigned int irq);
+
+   /*
+* Use davinci_gpio_get_irq_chip by default to handle non DT cases
+*/
+   gpio_get_irq_chip = davinci_gpio_get_irq_chip;
+   match = of_match_device(of_match_ptr(davinci_gpio_ids),
+   dev);
+   if (match)
+   gpio_get_irq_chip = match->data;
 
ngpio = pdata->ngpio;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -489,8 +521,6 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
 * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs.
 */
if (pdata->gpio_unbanked) {
-   static struct irq_chip_type gpio_unbanked;
-
/* pass "bank 0" GPIO IRQs to AINTC */
chips[0].chip.to_irq = gpio_to_irq_unbanked;
chips[0].gpio_irq = bank_irq;
@@ -499,10 +529,9 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
 
/* AINTC handles mask/unmask; GPIO handles triggering */
irq = bank_irq;
-   gpio_unbanked = *container_of(irq_get_chip(irq),
- struct irq_chip_type, chip);
-   gpio_unbanked.chip.name = "GPIO-AINTC";
-   gpio_unbanked.chip.irq_set_type = gpio_irq_type_unbanked;
+   irq_chip = gpio_get_irq_chip(irq);
+   irq_chip->name = "GPIO-AINTC";
+   irq_chip->irq_set_type = gpio_irq_type_unbanked;
 
/* default trigger: both edges */
g = gpio2regs(0);
@@ -511,7 +540,7 @@ static int davinci_gpio_irq_setup(struct platform_device 
*pdev)
 
/* set the direct IRQs up to use that irqchip */
for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) {
-   irq_set_chip(irq, &gpio_unbanked.chip);
+   irq_set_chip(irq, irq_chip);
irq_set_handler_data(irq, &chips[gpio / 32]);
irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH);
}
@@ -554,7 +583,8 @@ done:
 
 #if IS_ENABLED(CONFIG_OF)
 static const struct of_device_id davinci_gpio_ids[] = {
-   { .compatible = "ti,dm6441-gpio", },
+   { .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip},
+   { .compatible = "ti,dm6441-gpio", davinci_gpi

[PATCH v2 0/2] gpio: davinci: reuse for keystone arch

2013-12-18 Thread Grygorii Strashko
This series is intended to update Davinci GPIO driver and reuse
it for Keystone SoCs, because Keystone uses the similar GPIO IP like Davinci.
Keystone GPIO IP: supports:
- up to 32 GPIO lines;
- only unbanked irqs;

See Documentation:
Keystone - http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf

This series based on:
https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.14/gpio

Changes in v2:
- minor comments applied, no functional changes

v1: https://lkml.org/lkml/2013/12/12/366

Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Sekhar Nori 
Cc: Santosh Shilimkar 

Grygorii Strashko (2):
  gpio: davinci: don't create irq_domain in case of unbanked irqs
  gpio: davinci: reuse for Keystone SoC

 .../devicetree/bindings/gpio/gpio-davinci.txt  |4 +-
 drivers/gpio/gpio-davinci.c|   80 ++--
 2 files changed, 59 insertions(+), 25 deletions(-)

-- 
1.7.9.5

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


[RFC PATCH 05/15] ACPICA: OSL: Add configurability to error message functions.

2013-12-18 Thread Lv Zheng
This patch extends ACPI_HW_DEPENDENT_x mechanism to all error message
related functions so that the OSPMs can have full control to configure
them into stub functions.
This patch also includes code for Linux to use this new mechanism for
the code that is built without CONFIG_ACPI enabled.  Lv Zheng.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/utxferror.c |2 ++
 include/acpi/acpixf.h   |   75 +--
 include/acpi/platform/aclinux.h |4 +++
 3 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index f7edb88..44e36d7 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -53,6 +53,7 @@ ACPI_MODULE_NAME("utxferror")
  * This module is used for the in-kernel ACPICA as well as the ACPICA
  * tools/applications.
  */
+#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
 
/***
  *
  * FUNCTION:acpi_error
@@ -249,3 +250,4 @@ acpi_bios_warning(const char *module_name,
 }
 
 ACPI_EXPORT_SYMBOL(acpi_bios_warning)
+#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 2fc2094..6c8619d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -229,6 +229,18 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, 
FALSE)
static ACPI_INLINE prototype {return;}
 #endif /* !ACPI_REDUCED_HARDWARE */
 /*
+ * Error-message prototypes. All interfaces that use these macros will
+ * be configured out of the ACPICA build if the ACPI_NO_ERROR_MESSAGE flag
+ * is defined.
+ */
+#ifndef ACPI_NO_ERROR_MESSAGES
+#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
+   prototype;
+#else
+#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
+   static ACPI_INLINE prototype {return;}
+#endif /* ACPI_NO_ERROR_MESSAGES */
+/*
  * Initialization
  */
 acpi_status __init
@@ -661,38 +673,47 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 /*
  * Error/Warning output
  */
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_error(const char *module_name, u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(4)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_exception(const char *module_name,
-  u32 line_number, acpi_status status, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_warning(const char *module_name, u32 line_number, const char *format, 
...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_info(const char *module_name, u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_bios_error(const char *module_name,
-   u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_bios_warning(const char *module_name,
- u32 line_number, const char *format, ...);
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+  void ACPI_INTERNAL_VAR_XFACE
+  acpi_error(const char *module_name,
+ u32 line_number,
+ const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_exception(const char *module_name,
+  u32 line_number,
+  acpi_status status,
+  const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_warning(const char *module_name,
+u32 line_number,
+const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_info(const char *module_name,
+ u32 line_number,
+ const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_bios_error(const char *module_name,
+   u32 line_number,
+   const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+   void ACPI_INTERNAL_VAR_XFACE
+   acpi_bios_warning(const char *module_name,
+ u32 line_number,
+ const char

[RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support.

2013-12-18 Thread Lv Zheng
This file can be used to detect ACPICA configurability/build issues in
CONFIG_ACPI=n environment.
This patch is only used for unit test purpose, do not merge it into
public linux kernel source trees.

Signed-off-by: Lv Zheng 
---
 init/Makefile |2 +-
 init/acpica.c |  318 +
 2 files changed, 319 insertions(+), 1 deletion(-)
 create mode 100644 init/acpica.c

diff --git a/init/Makefile b/init/Makefile
index 7bc47ee..0f655de 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y  := main.o version.o mounts.o
+obj-y  := main.o version.o mounts.o acpica.o
 ifneq ($(CONFIG_BLK_DEV_INITRD),y)
 obj-y  += noinitramfs.o
 else
diff --git a/init/acpica.c b/init/acpica.c
new file mode 100644
index 000..ae9fc61
--- /dev/null
+++ b/init/acpica.c
@@ -0,0 +1,318 @@
+/*
+ * ACPICA build testing for CONFIG_ACPI=n
+ *
+ * Copyright (C) 2013, Intel Corporation
+ *   Author: Lv Zheng 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+
+#define FUNC_CONST_PTR_1(ptr, func, v1)\
+   do {\
+   ptr = func(v1); \
+   printk("%s result is %p.\n", #func, ptr);   \
+   } while (0)
+#define FUNC_0(status, func)   \
+   do {\
+   status = func();\
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_1(status, func, v1)   \
+   do {\
+   status = func(v1);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_2(status, func, v1, v2)   \
+   do {\
+   status = func(v1, v2);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_3(status, func, v1, v2, v3)   \
+   do {\
+   status = func(v1, v2, v3);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_4(status, func, v1, v2, v3, v4)   \
+   do {\
+   status = func(v1, v2, v3, v4);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_5(status, func, v1, v2, v3, v4, v5)   \
+   do {\
+   status = func(v1, v2, v3, v4, v5);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_6(status, func, v1, v2, v3, v4, v5, v6)   \
+   do {\
+   status = func(v1, v2, v3, v4, v5, v6);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+#define FUNC_7(status, func, v1, v2, v3, v4, v5, v6, v7)   \
+   do {\
+   status = func(v1, v2, v3, v4, v5, v6, v7);  \
+   printk("%s result is %d.\n", #func, status);\
+   } while (0)
+
+#define FUNC_VOID_3(func, v1, v2, v3)  \
+   do {\
+   func(v1, v2, v3);   \
+   } while (0)
+#define FUNC_VOID_4(func, v1, v2, v3, v4)  \
+   do {\
+   func(v1, v2, v3, v4);   \
+   } while (0)
+#define FUNC_VOID_6(func, v1, v2, v3, v4, v5, v6)  \
+   do {\
+   func(v1, v2, v3, v4, v5, v6);   \
+   } while (0)
+
+#define ACCESS_GLOBAL(gbl, val)\
+   do {\
+   if ((gbl) == (val)) {   \
+   printk("%s global equals.\n", #gbl);\
+   } else {\
+   printk("%s global not equals.\n", #gbl);\
+   }   \
+   } while

[RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables.

2013-12-18 Thread Lv Zheng
This patch extends ACPI_INIT_GLOBAL mechanism to all global variables so
that the OSPMs can have full control to configure them into immediates.
This patch doesn't include any code for Linux to utilize this mechanism.

Linux practice shows there are external users out of Linux ACPI subsystem
checking ACPICA provided global variables.  Linux trends to protect such
global variables by defining them to default values when specific Kconfig
items are not enabled (particular to ACPICA, it should be CONFIG_ACPI) or
Linux will suffer from build errors complaining the absense of such global
variables.
This patch converts all ACPICA global variables into macro wrapped so that
OSPMs can configure such global variables out by defining ACPI_GLOBAL and
ACPI_INIT_GLOBAL into no-ops.  For the code still referencing such globals
when ACPICA is configured out, OSPMs can either define global variable
symbols into constant variables (static const if it doesn't increase the
size of the OSPMs' binary image) or maintain a big list of the macros in
the "#define AcpiGbl_x v" style.  Lv Zheng.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acglobal.h |  123 -
 drivers/acpi/acpica/utglobal.c |6 --
 include/acpi/acpixf.h  |  170 
 3 files changed, 138 insertions(+), 161 deletions(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index e9f1fc7..923fa29 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -44,127 +44,6 @@
 #ifndef __ACGLOBAL_H__
 #define __ACGLOBAL_H__
 
-/*
- * Ensure that the globals are actually defined and initialized only once.
- *
- * The use of these macros allows a single list of globals (here) in order
- * to simplify maintenance of the code.
- */
-#ifdef DEFINE_ACPI_GLOBALS
-#define ACPI_EXTERN
-#define ACPI_INIT_GLOBAL(a,b) a=b
-#else
-#define ACPI_EXTERN extern
-#define ACPI_INIT_GLOBAL(a,b) a
-#endif
-
-#ifdef DEFINE_ACPI_GLOBALS
-
-/* Public globals, available from outside ACPICA subsystem */
-
-/*
- *
- * Runtime configuration (static defaults that can be overriden at runtime)
- *
- /
-
-/*
- * Enable "slack" in the AML interpreter?  Default is FALSE, and the
- * interpreter strictly follows the ACPI specification. Setting to TRUE
- * allows the interpreter to ignore certain errors and/or bad AML constructs.
- *
- * Currently, these features are enabled by this flag:
- *
- * 1) Allow "implicit return" of last value in a control method
- * 2) Allow access beyond the end of an operation region
- * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
- * 4) Allow ANY object type to be a source operand for the Store() operator
- * 5) Allow unresolved references (invalid target name) in package objects
- * 6) Enable warning messages for behavior that is not ACPI spec compliant
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
-
-/*
- * Automatically serialize ALL control methods? Default is FALSE, meaning
- * to use the Serialized/not_serialized method flags on a per method basis.
- * Only change this if the ASL code is poorly written and cannot handle
- * reentrancy even though methods are marked "NotSerialized".
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
-
-/*
- * Create the predefined _OSI method in the namespace? Default is TRUE
- * because ACPI CA is fully compatible with other ACPI implementations.
- * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
-
-/*
- * Optionally use default values for the ACPI register widths. Set this to
- * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
-
-/*
- * Optionally enable output from the AML Debug Object.
- */
-bool ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
-
-/*
- * Optionally copy the entire DSDT to local memory (instead of simply
- * mapping it.) There are some BIOSs that corrupt or replace the original
- * DSDT, creating the need for this option. Default is FALSE, do not copy
- * the DSDT.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE);
-
-/*
- * Optionally truncate I/O addresses to 16 bits. Provides compatibility
- * with other ACPI implementations. NOTE: During ACPICA initialization,
- * this value is set to TRUE if any Windows OSI strings have been
- * requested by the BIOS.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
-
-/*
- * Disable runtime checking and repair of values returned by control methods.
- * Use only if the repair is causing a problem on a particular machine.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
-
-/*
- * Optionally do not load any SSDTs f

[RFC PATCH 04/15] ACPICA: OSL: Cleanup external macros and add stubs for macros.

2013-12-18 Thread Lv Zheng
OSPMs like Linux trend to include all header files but leave empty stub
macros for a feature that is not configured during build.

For macros defined to constants or defined to functions without other
functions referencesd (exceptions are ACPI_ALLOCATE_BUFFER and
ACPI_OFFSET-like macros), it is safe to leave them without protections.

By investigation, there are only the following internal/external
functions referenced by the ACPICA macros:
1. C library functions, including string, ctype, stdarg APIs.  Such
   functionalities are always accessbile in the kernel source tree, so
   it is safe to leave them without protected for Linux.
2. ACPICA OSL functions, such functions are designed to be used only by
   ACPICA internal APIs.  But in the Linux kernel, there are references
   in the macros referencing mutex and memory allocation APIs.
   Fortunately, there is no external users directly invoking ACPI_MUTEX
   OSL functions.  But for ACPI_ALLOCATE and ACPI_ALLOCATE_BUFFER, there
   are AcpiOsFree or kfree called as their reversals.  This patch adds
   mechanism to protect ACPICA memory allocation APIs for Linux so that
   Linux can have full control of such macros to configure them into
   no-ops.
3. ACPI_OFFSET and other macros that would access structure members that
   are not accessible under a specific configuration.  Fortunately,
   currently Linux doesn't use such structure members when CONFIG_ACPI
   is disabled.

Signed-off-by: Lv Zheng 
---
 include/acpi/actypes.h  |   21 +
 include/acpi/platform/aclinux.h |   12 
 2 files changed, 33 insertions(+)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 809b1a0..8332d95 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -329,6 +329,15 @@ typedef u32 acpi_physical_address;
  *
  
**/
 
+#ifdef ACPI_NO_MEM_ALLOCATIONS
+
+#define ACPI_ALLOCATE(a)NULL
+#define ACPI_ALLOCATE_ZEROED(a) NULL
+#define ACPI_FREE(a)
+#define ACPI_MEM_TRACKING(a)
+
+#else  /* ACPI_NO_MEM_ALLOCATIONS */
+
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 /*
  * Memory allocation tracking (used by acpi_exec to detect memory leaks)
@@ -350,6 +359,8 @@ typedef u32 acpi_physical_address;
 
 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 
+#endif /* ACPI_NO_MEM_ALLOCATIONS */
+
 /**
  *
  * ACPI Specification constants (Do not change unless the specification 
changes)
@@ -928,9 +939,19 @@ struct acpi_object_list {
  * Miscellaneous common Data Structures used by the interfaces
  */
 #define ACPI_NO_BUFFER  0
+
+#ifdef ACPI_NO_MEM_ALLOCATIONS
+
+#define ACPI_ALLOCATE_BUFFER(acpi_size) (0)
+#define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (0)
+
+#else  /* ACPI_NO_MEM_ALLOCATIONS */
+
 #define ACPI_ALLOCATE_BUFFER(acpi_size) (-1)
 #define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (-2)
 
+#endif /* ACPI_NO_MEM_ALLOCATIONS */
+
 struct acpi_buffer {
acpi_size length;   /* Length in bytes of the buffer */
void *pointer;  /* pointer to buffer */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5e5de9c..fce521d 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,18 @@
 
 #ifdef __KERNEL__
 
+/* Never using tracking mechanism for Linux kernel */
+
+#undef ACPI_DBG_TRACK_ALLOCATIONS
+
+#ifndef CONFIG_ACPI
+
+/* Generating stubs for configurable ACPICA macros */
+
+#define ACPI_NO_MEM_ALLOCATIONS
+
+#endif
+
 #include 
 #include 
 #include 
-- 
1.7.10.4

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


Re: [PATCH 1/4] Create generic early_ioremap() support

2013-12-18 Thread Dave Young
On 12/17/13 at 01:45pm, Mark Salter wrote:
> On Mon, 2013-12-16 at 09:48 +0800, Dave Young wrote:
> > On 11/27/13 at 09:44pm, Mark Salter wrote:
> > > This patch copies generic bits of x86 early_ioremap() support
> > > into a library for potential use by other architectures.
> > > 
> > > Signed-off-by: Mark Salter 
> > > CC: Arnd Bergmann 
> > > CC: Ingo Molnar 
> > > CC: linux-a...@vger.kernel.org
> > > ---
> > >  include/asm-generic/early_ioremap.h |  40 ++
> > >  lib/Kconfig |   3 +
> > >  lib/Makefile|   1 +
> > >  lib/early_ioremap.c | 243
> > 
> > 
> > I do not understand why these should go to lib/, I feel it's slightly better
> > move them to mm/
> > 
> > ditto about lib/ioremap.c, ...
> > 
> 
> I hadn't really thought about it. Putting these things in mm doesn't
> sound unreasonable, but lib seems to have become the place for a lot
> generic code which could also belong in mm, net, etc.
> 

IMHO, move subsystem lib code to subsystem core dir looks more reasonable.
lib should be the place for general kernel stuff.

I'm not specific for and object this patch, just give my opinion about the 
lib/..

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


[RFC PATCH 13/15] ACPICA: Linux: Remove inclusion from ACPICA headers.

2013-12-18 Thread Lv Zheng
This patch removes  inclusion from  as
it no longer contains useful prototypes for ACPICA.
This patch also introduces a top level header  to be
included by other kernel source code.
Note that this patch changes the logic so that ACPICA header files
inclusions are no longer dependent on CONFIG_ACPI=y environment.

Signed-off-by: Lv Zheng 
---
 include/acpi/platform/aclinux.h |1 -
 include/linux/acpi.h|   13 -
 include/linux/acpica.h  |   22 ++
 3 files changed, 26 insertions(+), 10 deletions(-)
 create mode 100644 include/linux/acpica.h

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index b754bfa..8bdb773 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -83,7 +83,6 @@
 #ifdef CONFIG_ARCH_SUPPORTS_ACPICA
 #include 
 #endif
-#include 
 
 #ifdef CONFIG_ACPI
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 72c88f4..a197f64 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -28,22 +28,17 @@
 #include 
 #include   /* for struct resource */
 #include 
-
-#ifdef CONFIG_ACPI
-
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include 
 #include 
+#include 
+
+#ifdef CONFIG_ACPI
 
-#include 
+#include   /* Definitions in it can be used by  headers 
*/
 #include 
 #include 
 #include 
 #include 
-#include 
 
 static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
 {
diff --git a/include/linux/acpica.h b/include/linux/acpica.h
new file mode 100644
index 000..a67d3cf
--- /dev/null
+++ b/include/linux/acpica.h
@@ -0,0 +1,22 @@
+#ifndef _LINUX_ACPICA_H
+#define _LINUX_ACPICA_H
+
+/*
+ * Top level ACPICA header for Linux kernel
+ *
+ * Copyright (C) 2013, Intel Corporation
+ *   Author: Lv Zheng 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/* Support  inclusions for broken compilers */
+#ifndef _LINUX
+#define _LINUX
+#endif
+
+#include 
+
+#endif /* _LINUX_ACPICA_H */
-- 
1.7.10.4

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


[RFC PATCH 12/15] ACPICA: Linux: Add configuration item to indicate the architecture specific support.

2013-12-18 Thread Lv Zheng
This patch adds a kernel configuration item to indicate the presense of
the architecture specific support for ACPICA, so that 
inclusion can be configured out.

Signed-off-by: Lv Zheng 
---
 arch/ia64/Kconfig   |1 +
 arch/x86/Kconfig|1 +
 drivers/acpi/Kconfig|4 
 include/acpi/platform/aclinux.h |2 ++
 4 files changed, 8 insertions(+)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 4e4119b..c38cc47 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -43,6 +43,7 @@ config IA64
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
select ARCH_USE_CMPXCHG_LOCKREF
+   select ARCH_SUPPORTS_ACPICA
default y
help
  The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e903c71..0fd5a4d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -124,6 +124,7 @@ config X86
select RTC_LIB
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
+   select ARCH_SUPPORTS_ACPICA
 
 config INSTRUCTION_DECODER
def_bool y
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d92485..22e5762 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -2,8 +2,12 @@
 # ACPI Configuration
 #
 
+config ARCH_SUPPORTS_ACPICA
+   bool
+
 menuconfig ACPI
bool "ACPI (Advanced Configuration and Power Interface) Support"
+   depends on ARCH_SUPPORTS_ACPICA
depends on !IA64_HP_SIM
depends on IA64 || X86
depends on PCI
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 8176181..b754bfa 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -80,7 +80,9 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include 
 #endif
+#ifdef CONFIG_ARCH_SUPPORTS_ACPICA
 #include 
+#endif
 #include 
 
 #ifdef CONFIG_ACPI
-- 
1.7.10.4

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


Re: [cfg80211 / iwlwifi] setting wireless regulatory domain doesn't work.

2013-12-18 Thread Arend van Spriel
On 12/17/2013 11:06 PM, Linus Torvalds wrote:
> We have literally had this *exact* same issue with firmware loading.
> Network drivers shouldn't try to load firmware at module load time.
> Same deal.

It is kind of a chicken and egg problem for (wireless) networking
drivers. To get IFF_UP from the network layer you have to register a
netdevice. For wireless drivers this means you have to register a wiphy
device with cfg80211 which flags capabilities and optionally are custom
regulatory domain. That information depends on the device and firmware
used. And there we have a full circle.

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


Re: Simple MFD driver example

2013-12-18 Thread Lee Jones
> On Mon, Dec 16, 2013 at 4:48 PM, Lee Jones  wrote:
> > There isn't any documentation that would help you I fear. I'm trying
> > to help you, but you haven't answered my previous question.
> 
> I did intend to answer your question when I was writing that I would
> send some code. See it at the bottom of the email.
> 
> > Do you have a datasheet for the device that you're trying to enable?
> 
> datasheets.maximintegrated.com/en/ds/MAX6650-MAX6651.pdf

What has alluded you to the fact that this is an MFD device?

a) It doesn't look like one to me

b) This device looks like it's already supported in Mainline

> hwmon is already available in the kernel (for which my simple patch
> was rejected). I have just sent out a gpio driver for the gpio bits,
> and see the mfd driver code below.

I'm not sure why it was rejected, but the MAX6651 already looks
supported to me in:
  drivers/hwmon/max6650.c.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [cfg80211 / iwlwifi] setting wireless regulatory domain doesn't work.

2013-12-18 Thread Grumbach, Emmanuel
> 
> On 12/17/2013 11:06 PM, Linus Torvalds wrote:
> > We have literally had this *exact* same issue with firmware loading.
> > Network drivers shouldn't try to load firmware at module load time.
> > Same deal.
> 
> It is kind of a chicken and egg problem for (wireless) networking drivers. To
> get IFF_UP from the network layer you have to register a netdevice. For
> wireless drivers this means you have to register a wiphy device with cfg80211
> which flags capabilities and optionally are custom regulatory domain. That
> information depends on the device and firmware used. And there we have a
> full circle.
> 

To solve this - iwlwifi uses request_firmware_nowait. Its doc reads:

"Asynchronous variant of request_firmware for user contexts: - sleep for as 
small periods as possible since it may increase kernel boot time of built-in 
device drivers requesting firmware in their ->probe methods, if gfp is 
GFP_KERNEL."


Re: [PATCH V5 0/4] DRIVERS: IRQCHIP: Add support for crossbar IP

2013-12-18 Thread Sricharan R
Hi Thomas,

On Tuesday 03 December 2013 03:57 PM, Sricharan R wrote:
> Some socs have a large number of interrupts requests to service
> the needs of its many peripherals and subsystems. All of the interrupt
> requests lines from the subsystems are not needed at the same
> time, so they have to be muxed to the controllers appropriately.
> In such places a interrupt controllers are preceded by an
> IRQ CROSSBAR that provides flexibility in muxing the device interrupt
> requests to the controller inputs.
> 
> This series models the peripheral interrupts that can be routed through
> the crossbar to the GIC as 'routable-irqs'. The routable irqs are added
> in a separate linear domain inside the GIC. The registered routable domain's
> callback are invoked as a part of the GIC's callback, which in turn should
> allocate a free irq line and configure the IP accordingly. So every peripheral
> in the dts files mentions the fixed crossbar number as its interrupt. A free
> gic line for that gets allocated and configured when the peripheral interrupts
> are mapped.
> 
> The minimal crossbar driver to track and allocate free GIC lines and 
> configure the
> crossbar is added here, along with the DT bindings.
> 
> V5:
>Addressed a comment from Mark Rutland ,
>updated tags and rebased on 3.13-rc2
> 
> V4:
>Addressed a couple of comments and split the DTS file updates in to
>a separate series.
> 
> V3:
>Addressed few more comments from Thomas Gleixner 
> 
>Rebased patches 3,4,5,7 which updates the DTS file on top of below branch
>  
> git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git
>  for_3.13/dts
> 
>Rebased patches 1,2,6 on top of 3.12 mainline
>Updated Commit tags
> 
> V2:
>Addressed Thomas Gleixner  comments and
>Kumar Gala 
> 
>Split updating the DRA7.dtsi file for adding the routable-irqs
> 
> Previous discussions that led to this is at
>   https://lkml.org/lkml/2013/9/18/540
> 
> The V1,V2,V3,V4 post of these patches is at
>   [V1]  https://lkml.org/lkml/2013/9/30/283
>   [V2]  http://www.spinics.net/lists/linux-omap/msg99540.html
>   [V3]  http://www.kernelhub.org/?msg=356470&p=2
>   [V4]  http://www.spinics.net/lists/linux-doc/msg16726.html
> 
> Sricharan R (4):
>   DRIVERS: IRQCHIP: IRQ-GIC: Add support for routable irqs
>   DRIVERS: IRQCHIP: CROSSBAR: Add support for Crossbar IP
>   ARM: OMAP4+: Correct Wakeup-gen code to use physical irq number
>   ARM: DRA: Enable Crossbar IP support for DRA7XX
> 
>  Documentation/devicetree/bindings/arm/gic.txt  |6 +
>  .../devicetree/bindings/arm/omap/crossbar.txt  |   27 +++
>  arch/arm/mach-omap2/Kconfig|1 +
>  arch/arm/mach-omap2/omap-wakeupgen.c   |4 +-
>  arch/arm/mach-omap2/omap4-common.c |2 +
>  drivers/irqchip/Kconfig|8 +
>  drivers/irqchip/Makefile   |1 +
>  drivers/irqchip/irq-crossbar.c |  208 
> 
>  drivers/irqchip/irq-gic.c  |   81 +++-
>  include/linux/irqchip/arm-gic.h|7 +-
>  include/linux/irqchip/irq-crossbar.h   |   11 ++
>  11 files changed, 343 insertions(+), 13 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/arm/omap/crossbar.txt
>  create mode 100644 drivers/irqchip/irq-crossbar.c
>  create mode 100644 include/linux/irqchip/irq-crossbar.h
> 

I have addressed all the comments on this series, can this be merged now ?

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


[PATCH 0/9] Input: pixcir_i2c_ts: Add Type-B Multitouch support

2013-12-18 Thread Roger Quadros
Hi,

Some variants of the Pixcir I2C touch controller are more suitable for
Type-B multi-touch reporting (e.g. Tango C). This series enhances the driver
to support Type-B multi-touch reports. It also adds device tree support
and power management.

cheers,
-roger

Roger Quadros (9):
  Input: pixcir_i2c_ts: Add device tree support
  Input: pixcir_i2c_ts: Add register definitions
  Input: pixcir_i2c_ts: Initialize interrupt mode and power mode
  Input: pixcir_i2c_ts: Use devres managed resource allocations
  Input: pixcir_i2c_ts: Get rid of pdata->attb_read_val()
  Input: pixcir_i2c_ts: Add chip specific data structure
  Input: pixcir_i2c_ts: Implement Type B Multi Touch reporting
  Input: pixcir_i2c_ts: Add support for TangoC family
  Input: pixcir_i2c_ts: Implement wakeup from suspend

 .../bindings/input/touchscreen/pixcir_i2c_ts.txt   |  26 +
 drivers/input/touchscreen/pixcir_i2c_ts.c  | 570 +
 include/linux/input/pixcir_ts.h|  59 ++-
 3 files changed, 564 insertions(+), 91 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt

-- 
1.8.3.2

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


[PATCH 2/9] Input: pixcir_i2c_ts: Add register definitions

2013-12-18 Thread Roger Quadros
Add power and interrupt register definitions.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 include/linux/input/pixcir_ts.h | 42 +
 1 file changed, 42 insertions(+)

diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index b34ff7e..f17c192 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -1,6 +1,48 @@
 #ifndef_PIXCIR_I2C_TS_H
 #define_PIXCIR_I2C_TS_H
 
+/*
+ * Register map
+ */
+#define PIXCIR_REG_POWER_MODE  51
+#define PIXCIR_REG_INT_MODE52
+
+/*
+ * Power modes:
+ * active: max scan speed
+ * idle: lower scan speed with automatic transition to active on touch
+ * halt: datasheet says sleep but this is more like halt as the chip
+ *   clocks are cut and it can only be brought out of this mode
+ *  using the RESET pin.
+ */
+enum pixcir_power_mode {
+   PIXCIR_POWER_ACTIVE,
+   PIXCIR_POWER_IDLE,
+   PIXCIR_POWER_HALT,
+};
+
+#define PIXCIR_POWER_MODE_MASK 0x03
+#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
+
+/*
+ * Interrupt modes:
+ * periodical: interrupt is asserted periodicaly
+ * diff coordinates: interrupt is asserted when coordinates change
+ * level on touch: interrupt level asserted during touch
+ * pulse on touch: interrupt pulse asserted druing touch
+ *
+ */
+enum pixcir_int_mode {
+   PIXCIR_INT_PERIODICAL,
+   PIXCIR_INT_DIFF_COORD,
+   PIXCIR_INT_LEVEL_TOUCH,
+   PIXCIR_INT_PULSE_TOUCH,
+};
+
+#define PIXCIR_INT_MODE_MASK   0x03
+#define PIXCIR_INT_ENABLE  (1UL << 3)
+#define PIXCIR_INT_POL_HIGH(1UL << 2)
+
 struct pixcir_ts_platform_data {
int (*attb_read_val)(void);
unsigned int x_size;/* X axis resolution */
-- 
1.8.3.2

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


[PATCH 6/9] Input: pixcir_i2c_ts: Add chip specific data structure

2013-12-18 Thread Roger Quadros
This is the data that differentiates different pixcir
chips.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c |  8 +---
 include/linux/input/pixcir_ts.h   | 11 +++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index a783d94..ff68246 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -32,7 +32,7 @@
 struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
-   const struct pixcir_ts_platform_data *chip;
+   const struct pixcir_ts_platform_data *pdata;
bool exiting;
 };
 
@@ -91,7 +91,7 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data 
*data)
 static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
 {
struct pixcir_i2c_ts_data *tsdata = dev_id;
-   const struct pixcir_ts_platform_data *pdata = tsdata->chip;
+   const struct pixcir_ts_platform_data *pdata = tsdata->pdata;
 
while (!tsdata->exiting) {
pixcir_ts_poscheck(tsdata);
@@ -301,6 +301,8 @@ static struct pixcir_ts_platform_data 
*pixcir_parse_dt(struct device *dev)
if (!pdata)
return ERR_PTR(-ENOMEM);
 
+   pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data;
+
pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
if (!gpio_is_valid(pdata->gpio_attb)) {
dev_err(dev, "Failed to get ATTB GPIO\n");
@@ -366,7 +368,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 
tsdata->client = client;
tsdata->input = input;
-   tsdata->chip = pdata;
+   tsdata->pdata = pdata;
 
input->name = client->name;
input->id.bustype = BUS_I2C;
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 88ffdb50..b9a2f6f 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,21 @@ enum pixcir_int_mode {
 #define PIXCIR_INT_ENABLE  (1UL << 3)
 #define PIXCIR_INT_POL_HIGH(1UL << 2)
 
+/**
+ * struct pixcir_irc_chip_data - chip related data
+ * @num_report_ids: Max number of finger ids reported simultaneously.
+ *  if 0 it means chip doesn't support finger id reporting
+ *  and driver will resort to Type A Multi-Touch reporting.
+ */
+struct pixcir_i2c_chip_data {
+   u8 num_report_ids;
+};
+
 struct pixcir_ts_platform_data {
unsigned int x_size;/* X axis resolution */
unsigned int y_size;/* Y axis resolution */
int gpio_attb;  /* GPIO connected to ATTB line */
+   struct pixcir_i2c_chip_data chip;
 };
 
 #endif
-- 
1.8.3.2

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


[PATCH 3/9] Input: pixcir_i2c_ts: Initialize interrupt mode and power mode

2013-12-18 Thread Roger Quadros
Introduce helper functions to configure power and interrupt
registers. Default to IDLE mode on probe as device supports
auto wakeup to ACVIE mode on detecting finger touch.

Configure interrupt mode and polarity on start up.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 168 ++
 1 file changed, 168 insertions(+)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 3a447c9..ce8abcd 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -104,6 +104,160 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
return IRQ_HANDLED;
 }
 
+static int pixcir_set_power_mode(struct pixcir_i2c_ts_data *ts,
+   enum pixcir_power_mode mode)
+{
+   struct device *dev = &ts->client->dev;
+   int ret;
+
+   ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_POWER_MODE);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't read reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_POWER_MODE, ret);
+   return ret;
+   }
+
+   ret &= ~PIXCIR_POWER_MODE_MASK;
+   ret |= mode;
+
+   /* Always AUTO_IDLE */
+   ret |= PIXCIR_POWER_ALLOW_IDLE;
+
+   ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_POWER_MODE, ret);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't write reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_POWER_MODE, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+/*
+ * Set the interrupt mode for the device i.e. ATTB line behaviour
+ *
+ * @polarity : 1 for active high, 0 for active low.
+ */
+static int pixcir_set_int_mode(struct pixcir_i2c_ts_data *ts,
+   enum pixcir_int_mode mode,
+   bool polarity)
+{
+   struct device *dev = &ts->client->dev;
+   int ret;
+
+   ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't read reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_INT_MODE, ret);
+   return ret;
+   }
+
+   ret &= ~PIXCIR_INT_MODE_MASK;
+   ret |= mode;
+
+   if (polarity)
+   ret |= PIXCIR_INT_POL_HIGH;
+   else
+   ret &= ~PIXCIR_INT_POL_HIGH;
+
+   ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't write reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_INT_MODE, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+/*
+ * Enable/disable interrupt generation
+ */
+static int pixcir_int_enable(struct pixcir_i2c_ts_data *ts, bool enable)
+{
+   struct device *dev = &ts->client->dev;
+   int ret;
+
+   ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't read reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_INT_MODE, ret);
+   return ret;
+   }
+
+   if (enable)
+   ret |= PIXCIR_INT_ENABLE;
+   else
+   ret &= ~PIXCIR_INT_ENABLE;
+
+   ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
+   if (ret < 0) {
+   dev_err(dev, "%s: can't write reg 0x%x : %d\n",
+   __func__, PIXCIR_REG_INT_MODE, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int pixcir_start(struct pixcir_i2c_ts_data *ts)
+{
+   struct device *dev = &ts->client->dev;
+   int ret;
+
+   /* LEVEL_TOUCH interrupt with active low polarity */
+   ret = pixcir_set_int_mode(ts, PIXCIR_INT_LEVEL_TOUCH, 0);
+   if (ret) {
+   dev_err(dev, "Failed to set interrupt mode\n");
+   return ret;
+   }
+
+   enable_irq(ts->client->irq);
+
+   /* enable interrupt generation */
+   ret = pixcir_int_enable(ts, 1);
+   if (ret) {
+   dev_err(dev, "Failed to enable interrupt generation\n");
+   return ret;
+   }
+
+   return 0;
+}
+
+static int pixcir_stop(struct pixcir_i2c_ts_data *ts)
+{
+   struct device *dev = &ts->client->dev;
+   int ret;
+
+   /* disable interrupt generation */
+   ret = pixcir_int_enable(ts, 0);
+   if (ret) {
+   dev_err(dev, "Failed to disable interrupt generation\n");
+   return ret;
+   }
+
+   disable_irq(ts->client->irq);
+
+   return 0;
+}
+
+static int pixcir_input_open(struct input_dev *dev)
+{
+   struct pixcir_i2c_ts_data *ts = input_get_drvdata(dev);
+
+   return pixcir_start(ts);
+}
+
+static void pixcir_input_close(struct input_dev *de

[PATCH 8/9] Input: pixcir_i2c_ts: Add support for TangoC family

2013-12-18 Thread Roger Quadros
Add support for Pixcir TangoC controller.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 .../devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt | 2 +-
 drivers/input/touchscreen/pixcir_i2c_ts.c   | 6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt 
b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
index c0b0b270..0ab9505 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
@@ -1,7 +1,7 @@
 * Pixcir I2C touchscreen controllers
 
 Required properties:
-- compatible: must be "pixcir,pixcir_ts"
+- compatible: must be "pixcir,pixcir_ts" or "pixcir,pixcir_tangoc"
 - reg: I2C address of the chip
 - interrupts: interrupt to which the chip is connected
 - attb-gpio: GPIO connected to the ATTB line of the chip
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 9e14415..3575eab 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -549,13 +549,19 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
 
 static const struct i2c_device_id pixcir_i2c_ts_id[] = {
{ "pixcir_ts", 0 },
+   { "pixcir_tangoc", 0},
{ }
 };
 MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id);
 
 #if defined(CONFIG_OF)
+static const struct pixcir_i2c_chip_data tangoc_data = {
+   .num_report_ids = 5,
+};
+
 static const struct of_device_id pixcir_of_match[] = {
{ .compatible = "pixcir,pixcir_ts", },
+   { .compatible = "pixcir,pixcir_tangoc", .data = &tangoc_data, },
{ }
 };
 MODULE_DEVICE_TABLE(of, pixcir_of_match);
-- 
1.8.3.2

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


[PATCH 5/9] Input: pixcir_i2c_ts: Get rid of pdata->attb_read_val()

2013-12-18 Thread Roger Quadros
Get rid of the attb_read_val() platform hook. Instead,
read the ATTB gpio directly from the driver.

Fail if valid ATTB gpio is not provided by patform data.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 19 +--
 include/linux/input/pixcir_ts.h   |  1 -
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 3370fd9..a783d94 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -91,11 +91,12 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data 
*data)
 static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
 {
struct pixcir_i2c_ts_data *tsdata = dev_id;
+   const struct pixcir_ts_platform_data *pdata = tsdata->chip;
 
while (!tsdata->exiting) {
pixcir_ts_poscheck(tsdata);
 
-   if (tsdata->chip->attb_read_val())
+   if (gpio_get_value(pdata->gpio_attb))
break;
 
msleep(20);
@@ -301,8 +302,10 @@ static struct pixcir_ts_platform_data 
*pixcir_parse_dt(struct device *dev)
return ERR_PTR(-ENOMEM);
 
pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
-   if (!gpio_is_valid(pdata->gpio_attb))
+   if (!gpio_is_valid(pdata->gpio_attb)) {
dev_err(dev, "Failed to get ATTB GPIO\n");
+   return ERR_PTR(-EINVAL);
+   }
 
if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
dev_err(dev, "Failed to get x-size property\n");
@@ -344,6 +347,11 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
} else if (!pdata) {
dev_err(&client->dev, "platform data not defined\n");
return -EINVAL;
+   } else {
+   if (!gpio_is_valid(pdata->gpio_attb)) {
+   dev_err(dev, "Invalid gpio_attb in pdata\n");
+   return -EINVAL;
+   }
}
 
tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
@@ -380,6 +388,13 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 
input_set_drvdata(input, tsdata);
 
+   error = devm_gpio_request_one(dev, pdata->gpio_attb,
+   GPIOF_DIR_IN, "pixcir_i2c_attb");
+   if (error) {
+   dev_err(dev, "Failed to request ATTB gpio\n");
+   return error;
+   }
+
error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 client->name, tsdata);
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index f17c192..88ffdb50 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -44,7 +44,6 @@ enum pixcir_int_mode {
 #define PIXCIR_INT_POL_HIGH(1UL << 2)
 
 struct pixcir_ts_platform_data {
-   int (*attb_read_val)(void);
unsigned int x_size;/* X axis resolution */
unsigned int y_size;/* Y axis resolution */
int gpio_attb;  /* GPIO connected to ATTB line */
-- 
1.8.3.2

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


Re: [PATCH] mfd: wm8994: Allow modular build

2013-12-18 Thread Charles Keepax
On Tue, Dec 17, 2013 at 11:29:51PM +, Mark Brown wrote:
> From: Mark Brown 
> 
> The interfaces that used to be built in only (interrupts IIRC) no longer
> are so allow the driver to be built as a module fixing arm64 allmodconfig
> builds.
> 
> Signed-off-by: Mark Brown 
> ---

Acked-by: Charles Keepax 

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


[PATCH 9/9] Input: pixcir_i2c_ts: Implement wakeup from suspend

2013-12-18 Thread Roger Quadros
Improve the suspend and resume handlers to allow the device
to wakeup the system from suspend.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 89 ++-
 1 file changed, 63 insertions(+), 26 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 3575eab..a7725b9 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -347,32 +347,6 @@ static void pixcir_input_close(struct input_dev *dev)
return;
 }
 
-
-#ifdef CONFIG_PM_SLEEP
-static int pixcir_i2c_ts_suspend(struct device *dev)
-{
-   struct i2c_client *client = to_i2c_client(dev);
-
-   if (device_may_wakeup(&client->dev))
-   enable_irq_wake(client->irq);
-
-   return 0;
-}
-
-static int pixcir_i2c_ts_resume(struct device *dev)
-{
-   struct i2c_client *client = to_i2c_client(dev);
-
-   if (device_may_wakeup(&client->dev))
-   disable_irq_wake(client->irq);
-
-   return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
-pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume);
-
 #if defined(CONFIG_OF)
 static const struct of_device_id pixcir_of_match[];
 
@@ -547,6 +521,69 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int pixcir_i2c_ts_suspend(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
+   struct input_dev *input = ts->input;
+   int ret = 0;
+
+   mutex_lock(&input->mutex);
+
+   if (device_may_wakeup(&client->dev)) {
+   /* need to start device if not open, to be wakeup source */
+   if (!input->users) {
+   ret = pixcir_start(ts);
+   if (ret)
+   goto unlock;
+   }
+
+   enable_irq_wake(client->irq);
+
+   } else if (input->users) {
+   ret = pixcir_stop(ts);
+   }
+
+unlock:
+   mutex_unlock(&input->mutex);
+
+   return ret;
+}
+
+static int pixcir_i2c_ts_resume(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
+   struct input_dev *input = ts->input;
+   int ret = 0;
+
+   mutex_lock(&input->mutex);
+
+   if (device_may_wakeup(&client->dev)) {
+   disable_irq_wake(client->irq);
+
+   /* need to stop device if it was not open on suspend */
+   if (!input->users) {
+   ret = pixcir_stop(ts);
+   if (ret)
+   goto unlock;
+   }
+
+   } else if (input->users) {
+   ret = pixcir_start(ts);
+   }
+
+unlock:
+   mutex_unlock(&input->mutex);
+
+   return ret;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
+   pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume);
+
 static const struct i2c_device_id pixcir_i2c_ts_id[] = {
{ "pixcir_ts", 0 },
{ "pixcir_tangoc", 0},
-- 
1.8.3.2

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


Re: [cfg80211 / iwlwifi] setting wireless regulatory domain doesn't work.

2013-12-18 Thread Sander Eikelenboom

Wednesday, December 18, 2013, 10:16:38 AM, you wrote:

> On 12/17/2013 11:06 PM, Linus Torvalds wrote:
>> We have literally had this *exact* same issue with firmware loading.
>> Network drivers shouldn't try to load firmware at module load time.
>> Same deal.

> It is kind of a chicken and egg problem for (wireless) networking
> drivers. To get IFF_UP from the network layer you have to register a
> netdevice. For wireless drivers this means you have to register a wiphy
> device with cfg80211 which flags capabilities and optionally are custom
> regulatory domain. That information depends on the device and firmware
> used. And there we have a full circle.

Very well, but:

If it can't access the CRDA and it is setting the world domain, why on earth is 
it blocking any
subsequent requests to setting the regulatory domain from userspace when the 
CRDA *is* accessible ?

I mean, i could see the need to do something *temporary* at boot when accessing 
the CRDA fails and to take the most
safe default for the time being ..

The BUG is that it is NOT temporary, but blocking until next reboot because the 
first request wasn't completely processed.
My hostapd will try to set the domain when it starts and at that point the CRDA 
is accessible, so it would set it from the temporary
domain to the one specified, as long as it isn't blocking.

> Regards,
> Arend


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


[PATCH 4/9] Input: pixcir_i2c_ts: Use devres managed resource allocations

2013-12-18 Thread Roger Quadros
Use devm_() and friends for allocating memory, input device
and IRQ.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 35 ---
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index ce8abcd..3370fd9 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -346,12 +346,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return -EINVAL;
}
 
-   tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
-   input = input_allocate_device();
-   if (!tsdata || !input) {
-   dev_err(&client->dev, "Failed to allocate driver data!\n");
-   error = -ENOMEM;
-   goto err_free_mem;
+   tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
+   if (!tsdata)
+   return -ENOMEM;
+
+   input = devm_input_allocate_device(dev);
+   if (!input) {
+   dev_err(&client->dev, "Failed to allocate input device\n");
+   return -ENOMEM;
}
 
tsdata->client = client;
@@ -378,12 +380,12 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 
input_set_drvdata(input, tsdata);
 
-   error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr,
+   error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 client->name, tsdata);
if (error) {
-   dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-   goto err_free_mem;
+   dev_err(dev, "failed to request irq %d\n", client->irq);
+   return error;
}
 
/* Always be in IDLE mode to save power, device supports auto wake */
@@ -396,23 +398,16 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
/* Stop device till opened */
error = pixcir_stop(tsdata);
if (error)
-   goto err_free_irq;
+   return error;
 
error = input_register_device(input);
if (error)
-   goto err_free_irq;
+   return error;
 
i2c_set_clientdata(client, tsdata);
device_init_wakeup(&client->dev, 1);
 
return 0;
-
-err_free_irq:
-   free_irq(client->irq, tsdata);
-err_free_mem:
-   input_free_device(input);
-   kfree(tsdata);
-   return error;
 }
 
 static int pixcir_i2c_ts_remove(struct i2c_client *client)
@@ -423,10 +418,6 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
 
tsdata->exiting = true;
mb();
-   free_irq(client->irq, tsdata);
-
-   input_unregister_device(tsdata->input);
-   kfree(tsdata);
 
return 0;
 }
-- 
1.8.3.2

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


[PATCH 7/9] Input: pixcir_i2c_ts: Implement Type B Multi Touch reporting

2013-12-18 Thread Roger Quadros
Some pixcir controllers e.g. tangoC family report finger IDs with
the co-ordinates and are more suitable for Type-B MT protocol.

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 202 +++---
 1 file changed, 155 insertions(+), 47 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index ff68246..9e14415 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -23,84 +23,173 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
+#define MAX_FINGERS5   /* Maximum supported by the driver */
+
 struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
const struct pixcir_ts_platform_data *pdata;
bool exiting;
+   u8 max_fingers; /* Maximum supported by the chip */
 };
 
-static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
+static void pixcir_ts_typea_report(struct pixcir_i2c_ts_data *tsdata)
 {
-   struct pixcir_i2c_ts_data *tsdata = data;
+   const struct pixcir_ts_platform_data *pdata = tsdata->pdata;
u8 rdbuf[10], wrbuf[1] = { 0 };
u8 touch;
int ret;
 
-   ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
-   if (ret != sizeof(wrbuf)) {
-   dev_err(&tsdata->client->dev,
-   "%s: i2c_master_send failed(), ret=%d\n",
-   __func__, ret);
-   return;
-   }
+   while (!tsdata->exiting) {
 
-   ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf));
-   if (ret != sizeof(rdbuf)) {
-   dev_err(&tsdata->client->dev,
-   "%s: i2c_master_recv failed(), ret=%d\n",
-   __func__, ret);
-   return;
-   }
+   ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
+   if (ret != sizeof(wrbuf)) {
+   dev_err(&tsdata->client->dev,
+"%s: i2c_master_send failed(), ret=%d\n",
+__func__, ret);
+   return;
+   }
+
+   ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf));
+   if (ret != sizeof(rdbuf)) {
+   dev_err(&tsdata->client->dev,
+"%s: i2c_master_recv failed(), ret=%d\n",
+__func__, ret);
+   return;
+   }
 
-   touch = rdbuf[0];
-   if (touch) {
-   u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
-   u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
-   u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
-   u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
-
-   input_report_key(tsdata->input, BTN_TOUCH, 1);
-   input_report_abs(tsdata->input, ABS_X, posx1);
-   input_report_abs(tsdata->input, ABS_Y, posy1);
-
-   input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1);
-   input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1);
-   input_mt_sync(tsdata->input);
-
-   if (touch == 2) {
-   input_report_abs(tsdata->input,
-ABS_MT_POSITION_X, posx2);
-   input_report_abs(tsdata->input,
-ABS_MT_POSITION_Y, posy2);
+   touch = rdbuf[0];
+   if (touch) {
+   u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
+   u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
+   u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
+   u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
+
+   input_report_key(tsdata->input, BTN_TOUCH, 1);
+   input_report_abs(tsdata->input, ABS_X, posx1);
+   input_report_abs(tsdata->input, ABS_Y, posy1);
+
+   input_report_abs(tsdata->input, ABS_MT_POSITION_X,
+   posx1);
+   input_report_abs(tsdata->input, ABS_MT_POSITION_Y,
+   posy1);
input_mt_sync(tsdata->input);
+
+   if (touch == 2) {
+   input_report_abs(tsdata->input,
+   ABS_MT_POSITION_X, posx2);
+   input_report_abs(tsdata->input,
+   ABS_MT_POSITION_Y, posy2);
+   input_mt_sync(tsdata->input);
+   }
+   } else {
+   input_report_key(tsdata->input, BTN_TOUCH, 0);
 

Re: [cfg80211 / iwlwifi] setting wireless regulatory domain doesn't work.

2013-12-18 Thread Johannes Berg
Hi all,

We really should be asking Luis to look at this who hasn't yet chimed
in, presumably because he's between jobs (and travelling IIRC)

On Wed, 2013-12-18 at 10:16 +0100, Arend van Spriel wrote:
> On 12/17/2013 11:06 PM, Linus Torvalds wrote:
> > We have literally had this *exact* same issue with firmware loading.
> > Network drivers shouldn't try to load firmware at module load time.
> > Same deal.
> 
> It is kind of a chicken and egg problem for (wireless) networking
> drivers. To get IFF_UP from the network layer you have to register a
> netdevice. For wireless drivers this means you have to register a wiphy
> device with cfg80211 which flags capabilities and optionally are custom
> regulatory domain. That information depends on the device and firmware
> used. And there we have a full circle.

This is all really beside the point.

For this CRDA information, the kernel never actually *waits* for it, so
in the case that there's no reply, it uses the built-in world domain. So
it's not like request_firmware(), which will block boot forever, but
it's also not like request_firmware_nowait() which will eventually time
out and come back with an error if userspace isn't handling it (though
now that firmware loading is built in ...)

The issue is that it uses the built-in data *forever*, and what Sander
said was "or it will block forever" but just meant that it never was
able to do any further updates.

It *doesn't* actually block the boot process or such. Everything Linus
said is true but seems to have been written in understanding "blocks" as
"blocking the boot process", rather than "blocking further updates".

Regardless of this, even blocking further updates is a really bad idea.
There are a few ways to handle this, but I'll let Luis poke at that.

johannes

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


[PATCH 1/9] Input: pixcir_i2c_ts: Add device tree support

2013-12-18 Thread Roger Quadros
Provide device tree support and binding information.
Change platform data parameters from x/y_max to x/y_size..

Signed-off-by: Roger Quadros 
Acked-by: Mugunthan V N 
---
 .../bindings/input/touchscreen/pixcir_i2c_ts.txt   | 26 
 drivers/input/touchscreen/pixcir_i2c_ts.c  | 77 --
 include/linux/input/pixcir_ts.h|  5 +-
 3 files changed, 101 insertions(+), 7 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt

diff --git 
a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt 
b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
new file mode 100644
index 000..c0b0b270
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
@@ -0,0 +1,26 @@
+* Pixcir I2C touchscreen controllers
+
+Required properties:
+- compatible: must be "pixcir,pixcir_ts"
+- reg: I2C address of the chip
+- interrupts: interrupt to which the chip is connected
+- attb-gpio: GPIO connected to the ATTB line of the chip
+- x-size: horizontal resolution of touchscreen
+- y-size: vertical resolution of touchscreen
+
+Example:
+
+   i2c@ {
+   /* ... */
+
+   pixcir_ts@5c {
+   compatible = "pixcir,pixcir_ts";
+   reg = <0x5c>;
+   interrupts = <2 0>;
+   attb-gpio = <&gpf 2 0 2>;
+   x-size = <800>;
+   y-size = <600>;
+   };
+
+   /* ... */
+   };
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 6cc6b36..3a447c9 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -24,6 +24,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 struct pixcir_i2c_ts_data {
struct i2c_client *client;
@@ -125,15 +129,65 @@ static int pixcir_i2c_ts_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
 pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id pixcir_of_match[];
+
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+   struct pixcir_ts_platform_data *pdata;
+   struct device_node *np = dev->of_node;
+   const struct of_device_id *match;
+
+   match = of_match_device(of_match_ptr(pixcir_of_match), dev);
+   if (!match)
+   return ERR_PTR(-EINVAL);
+
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return ERR_PTR(-ENOMEM);
+
+   pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
+   if (!gpio_is_valid(pdata->gpio_attb))
+   dev_err(dev, "Failed to get ATTB GPIO\n");
+
+   if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
+   dev_err(dev, "Failed to get x-size property\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
+   dev_err(dev, "Failed to get y-size property\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
+   pdata->x_size, pdata->y_size, pdata->gpio_attb);
+
+   return pdata;
+}
+#else
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+   return NULL;
+}
+#endif
+
 static int pixcir_i2c_ts_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
const struct pixcir_ts_platform_data *pdata = client->dev.platform_data;
+   struct device *dev = &client->dev;
+   struct device_node *np = dev->of_node;
struct pixcir_i2c_ts_data *tsdata;
struct input_dev *input;
int error;
 
-   if (!pdata) {
+   if (np) {
+   pdata = pixcir_parse_dt(dev);
+   if (IS_ERR(pdata))
+   return PTR_ERR(pdata);
+
+   } else if (!pdata) {
dev_err(&client->dev, "platform data not defined\n");
return -EINVAL;
}
@@ -157,10 +211,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
__set_bit(EV_KEY, input->evbit);
__set_bit(EV_ABS, input->evbit);
__set_bit(BTN_TOUCH, input->keybit);
-   input_set_abs_params(input, ABS_X, 0, pdata->x_max, 0, 0);
-   input_set_abs_params(input, ABS_Y, 0, pdata->y_max, 0, 0);
-   input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0);
-   input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0);
+   input_set_abs_params(input, ABS_X,
+   0, pdata->x_size - 1, 0, 0);
+   input_set_abs_params(input, ABS_Y,
+   0, pdata->y_size - 1, 0, 0);
+

Re: [PATCH v4 0/2] mfd: rtsx: decrease driver size and add new device

2013-12-18 Thread Lee Jones
On Wed, 18 Dec 2013, micky_ch...@realsil.com.cn wrote:

> From: Micky Ching 
> 
> we add a macro to simplify setting pull control, and use a common init
> function to init the common params for 8411-like chips. at last we add
> support for rtl8402 chip.
> 
> Micky Ching (2):
>   mfd: rtsx: add set pull control macro and simplify rtl8411
>   mfd: rtsx: add support for card reader rtl8402
> 
>  drivers/mfd/rtl8411.c  |   95 
> ++--
>  drivers/mfd/rtsx_pcr.c |5 +++
>  drivers/mfd/rtsx_pcr.h |9 +
>  3 files changed, 66 insertions(+), 43 deletions(-)

Nice.

Applied with Dan's Reviewed-by.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cgroup filter on physics interface can't control container

2013-12-18 Thread Libo Chen
hello guys,

I said before "we can save sk_classid before skb_scrub_packet and
restore it after that"  since skb->sk had been freed in
skb_scrub_packet(), so it is not reasonable. yes?

I have another idea.
commit:f84517253(cls_cgroup: Store classid in struct sock) introduces
sk_classid and put it in skb->sk pointer.  can we put sk_classid form
struct sock to struct sk_buff? then sk_classid will not be affected
by dev_forward_skb()->skb_scrub_packet() ?

any comment are welcome!


thanks,
Libo


On 2013/12/12 20:18, Libo Chen wrote:
> ping...
> 
> On 2013/12/9 10:32, Libo Chen wrote:
>> hello network hackers,
>>
>>  A linux container was builded with veth pair(veth0 inside container, 
>> veth1 outside container),
>>
>> the config as below:
>>
>>   lxc.network.type = veth
>>   lxc.network.flags = up
>>   lxc.network.link = br0  // base on eth0
>>   lxc.network.name = eth0
>>   lxc.network.ipv4 = 128.5.130.26/24
>>
>> then I use tc command with cgroup filter on veth0, it works well. But when 
>> setting on eth0, it doesn`t work.
>>
>> The reason is dev_forward_skb() in veth_xmit will call skb_scrub_packet and 
>> clean all information including skb->sk
>> in the skb, so if cls_cgroup_classify is working in serving softirq state, 
>> it will return failer, see below:
>>
>>  if (in_serving_softirq()) {
>>  /* If there is an sk_classid we'll use that. */
>>  if (!skb->sk)
>>  return -1;
>>  classid = skb->sk->sk_classid;
>>  }
>>
>>
>> Qdisc with cgroup filter on physics interface can not control a container 
>> network, it is disappointed.
>>
>> we can save sk_classid before skb_scrub_packet and restore it after that. Is 
>> it reasonable?  or any way to achieve this?
>>
>> thanks,
>> Libo
>>
> 


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


Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread Ingo Molnar

* David Herrmann  wrote:

> Hi
> 
> On Wed, Dec 18, 2013 at 8:42 AM, Takashi Iwai  wrote:
> > Hi,
> >
> > with the recent enablement of simplefb on x86, cirrusdrmfb on QEMU/KVM
> > gets broken now, as reported at:
> > https://bugzilla.novell.com/show_bug.cgi?id=855821
> >
> > The cirrus VGA resource is reserved at first as "BOOTFB" in
> > arch/x86/kernel/sysfb_simplefb.c, which is taken by simplefb platform
> > device.  This resource is, however, never released until the platform
> > device is destroyed, and the framebuffer switching doesn't trigger
> > it.  It calls fb's destroy callback, at most.  Then, cirrus driver
> > tries to assign the resource, fails and gives up, resulting in a
> > complete blank screen.
> >
> > The same problem should exist on other KMS drivers like mgag200 or
> > ast, not only cirrus.  Intel graphics doesn't hit this problem just
> > because the reserved iomem by BOOTFB isn't required by i915 driver.
> >
> > The patch below is a quick attempt to solve the issue.  It adds a new
> > API function for releasing resources of platform_device, and call it
> > in destroy op of simplefb.  But, forcibly releasing resources of a
> > parent device doesn't sound like a correct design.  We may take such
> > as a band aid, but definitely need a more fundamental fix.
> >
> > Any thoughts?
> 
> That bug always existed, simplefb is just the first driver to hit it 
> (vesafb/efifb didn't use resources). I'm aware of the issue but as a 
> workaround you can simply disable CONFIG_X86_SYSFB. That restores 
> the old behavior.

This looks like a regression, so we'll either need a fix or we'll have 
to mark CONFIG_X86_SYSFB as CONFIG_BROKEN.

> As a proper fix, I'd propose something like:
>   dev = platform_find_device("platform-framebuffer");
>   platform_remove_device(dev);
> 
> And we wrap this as:
>   sysfb_remove_framebuffers()
> in arch/x86/kernel/sysfb.c
> 
> This should cause a ->remove() event for the platform-driver and
> correctly release the resources. Comments?
> I will try to write a patch and send it later.

A fix would be awesome.

Thanks,

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


Re: [PATCH v6 14/14] x86: kdebugfs do not use __va for getting setup_data virt addr

2013-12-18 Thread Dave Young
> > 
> > Reproduced it again in normal boot with memmap=exactmap, but I agree it's a 
> > corner
> > case, I remember I saw this in kdump kernel, but I still did not see it in 
> > today's
> > testing so I think move this issue out of this patch series is fine to me.
>  
> Please include the following oops when you submit this patch again.

Sure, will do if I can reproduce it again in kdump kernel.

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


[GIT PULL] Xilinx Zynq mmc changes for v3.14

2013-12-18 Thread Michal Simek
Hi Chris,

Soren and I are trying to reach you regarding Arasan driver we sent to mailing 
list
for review. There are no complains about this version 3 that's why I have added
to our repo and sending you this pull request.

Patches:
http://lkml.org/lkml/2013/12/2/413
http://lkml.org/lkml/2013/12/2/424

Thanks for pulling these changes to your tree.

This driver was also requested to add LTSI that's why I am CC'ing Greg.

Thanks,
Michal


The following changes since commit dc1ccc48159d63eca5089e507c82c7d22ef60839:

  Linux 3.13-rc2 (2013-11-29 12:57:14 -0800)

are available in the git repository at:

  git://git.xilinx.com/linux-xlnx.git tags/zynq-mmc-for-3.14

for you to fetch changes up to da48f3cfb6d5dc0859dc4b77a145df5c749d2ea4:

  arm: dt: zynq: Add SDHCI nodes (2013-12-18 10:27:50 +0100)


arm: Xilinx Zynq mmc patches for v3.14

- Add support for Arasan SDHCI
- Add nodes to DTS files


Soren Brinkmann (2):
  mmc: arasan: Add driver for Arasan SDHCI
  arm: dt: zynq: Add SDHCI nodes

 Documentation/devicetree/bindings/mmc/arasan,sdhci.txt |  27 
+
 MAINTAINERS|   1 +
 arch/arm/boot/dts/zynq-7000.dtsi   |  20 
 arch/arm/boot/dts/zynq-zc702.dts   |   4 
 arch/arm/boot/dts/zynq-zc706.dts   |   4 
 arch/arm/boot/dts/zynq-zed.dts |   4 
 drivers/mmc/host/Kconfig   |  12 ++
 drivers/mmc/host/Makefile  |   1 +
 drivers/mmc/host/sdhci-of-arasan.c | 224 
++
 9 files changed, 297 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
 create mode 100644 drivers/mmc/host/sdhci-of-arasan.c


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 3.5 037/103] [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers

2013-12-18 Thread Luis Henriques
Hi Martin,

On Tue, Dec 17, 2013 at 05:13:26PM -0500, Martin K. Petersen wrote:
> > "Luis" == Luis Henriques  writes:
> 
> Luis> 3.5.7.28 -stable review patch.  If anyone has any objections,
> Luis>  please let me know.
> 
> Luis>   - dropped changes to drivers/scsi/sd.c ]
> 
> WRITE SAME support didn't go in until 3.7. And without the sd.c pieces
> the patch doesn't actually do anything.
> 
> -- 
> Martin K. PetersenOracle Linux Engineering

Thank you for your review.  Looks like this patch doesn't make sense in the
3.5 kernel, so I'll just drop it.

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


RE: [PATCHv7 1/4] pwm: Add Freescale FTM PWM driver support

2013-12-18 Thread li.xi...@freescale.com

> On Tue, Dec 17, 2013 at 01:54:35PM +0100, Tomasz Figa wrote:
> > On Tuesday 17 of December 2013 13:45:06 Thierry Reding wrote:
> > > I fail to see how that would eliminate the problem with the types.
> > > That said I don't actually see sparse complaining about any type
> mismatches.
> > > That's probably because the various macros implicitly cast to u32.
> >
> > Well, in BE variant you would read the register using __raw_readl()
> > into a __be32 and then get an u32 from be32_to_cpu() and return it.
> > Similarly for writes
> 
> __raw_readl() returns a u32, so you'll get a warning trying to assign a
> u32 to a __be32.
> 

If all are ok about this method.
How about the following:

+static inline u32 fsl_pwm_readl(struct fsl_pwm_chip *fpc,
+   const void __iomem *addr)
+{
+   u32 val;
+
+   val = __raw_readl(addr);
+
+   if (likely(fpc->big_endian))
+   val = be32_to_cpu((__force __be32)val);
+   else
+   val = le32_to_cpu((__force __le32)val);
+   rmb();
+
+   return val;
+}
+
+static inline void fsl_pwm_writel(struct fsl_pwm_chip *fpc,
+   u32 val, void __iomem *addr)
+{
+   wmb();
+   if (likely(fpc->big_endian))
+   val = (__force u32)cpu_to_be32(val);
+   else
+   val = (__force u32)cpu_to_le32(val);
+
+   __raw_writel(val, addr);
+}

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


Re: [RFC/PATCHSET 00/18] perf report: Add support to accumulate hist periods (v3)

2013-12-18 Thread Ingo Molnar

* Namhyung Kim  wrote:

> I changed the option as a separate --cumulate and added a new 
> "Total" column (and renamed the default "Overhead" column into 
> "Self").  The output will be sorted by total (cumulative) overhead 
> for now.  The reason I changed to the --cumulate is that I still 
> think it's much different from other --callchain options and I plan 
> to add support for showing (remaining) callchains to cumulative 
> entries too.  The --callchain option will take care of it even with 
> --cumulate option.

So I still think this is a fantastic feature, and while this variant 
of the user interface is an improvement over the previous version, we 
are not there yet ;-)

My main complaint that any variation of 'cumulative' or 'cumulate' is 
a tongue-twister to users. I certainly won't be able to remember it 
and will have to call up the manpage every time I use it - which will 
be very annoying. I'd probably not use the feature much.

So lets approach this from the casual user's angle. Casual users don't 
really remember twisted names for command line options, they remember 
the big picture, big concepts, and they remember bits of the output:

> When the -g cumulative option is given, it'll be shown like this:
> 
>   $ perf report --cumulate --stdio
> 
>   # Self Total  Command  Shared Object   Symbol
>   #     ...  .  ...
>   #
>0.00%88.29%  abc  libc-2.17.so   [.] __libc_start_main  
>0.00%88.29%  abc  abc[.] main   
>0.00%88.29%  abc  abc[.] c  
>0.00%88.29%  abc  abc[.] b  
>   88.29%88.29%  abc  abc[.] a  
>0.00%11.61%  abc  ld-2.17.so [.] _dl_sysdep_start   

So the natural way to get this would something like:

perf report --total

Or, if '--total' does not feel good, maybe we should change 'Total' to 
'Siblings' or 'Children', and propagate that naming through the UI:

   $ perf report --children --stdio
 
   # Self  Children  Command  Shared Object   Symbol
   #     ...  .  ...
   #
0.00%88.29%  abc  libc-2.17.so   [.] __libc_start_main  
0.00%88.29%  abc  abc[.] main   
0.00%88.29%  abc  abc[.] c  
0.00%88.29%  abc  abc[.] b  
   88.29%88.29%  abc  abc[.] a  
0.00%11.61%  abc  ld-2.17.so [.] _dl_sysdep_start   

Which shows the sum of overhead of all child functions as well, not 
just ourselves.

Anything but 'cumulative'. That word, beyond being a strange, hard to 
remember Latin word, also does not tell the user (or the developer) 
anything about _what_ is being accumulated. It could cover anything.

I also think this option should be enabled by default - lets see how 
much people complain about that.

Okay?

Thanks,

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


Re: [PATCH v4 4/5] PCI: Try best to allocate pref mmio 64bit above 4g

2013-12-18 Thread Guo Chao
Hi:
On Mon, Dec 16, 2013 at 04:36:32PM -0800, Yinghai Lu wrote:
> On Mon, Dec 16, 2013 at 1:36 PM, Yinghai Lu  wrote:
> > On Mon, Dec 16, 2013 at 10:13 AM, Yinghai Lu  wrote:
> >>>
> >>> 64-bit non-prefetchable BARs are missed from caculation in the scheme,
> >>> causing assign failed eventually.
> 
> >>>
> >>> Will you figure out a better way to cover them or just add a 'type3' 
> >>> parameter?
> >
> > Looks like we have add type3 for that case.
> 
> please check attached delta patch.
> 

It works, thank you.

Guo Chao

> Thanks
> 
> Yinghai

> ---
>  drivers/pci/setup-bus.c |   17 +++--
>  drivers/pci/setup-res.c |8 ++--
>  2 files changed, 17 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6/drivers/pci/setup-bus.c
> ===
> --- linux-2.6.orig/drivers/pci/setup-bus.c
> +++ linux-2.6/drivers/pci/setup-bus.c
> @@ -916,6 +916,7 @@ static inline resource_size_t calculate_
>   */
>  static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
>unsigned long type, unsigned long type2,
> +  unsigned long type3,
>resource_size_t min_size, resource_size_t add_size,
>struct list_head *realloc_head)
>  {
> @@ -946,7 +947,8 @@ static int pbus_size_mem(struct pci_bus
>   resource_size_t r_size;
>  
>   if (r->parent || ((r->flags & mask) != type &&
> -   (r->flags & mask) != type2))
> +   (r->flags & mask) != type2 &&
> +   (r->flags & mask) != type3))
>   continue;
>   r_size = resource_size(r);
>  #ifdef CONFIG_PCI_IOV
> @@ -1119,7 +1121,7 @@ void __ref __pci_bus_size_bridges(struct
>   struct list_head *realloc_head)
>  {
>   struct pci_dev *dev;
> - unsigned long mask, prefmask, type2 = 0;
> + unsigned long mask, prefmask, type2 = 0, type3 = 0;
>   resource_size_t additional_mem_size = 0, additional_io_size = 0;
>   struct resource *b_res;
>  
> @@ -1171,26 +1173,29 @@ void __ref __pci_bus_size_bridges(struct
>   prefmask = IORESOURCE_MEM | IORESOURCE_PREFETCH;
>   if (b_res[2].flags & IORESOURCE_MEM_64) {
>   prefmask |= IORESOURCE_MEM_64;
> - if (pbus_size_mem(bus, prefmask, prefmask, prefmask,
> + if (pbus_size_mem(bus, prefmask, prefmask,
> +   prefmask, prefmask,
> realloc_head ? 0 : additional_mem_size,
> additional_mem_size, realloc_head)) {
>   /* Success, size non-pref64 only. */
>   mask = prefmask;
>   type2 = prefmask & ~IORESOURCE_MEM_64;
> + type3 = prefmask & ~IORESOURCE_PREFETCH;
>   }
>   }
>   if (!type2) {
>   prefmask &= ~IORESOURCE_MEM_64;
> - if (pbus_size_mem(bus, prefmask, prefmask, prefmask,
> + if (pbus_size_mem(bus, prefmask, prefmask,
> +  prefmask, prefmask,
>realloc_head ? 0 : additional_mem_size,
>additional_mem_size, realloc_head)) {
>   /* Success, size non-prefetch only. */
>   mask = prefmask;
>   } else
>   additional_mem_size += additional_mem_size;
> - type2 = IORESOURCE_MEM;
> + type2 = type3 = IORESOURCE_MEM;
>   }
> - pbus_size_mem(bus, mask, IORESOURCE_MEM, type2,
> + pbus_size_mem(bus, mask, IORESOURCE_MEM, type2, type3,
>   realloc_head ? 0 : additional_mem_size,
>   additional_mem_size, realloc_head);
>   break;
> Index: linux-2.6/drivers/pci/setup-res.c
> ===
> --- linux-2.6.orig/drivers/pci/setup-res.c
> +++ linux-2.6/drivers/pci/setup-res.c
> @@ -212,7 +212,8 @@ static int __pci_assign_resource(struct
>pcibios_align_resource, dev);
>  
>   if (ret < 0 &&
> - (res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64))) {
> + (res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) ==
> +  (IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) {
>   /*
>* That failed.
>*
> @@ -223,12 +224,15 @@ static int __pci_assign_resource(struct
>pcibios_align_resource, dev);
>   }
>  
> - i

Re: [GIT PULL] Update to error injection interface

2013-12-18 Thread Ingo Molnar

* Luck, Tony  wrote:

> Ingo,
> 
> Please queue in x86/ras branch for next merge window.
> 
> Thanks
> 
> -Tony
> 
> The following changes since commit 319e2e3f63c348a9b66db4667efa73178e18b17d:
> 
>   Linux 3.13-rc4 (2013-12-15 12:31:33 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git 
> tags/please-pull-einj
> 
> for you to fetch changes up to 3482fb5e0c1c20ce0dbcfc5ca3b6558a8c455b10:
> 
>   ACPI, APEI, EINJ: Changes to the ACPI/APEI/EINJ debugfs interface 
> (2013-12-17 16:04:22 -0800)
> 
> 
> Add more flexibility to debugfs i/f to error injection (EINJ)
> 
> 
> Tony Luck (1):
>   ACPI, APEI, EINJ: Changes to the ACPI/APEI/EINJ debugfs interface
> 
>  Documentation/acpi/apei/einj.txt | 19 ++-
>  drivers/acpi/apei/einj.c | 39 ++-
>  2 files changed, 52 insertions(+), 6 deletions(-)

Pulled, thanks Tony!

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


Re: [PATCH] efi earlyprintk fix

2013-12-18 Thread Dave Young
> It's my laptop Thinkpad T420, the screen scolls very fast, I use 
> boot_delay=500
> to verify it with my patch for moving boot_delay param an early param.
> 
> Even without boot_delay, there's always a line at bottom with only the prefix:
> "efi:"

Update about this issue:
With latest mainline tree + efi runtime patchset, above problem does not happen
any more (with and without boot_delay).

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


Re: [PATCH v3 2/2] provide -fstack-protector-strong build option

2013-12-18 Thread Ingo Molnar

* Kees Cook  wrote:

> This changes the stack protector config option into a choice of "None",
> "Regular", and "Strong". For "Strong", the kernel is built with
> -fstack-protector-strong (gcc 4.9 and later). This options increases
> the coverage of the stack protector without the heavy performance hit
> of -fstack-protector-all.
> 
> For reference, the stack protector options available in gcc are:
> 
> -fstack-protector-all:
> Adds the stack-canary saving prefix and stack-canary checking suffix to
> _all_ function entry and exit. Results in substantial use of stack space
> for saving the canary for deep stack users (e.g. historically xfs), and
> measurable (though shockingly still low) performance hit due to all the
> saving/checking. Really not suitable for sane systems, and was entirely
> removed as an option from the kernel many years ago.
> 
> -fstack-protector:
> Adds the canary save/check to functions that define an 8
> (--param=ssp-buffer-size=N, N=8 by default) or more byte local char
> array. Traditionally, stack overflows happened with string-based
> manipulations, so this was a way to find those functions. Very few
> total functions actually get the canary; no measurable performance or
> size overhead.
> 
> -fstack-protector-strong
> Adds the canary for a wider set of functions, since it's not just those
> with strings that have ultimately been vulnerable to stack-busting. With
> this superset, more functions end up with a canary, but it still
> remains small compared to all functions with no measurable change in
> performance. Based on the original design document, a function gets the
> canary when it contains any of:
> - local variable's address used as part of the RHS of an assignment or
>   function argument
> - local variable is an array (or union containing an array), regardless
>   of array type or length
> - uses register local variables
> https://docs.google.com/a/google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU
> 
> Comparison of "size" output when built with gcc-4.9 in three configurations:
> - defconfig
> - defconfig + CONFIG_CC_STACKPROTECTOR (+0.33%)
> - defconfig + CONFIG_CC_STACKPROTECTOR_STRONG via this patch (+2.24%)
> 
> text  data bss  dec   hex filename
> 11430641  1457584  1191936  14080161  d6d8a1  vmlinux
> 11468490  1457584  1191936  14118010  d76c7a  vmlinux.stackprotector
> 11692790  1457584  1191936  14342310  dad8a6  vmlinux.stackprotector-strong

Beyond the kernel size calculation, could you please also provide an 
estimation about the _number_ of functions affected, out of N kernel 
functions, so that the user has a rough picture about the scope and 
distribution of these variants?

I.e. something like:

 # of canary checks
 
..
 - defconfig 0 functions out of 100k 
functions
 - defconfig + STACKPROTECTOR   1k functions out of 100k 
functions  
 - defconfig + STACKPROTECTOR_STRONG   20k functions out of 100k 
functions

Thanks,

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


Re: [PATCH] sched, deadline: Properly initialize def_dl_bandwidth lock

2013-12-18 Thread Peter Zijlstra
On Tue, Dec 17, 2013 at 03:17:53PM -0500, Steven Rostedt wrote:
> 
> Spinlocks even in structures require to be properly initialized.
> 
> Signed-off-by: Steven Rostedt 
> 
> Index: linux-rt.git/kernel/sched/deadline.c
> ===
> --- linux-rt.git.orig/kernel/sched/deadline.c
> +++ linux-rt.git/kernel/sched/deadline.c
> @@ -18,7 +18,9 @@
>  
>  #include 
>  
> -struct dl_bandwidth def_dl_bandwidth;
> +struct dl_bandwidth def_dl_bandwidth = {
> + .dl_runtime_lock = 
> __RAW_SPIN_LOCK_UNLOCKED(def_dl_bandwidth.dl_runtime_lock),
> +};
>  
>  static inline struct task_struct *dl_task_of(struct sched_dl_entity *dl_se)
>  {

The thing is, init_dl_bandwidth() in sched_init() is supposed to already
do that. The stacktrace you provided out of band:

[0.00]  [] spin_bug+0x2b/0x2d
[0.00]  [] do_raw_spin_lock+0x27/0x104
[0.00]  [] _raw_spin_lock+0x20/0x24
[0.00]  [] init_dl_bw+0x2d/0x79^M
[0.00]  [] init_rootdomain+0x20/0x4f^M
[0.00]  [] sched_init+0x69/0x432
[0.00]  [] start_kernel+0x201/0x41c
[0.00]  [] ? repair_env_string+0x56/0x56
[0.00]  [] x86_64_start_reservations+0x2a/0x2c
[0.00]  [] x86_64_start_kernel+0xf2/0xf9

Has clue though. So it appears we use the lock before we reach that
init_dl_bandwidth.

The below hunk should fix things up -- merged into patch 9/13.

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6768,15 +6768,15 @@ void __init sched_init(void)
 #endif /* CONFIG_CPUMASK_OFFSTACK */
}
 
-#ifdef CONFIG_SMP
-   init_defrootdomain();
-#endif
-
init_rt_bandwidth(&def_rt_bandwidth,
global_rt_period(), global_rt_runtime());
init_dl_bandwidth(&def_dl_bandwidth,
global_dl_period(), global_dl_runtime());
 
+#ifdef CONFIG_SMP
+   init_defrootdomain();
+#endif
+
 #ifdef CONFIG_RT_GROUP_SCHED
init_rt_bandwidth(&root_task_group.rt_bandwidth,
global_rt_period(), global_rt_runtime());
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: omap-usb-tll: Don't hold lock during pm_runtime_get/put_sync()

2013-12-18 Thread Roger Quadros
pm_runtime_get/put_sync() can sleep so don't hold spinlock while
calling them.

This patch prevents a BUG() when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.
Bug is present in Kernel versions v3.9 onwards.

Reported-by: Tomi Valkeinen 
Signed-off-by: Roger Quadros 
Tested-by: Tomi Valkeinen 
Cc:  # 3.9+
---
 drivers/mfd/omap-usb-tll.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0d946ae1..248004c 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -346,7 +346,9 @@ int omap_tll_init(struct usbhs_omap_platform_data *pdata)
for (i = 0; i < tll->nch; i++)
needs_tll |= omap_usb_mode_needs_tll(pdata->port_mode[i]);
 
+   spin_unlock(&tll_lock);
pm_runtime_get_sync(tll_dev);
+   spin_lock(&tll_lock);
 
if (needs_tll) {
void __iomem *base = tll->base;
@@ -398,9 +400,8 @@ int omap_tll_init(struct usbhs_omap_platform_data *pdata)
}
}
 
-   pm_runtime_put_sync(tll_dev);
-
spin_unlock(&tll_lock);
+   pm_runtime_put_sync(tll_dev);
 
return 0;
 }
@@ -420,7 +421,9 @@ int omap_tll_enable(struct usbhs_omap_platform_data *pdata)
 
tll = dev_get_drvdata(tll_dev);
 
+   spin_unlock(&tll_lock);
pm_runtime_get_sync(tll_dev);
+   spin_lock(&tll_lock);
 
for (i = 0; i < tll->nch; i++) {
if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
@@ -438,7 +441,6 @@ int omap_tll_enable(struct usbhs_omap_platform_data *pdata)
}
 
spin_unlock(&tll_lock);
-
return 0;
 }
 EXPORT_SYMBOL_GPL(omap_tll_enable);
@@ -464,9 +466,8 @@ int omap_tll_disable(struct usbhs_omap_platform_data *pdata)
}
}
 
-   pm_runtime_put_sync(tll_dev);
-
spin_unlock(&tll_lock);
+   pm_runtime_put_sync(tll_dev);
 
return 0;
 }
-- 
1.8.3.2

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


Re: [PATCH 02/05 v2] pinctrl: sh-pfc: r7s72100 base support

2013-12-18 Thread Wolfram Sang

> >> +#define _P_DATA(bank, pin, name, sfx) 
> >>\
> >> + PINMUX_DATA(name##_DATA, name##_PMC_0, name##_PIPC_0,   \
> >> + name##_PIBC_1, name##_PBDC_1)
> >> +
> >> +#define _P_FN(n, fn, pfcae, pfce, pfc)
> >>\
> >> + PINMUX_DATA(n##_MARK_FN##fn, n##_PMC_1, n##_PIPC_1, \
> >> + n##_PFCAE_##pfcae, n##_PFCE_##pfce, n##_PFC_##pfc)
> >
> > I need to apply this patch, otherwise my i2c pinmuxing fails?
> 
> Thanks. It looks to me like the _P_FN() bits would be mainly needed.
> Can you try to omit the _P_DATA() portion and check if it is still
> behaving as expected?

Nope, doesn't work.



signature.asc
Description: Digital signature


Re: [PATCH 07/13] sched: Enable IPI reception on timekeeper under nohz full system

2013-12-18 Thread Peter Zijlstra
On Tue, Dec 17, 2013 at 11:51:26PM +0100, Frederic Weisbecker wrote:
> We need the default timekeeping CPU to be able to receive IPIs sent
> from full dynticks CPUs when they wake up from full system idle state.
> 
> Therefore we need an entrypoint from the scheduler IPI so that the
> need to poll on timekeeping duty is re-evaluated from irq_exit().
> 
> In order to achieve this, lets take the scheduler IPI everytime as long
> as there is at least one full dynticks CPU around. Full dynticks CPUs
> are interested too in taking scheduler IPIs to reevaluate their tick.

I should probably read the other patches in this series, but the above
makes my brain go *bp* and throw an error.


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


Re: [PATCH 2/3] [RESEND]sparc64: convert spinloc_t to raw_spinlock_t in mmu_context_t

2013-12-18 Thread Allen Pais

> Sorry for not noticing this earlier but this has nothing to do with the
> remaining part of the patch.
> To be able to set this flag, you need to mark timer & perf interrupts.
> If you already use IRQF_TIMER for the timer and perf interrupts are
> already coming as NMU then you are done. But please split this out as a
> separate patch.

I'll split this as a separate patch. 

- Allen

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


Re: [PATCH 2/3] timekeeping: Fix potential lost pv notification of time change

2013-12-18 Thread Ingo Molnar

* John Stultz  wrote:

> In 780427f0e11 (Indicate that clock was set in the pvclock
> gtod notifier), logic was added to pass a CLOCK_WAS_SET
> notification to the pvclock notifier chain.
> 
> While that patch added a action flag returned from
> accumulate_nsecs_to_secs(), it only uses the returned value
> in one location, and not in the logarithmic accumulation.
> 
> This means if a leap second triggered during the logarithmic
> accumulation (which is most likely where it would happen),
> the notification that the clock was set would not make it to
> the pv notifiers.
> 
> This patch extends the logarithmic_accumulation pass down
> that action flag so proper notification will occur.
> 
> Cc: Sasha Levin 
> Cc: Thomas Gleixner 
> Cc: Ingo Molnar 
> Cc: David Vrabel 
> Cc: Konrad Rzeszutek Wilk 
> Cc: Prarit Bhargava 
> Cc: Richard Cochran 
> Cc: 
> Cc: stable  #3.11+
> Signed-off-by: John Stultz 
> ---
>  kernel/time/timekeeping.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index 6bad3d9..998ec751 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -1295,7 +1295,7 @@ static inline unsigned int 
> accumulate_nsecs_to_secs(struct timekeeper *tk)
>   * Returns the unconsumed cycles.
>   */
>  static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t 
> offset,
> - u32 shift)
> + u32 shift, unsigned int *action)

I have two complaints about this patch:

1)

I think the 'action' name sucks because it's too obfuscated. It's only 
ever set to TK_CLOCK_WAS_SET, so why not name it more descriptively, 
i.e. 'clock_was_set'?

2)

Secondly, the proliferation of parameters passed around I think calls 
for a helper structure which would carry the (offset, shift, 
clock_was_set) triple:

struct acc_params {
cycle_t offset;
u32 shift;
boolclock_was_set;
};

And then passed down like this:

>  static cycle_t logarithmic_accumulation(struct timekeeper *tk, struct 
> acc_params *params)

Agreed?

Thanks,

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


Re: [Regression] sched: division by zero in find_busiest_group()

2013-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2013 at 04:28:35AM +, Hedi Berriche wrote:
> On Mon, Dec 09, 2013 at 18:10 Hedi Berriche wrote:
> | Folks,
> | 
> | The following panic occurs *early* at boot time on high *enough* CPU count
> | machines:
> | 
> | divide error:  [#1] SMP 
> | Modules linked in:
> | CPU: 22 PID: 1146 Comm: kworker/22:0 Not tainted 3.13.0-rc2-00122-gdea4f48 
> #8
> | Hardware name: Intel Corp. Stoutland Platform, BIOS 2.20 UEFI2.10 PI1.0 X64 
> 2013-09-20
> | task: 8827d49f31c0 ti: 8827d4a18000 task.ti: 8827d4a18000
> | RIP: 0010:[]  [] 
> find_busiest_group+0x26b/0x890
> | RSP: :8827d4a19b68  EFLAGS: 00010006
> | RAX: 7fff RBX: 8000 RCX: 0200
> | RDX:  RSI: 8000 RDI: 0020
> | RBP: 8827d4a19cc0 R08:  R09: 
> | R10:  R11:  R12: 
> | R13: 8827d4a19d28 R14: 8827d4a19b98 R15: 
> | FS:  () GS:8827dfd8() knlGS:
> | CS:  0010 DS:  ES:  CR0: 8005003b
> | CR2: 00b8 CR3: 018da000 CR4: 07e0
> | Stack:
> | 8827d4b35800  00014600 00014600
> |  8827d4b35818  
> |   8000 
> | Call Trace:
> | [] load_balance+0x166/0x7f0
> | [] idle_balance+0x10e/0x1b0
> | [] __schedule+0x723/0x780
> | [] schedule+0x29/0x70
> | [] worker_thread+0x1c9/0x400
> | [] ? rescuer_thread+0x3e0/0x3e0
> | [] kthread+0xd2/0xf0
> | [] ? kthread_create_on_node+0x180/0x180
> | [] ret_from_fork+0x7c/0xb0
> | [] ? kthread_create_on_node+0x180/0x180
> 
> Hmm...had time to dig into this a bit deeper and looking at
> build_overlap_sched_groups(), specifically this bit of code:
> 
> kernel/sched/core.c:
> 
> 5066 static int
> 5067 build_overlap_sched_groups(struct sched_domain *sd, int cpu)
> 5068 {
> ...
> 5109 /*
> 5110  * Initialize sgp->power such that even if we mess up the
> 5111  * domains and no possible iteration will get us here, 
> we won't
> 5112  * die on a /0 trap.
> 5113  */
> 5114 sg->sgp->power = SCHED_POWER_SCALE * 
> cpumask_weight(sg_span);
> 
> I'm wondering whether the same precaution should be used when it comes to 
> sg->sgp->power_orig.

http://marc.info/?l=linux-kernel&m=138684195315258
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Xmas Loan Offer Apply...

2013-12-18 Thread i...@hotel.com


Do you need a loan? email me now for more info contact me via 
email:marthinuskrug...@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] usb: usbtest: Always clear halt else further tests will fail

2013-12-18 Thread Roger Quadros
In test_halt() we set an endpoint halt condition and return on halt verification
failure, then the enpoint will remain halted and all further tests related
to that enpoint will fail. This is because we don't tackle endpoint halt error 
condition
in any of the tests. To avoid that situation, make sure to clear the
halt condition before exiting test_halt().

Signed-off-by: Roger Quadros 
Reviewed-by: Felipe Balbi 
---
 drivers/usb/misc/usbtest.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 6294e1b..300b726 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1545,8 +1545,17 @@ static int test_halt(struct usbtest_dev *tdev, int ep, 
struct urb *urb)
return retval;
}
retval = verify_halted(tdev, ep, urb);
-   if (retval < 0)
+   if (retval < 0) {
+   int ret;
+
+   /* clear halt anyways, else further tests will fail */
+   ret = usb_clear_halt(urb->dev, urb->pipe);
+   if (ret)
+   ERROR(tdev, "ep %02x couldn't clear halt, %d\n",
+ ep, ret);
+
return retval;
+   }
 
/* clear halt (tests API + protocol), verify it worked */
retval = usb_clear_halt(urb->dev, urb->pipe);
-- 
1.8.3.2

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


[PATCH 1/2] usb: usbtest: Add timetout to simple_io()

2013-12-18 Thread Roger Quadros
Without a timetout some tests e.g. test_halt() can remain stuck forever.

Signed-off-by: Roger Quadros 
Reviewed-by: Felipe Balbi 
---
 drivers/usb/misc/usbtest.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index b415282..6294e1b 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -10,6 +10,7 @@
 
 #include 
 
+#define SIMPLE_IO_TIMEOUT  1   /* in milliseconds */
 
 /*-*/
 
@@ -366,6 +367,7 @@ static int simple_io(
int max = urb->transfer_buffer_length;
struct completion   completion;
int retval = 0;
+   unsigned long   expire;
 
urb->context = &completion;
while (retval == 0 && iterations-- > 0) {
@@ -378,9 +380,15 @@ static int simple_io(
if (retval != 0)
break;
 
-   /* NOTE:  no timeouts; can't be broken out of by interrupt */
-   wait_for_completion(&completion);
-   retval = urb->status;
+   expire = msecs_to_jiffies(SIMPLE_IO_TIMEOUT);
+   if (!wait_for_completion_timeout(&completion, expire)) {
+   usb_kill_urb(urb);
+   retval = (urb->status == -ENOENT ?
+ -ETIMEDOUT : urb->status);
+   } else {
+   retval = urb->status;
+   }
+
urb->dev = udev;
if (retval == 0 && usb_pipein(urb->pipe))
retval = simple_check_buf(tdev, urb);
-- 
1.8.3.2

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


Re: [GIT PULL 00/10] perf/core improvements and refactorings

2013-12-18 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> From: Arnaldo Carvalho de Melo 
> 
> Hi Ingo,
> 
>   Please consider pulling,
> 
> Regards,
> 
> - Arnaldo
> 
> The following changes since commit b283d2f3b74bc98174e8453c0be41dfcda3cae1b:
> 
>   Merge tag 'perf-core-for-mingo' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core 
> (2013-12-16 14:52:03 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux 
> tags/perf-core-for-mingo
> 
> for you to fetch changes up to f23b24f1bf90b56cfaeb2a1c9b77c46efe8916a6:
> 
>   tools lib traceevent: Get rid of die() in some string conversion functions 
> (2013-12-17 16:51:49 -0300)
> 
> 
> perf/core improvements and refactorings:
> 
> New features:
> 
> . In perf timechart:
>   - Add backtrace support to CPU info
>   . Print pid along the name
>   . Add support for CPU topology
>   . Add new option --highlight'ing threads, be it by name or,
> if a numeric value is provided, that run more than given duration.
>   From Stanislav Fomichev.
> 
> Refactorings:
> 
> . Rename some struct DSO binary_type related members and methods,
>   to clarify its purpose and need for differentiation from symtab_type,
>   i.e. one is about the files .text, CFI, etc, i.e. its binary contents,
>   and the other is about where the symbol table came from.
> 
> . Convert to new topic libraries, starting with an API one (sysfs, debugfs,
>   etc), renaming liblk in the process, from Borislav Petkov.
> 
> . Get rid of some more panic() like error handling in libtraceevent,
>   from Namhyung Kim.
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Arnaldo Carvalho de Melo (3):
>   perf symbols: Remove needless static binary_type array
>   perf symbols: Clarify method to get DSO binary_type filename
>   perf symbols: Use consistent name for the DSO binary type member
> 
> Borislav Petkov (1):
>   tools/: Convert to new topic libraries
> 
> Namhyung Kim (1):
>   tools lib traceevent: Get rid of die() in some string conversion 
> functions
> 
> Stanislav Fomichev (5):
>   perf timechart: Add backtrace support to CPU info
>   perf timechart: Print pid along the name
>   perf timechart: Get number of CPUs from perf header
>   perf timechart: Add support for topology
>   perf timechart: Add --highlight option
> 
>  tools/Makefile  |  12 +--
>  tools/lib/{lk => api}/Makefile  |  18 ++--
>  tools/lib/{lk => api/fs}/debugfs.c  |   0
>  tools/lib/{lk => api/fs}/debugfs.h  |   6 +-
>  tools/lib/traceevent/parse-filter.c |  67 
>  tools/perf/Documentation/perf-timechart.txt |  16 +++
>  tools/perf/Makefile.perf|  33 +++---
>  tools/perf/builtin-kvm.c|   2 +-
>  tools/perf/builtin-probe.c  |   2 +-
>  tools/perf/builtin-timechart.c  |  79 --
>  tools/perf/perf.c   |   2 +-
>  tools/perf/tests/parse-events.c |   2 +-
>  tools/perf/util/dso.c   |  24 ++---
>  tools/perf/util/dso.h   |  14 +--
>  tools/perf/util/evlist.c|   2 +-
>  tools/perf/util/evsel.c |   2 +-
>  tools/perf/util/parse-events.c  |   2 +-
>  tools/perf/util/probe-event.c   |   2 +-
>  tools/perf/util/setup.py|   4 +-
>  tools/perf/util/svghelper.c | 159 
> ++--
>  tools/perf/util/svghelper.h |   6 +-
>  tools/perf/util/symbol.c|  12 +--
>  tools/perf/util/trace-event-info.c  |   2 +-
>  tools/perf/util/util.h  |   2 +-
>  tools/vm/Makefile   |  14 +--
>  tools/vm/page-types.c   |   2 +-
>  26 files changed, 344 insertions(+), 142 deletions(-)
>  rename tools/lib/{lk => api}/Makefile (66%)
>  rename tools/lib/{lk => api/fs}/debugfs.c (100%)
>  rename tools/lib/{lk => api/fs}/debugfs.h (86%)

Pulled, thanks Arnaldo!

While testing this I noticed that the trace-plugins related build 
system messages spam, which I reported a week ago, is still there:

comet:~/tip/tools/perf> make install
  BUILD:   Doing 'make -j12' parallel build
  SUBDIR   Documentation
  INSTALL  Documentation-man
  INSTALL  GTK UI
  SUBDIR   /fast/mingo/tip/tools/lib/traceevent/
  INSTALL  plugin_jbd2.so
  INSTALL  binaries
  INSTALL  plugin_hrtimer.so
  INSTALL  plugin_kmem.so
  INSTALL  plugin_kvm.so
  INSTALL  plugin_mac80211.so
  INSTALL  plugin_sched_switch.so
  INSTALL  plugin_function.so
  INSTALL  plugin_xen.so
  INSTALL  plugin_scsi.so
  INSTALL  plugin_cfg80211.so
  INSTALL  libexec
  INSTALL  perf-archive
  INSTALL  perl-scripts
  INSTALL  

Re: [PATCH 2/2] sched: update runqueue clock before migrations away

2013-12-18 Thread Chris Redpath

On 17/12/13 18:03, bseg...@google.com wrote:

__synchronize_entity_decay will decay load_avg_contrib in order to
figure out how much to remove from old_cfs_rq->blocked_load.
update_entity_load_avg will update the underlying runnable_avg_sum/period that
is used to update load_avg_contrib.

(Normally we update runnable_avg_sum, which updates load_avg_contrib via
__update_entity_load_avg_contrib. Here we go in the reverse direction
because we don't hold the right rq locks at the right times.)



Thanks Ben, got it now. The only question remaining for me to figure out 
is if I need to include the missed tick time in the contrib decay or not 
- I definitely need to include it in the negative decay count we send 
through a migration. I'll go and check the places we use the removed 
load and update blocked load again.


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


Re: linux-next: build failure after merge of the net-next tree

2013-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2013 at 09:33:47AM +0100, Geert Uytterhoeven wrote:
> On Wed, Dec 18, 2013 at 3:30 AM, David Miller  wrote:
> > diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
> > index f01fb50..a73a8e2 100644
> > --- a/arch/alpha/include/asm/Kbuild
> > +++ b/arch/alpha/include/asm/Kbuild
> > @@ -4,3 +4,4 @@ generic-y += clkdev.h
> >  generic-y += exec.h
> >  generic-y += trace_clock.h
> >  generic-y += preempt.h
> > +generic-y += hash.h
> 
> Please keep them sorted.
> 
> Yes, Peter violated that too, when adding preempt.h.

So what I did was something like:

for i in arch/*/include/asm/Kbuild
do
echo "generic-y += preempt.h" >> $i
done

Whoever is going to hand edit all gazillion archs for changes like that?
And sort(1) is annoying in that it doesn't do in-place sort; you'll end
up with empty files if you try the naive thing.

Worse most of those Kbuild files include other random garbage, which
makes automated sorting harder still.

So unless there's a sane and easy way to keep it sorted; I'm going to
ignore that rule.

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


Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread Takashi Iwai
At Wed, 18 Dec 2013 09:44:35 +0100,
Takashi Iwai wrote:
> 
> At Wed, 18 Dec 2013 09:21:28 +0100,
> David Herrmann wrote:
> > 
> > Hi
> > 
> > On Wed, Dec 18, 2013 at 8:42 AM, Takashi Iwai  wrote:
> > > Hi,
> > >
> > > with the recent enablement of simplefb on x86, cirrusdrmfb on QEMU/KVM
> > > gets broken now, as reported at:
> > > https://bugzilla.novell.com/show_bug.cgi?id=855821
> > >
> > > The cirrus VGA resource is reserved at first as "BOOTFB" in
> > > arch/x86/kernel/sysfb_simplefb.c, which is taken by simplefb platform
> > > device.  This resource is, however, never released until the platform
> > > device is destroyed, and the framebuffer switching doesn't trigger
> > > it.  It calls fb's destroy callback, at most.  Then, cirrus driver
> > > tries to assign the resource, fails and gives up, resulting in a
> > > complete blank screen.
> > >
> > > The same problem should exist on other KMS drivers like mgag200 or
> > > ast, not only cirrus.  Intel graphics doesn't hit this problem just
> > > because the reserved iomem by BOOTFB isn't required by i915 driver.
> > >
> > > The patch below is a quick attempt to solve the issue.  It adds a new
> > > API function for releasing resources of platform_device, and call it
> > > in destroy op of simplefb.  But, forcibly releasing resources of a
> > > parent device doesn't sound like a correct design.  We may take such
> > > as a band aid, but definitely need a more fundamental fix.
> > >
> > > Any thoughts?
> > 
> > That bug always existed, simplefb is just the first driver to hit it
> > (vesafb/efifb didn't use resources).
> 
> Heh, the bug didn't "exist" because no other grabbed the resource
> before.  The way the cirrus driver allocates the resource is no bug,
> per se.  But the proper resource takeover is missing.
> 
> > I'm aware of the issue but as a
> > workaround you can simply disable CONFIG_X86_SYSFB. That restores the
> > old behavior.
> 
> Yes, but CONFIG_X86_SYSFB breaks things as of now.  Shouldn't it be
> mentioned or give some kconfig hints instead of silently giving a
> broken output, if any quick fix isn't possible?
> 
> > As a proper fix, I'd propose something like:
> >   dev = platform_find_device("platform-framebuffer");
> >   platform_remove_device(dev);
> > 
> > And we wrap this as:
> >   sysfb_remove_framebuffers()
> > in arch/x86/kernel/sysfb.c
> > 
> > This should cause a ->remove() event for the platform-driver and
> > correctly release the resources. Comments?
> 
> Who will call this?  From destroy callback?
> Or can we simply do put_device() the bound platform device instead?

Just tested, put_device() doesn't work since the refcount isn't 1, so
if any, we need to call platform_device_unregister() to release
forcibly.

The patch below seems working at a quick test.  But I still have
some bad feeling for unregistering the parent device from the child's
destroy callback...


thanks,

Takashi

---
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 210f3a02121a..196360c54157 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -41,6 +41,11 @@ static struct fb_var_screeninfo simplefb_var = {
.vmode  = FB_VMODE_NONINTERLACED,
 };
 
+struct simplefb_priv {
+   u32 pseudo_palette[16];
+   struct platform_device *pdev;
+};
+
 static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
  u_int transp, struct fb_info *info)
 {
@@ -68,8 +73,19 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int 
green, u_int blue,
 
 static void simplefb_destroy(struct fb_info *info)
 {
+   struct simplefb_priv *priv = info->par;
+   struct platform_device *pdev = priv->pdev;
+
if (info->screen_base)
iounmap(info->screen_base);
+
+   /* release the bound platform device when called from
+* remove_conflicting_framebuffers()
+*/
+   if (pdev) {
+   priv->pdev = NULL; /* to avoid double-free */
+   platform_device_unregister(pdev);
+   }
 }
 
 static struct fb_ops simplefb_ops = {
@@ -169,6 +185,7 @@ static int simplefb_probe(struct platform_device *pdev)
struct simplefb_params params;
struct fb_info *info;
struct resource *mem;
+   struct simplefb_priv *priv;
 
if (fb_get_options("simplefb", NULL))
return -ENODEV;
@@ -188,7 +205,7 @@ static int simplefb_probe(struct platform_device *pdev)
return -EINVAL;
}
 
-   info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev);
+   info = framebuffer_alloc(sizeof(struct simplefb_priv), &pdev->dev);
if (!info)
return -ENOMEM;
platform_set_drvdata(pdev, info);
@@ -225,7 +242,9 @@ static int simplefb_probe(struct platform_device *pdev)
framebuffer_release(info);
return -ENODEV;
}
-   info->pseudo_palette = (void *)(info + 1);
+
+   priv = info->par;
+   in

Adding supprot for Bluetooth 0x13d3, 0x3404 "BCM20702A0" on asus G750JX

2013-12-18 Thread gerald.mari...@gmail.com
Hi,

I'm using linux OpenSuse 13.1 with kernel 3.11 on the Asus ROG G750JX-T4215H
machine:
# uname -r
3.11.6-4-desktop

It's hard to find something about this bluetooth device but finally i found
some patch for the same device BCM20702A0 on another hardware but on this
computer Asus P8Z77-V Deluxe : 
http://blog.tkassembled.com/301/patching-btusb-to-enable-compatibility-with-the-bcm20702a0-chip/
http://linux-kernel.2935.n7.nabble.com/PATCH-Bluetooth-Add-support-for-BCM20702A0-0b05-17b5-td195933.html

I found that this bluetooth is integrated but connected to the USB-hub ! And
after adding the following line to drivers/bluetooth/btusb.c and recompiling
it and using it (# modprobe btusb), the device is now enabled
{ USB_DEVICE(0x13d3, 0x3404) }, /*on ASUS G750JX vendor INC*/

# hwinfo --usb (BCM207702A0 part)
34: USB 00.0:  Unclassified device
  [Created at usb.122]
  Unique ID: 4zpN.FVG0jOcmIlA
  Parent ID: uIhY.2DFUsyrieMD
  SysFS ID: /devices/pci:00/:00:14.0/usb3/3-5/3-5:1.0
  SysFS BusID: 3-5:1.0
  Hardware Class: unknown
  Model: "IMC Networks BCM20702A0"
  Hotplug: USB
  Vendor: usb 0x13d3 "IMC Networks"
  Device: usb 0x3404 "BCM20702A0"
  Revision: "1.12"
  Serial ID: "240A6439A913"
  Driver: "btusb"
  Driver Modules: "btusb"
  Speed: 12 Mbps
  Module Alias: "usb:v13D3p3404d0112dcFFdsc01dp01icFFisc01ip01in00"
  Driver Info #0:
Driver Status: btusb is active
Driver Activation Cmd: "modprobe btusb"
  Config Status: cfg=no, avail=yes, need=no, active=unknown
  Attached to: #30 (Hub)

QUESTIONS:
Do i have to make other actions to enable the device completely ?
I don't know how to make the patch file for what i did, if somebody can do
it or explain me how to do it, i have enough aknowledge in system admin to
do it.

Because it's enabled with the applet bluedevil integrated in kde4 but i
can't connect to the desired device (mouse with bluetooth Razer Orochi 2013)

# hwinfo --mouse (part of the specified mouse)
29: USB 00.0: 10503 USB Mouse   
  [Created at usb.122]
  Unique ID: CiZ2.17e4hJ8gaGB
  Parent ID: uIhY.2DFUsyrieMD
  SysFS ID: /devices/pci:00/:00:14.0/usb3/3-3/3-3:1.0
  SysFS BusID: 3-3:1.0
  Hardware Class: mouse
  Model: "Razer Orochi 2013"
  Hotplug: USB
  Vendor: usb 0x1532 "Razer"
  Device: usb 0x0039 "Razer Orochi 2013"
  Revision: "2.00"
  Compatible to: int 0x0210 0x0018
  Driver: "usbhid"
  Driver Modules: "usbhid"
  Device File: /dev/input/mice (/dev/input/mouse1)
  Device Files: /dev/input/mice, /dev/input/mouse1, /dev/input/event2,
/dev/input/by-id/usb-Razer_Razer_Orochi_2013-event-mouse,
/dev/input/by-path/pci-:00:14.0-usb-0:3:1.0-event-mouse,
/dev/input/by-id/usb-Razer_Razer_Orochi_2013-mouse,
/dev/input/by-path/pci-:00:14.0-usb-0:3:1.0-mouse
  Device Number: char 13:63 (char 13:33)
  Speed: 12 Mbps
  Module Alias: "usb:v1532p0039d0200dc00dsc00dp00ic03isc01ip02in00"
  Driver Info #0:
Buttons: 8
Wheels: 1
XFree86 Protocol: explorerps/2
GPM Protocol: exps2
  Config Status: cfg=no, avail=yes, need=no, active=unknown
  Attached to: #27 (Hub)

Thanks in advance for your help.

Regards,



--
View this message in context: 
http://linux-kernel.2935.n7.nabble.com/Adding-supprot-for-Bluetooth-0x13d3-0x3404-BCM20702A0-on-asus-G750JX-tp773917.html
Sent from the Linux Kernel mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 00/13] nohz: Use sysidle detection to let the timekeeper sleep

2013-12-18 Thread Peter Zijlstra
On Wed, Dec 18, 2013 at 10:04:43AM +0800, Alex Shi wrote:
> On 12/18/2013 06:51 AM, Frederic Weisbecker wrote:
> Thanks Fredic!
> It is much better on powersaving POV compare to current nohz_full. :)

If you're using nohz_full for powersaving, you're doing it wrong.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cirrusdrmfb broken with simplefb

2013-12-18 Thread David Herrmann
Hi

On Wed, Dec 18, 2013 at 11:17 AM, Takashi Iwai  wrote:
> At Wed, 18 Dec 2013 09:44:35 +0100,
> Takashi Iwai wrote:
>>
>> At Wed, 18 Dec 2013 09:21:28 +0100,
>> David Herrmann wrote:
>> >
>> > Hi
>> >
>> > On Wed, Dec 18, 2013 at 8:42 AM, Takashi Iwai  wrote:
>> > > Hi,
>> > >
>> > > with the recent enablement of simplefb on x86, cirrusdrmfb on QEMU/KVM
>> > > gets broken now, as reported at:
>> > > https://bugzilla.novell.com/show_bug.cgi?id=855821
>> > >
>> > > The cirrus VGA resource is reserved at first as "BOOTFB" in
>> > > arch/x86/kernel/sysfb_simplefb.c, which is taken by simplefb platform
>> > > device.  This resource is, however, never released until the platform
>> > > device is destroyed, and the framebuffer switching doesn't trigger
>> > > it.  It calls fb's destroy callback, at most.  Then, cirrus driver
>> > > tries to assign the resource, fails and gives up, resulting in a
>> > > complete blank screen.
>> > >
>> > > The same problem should exist on other KMS drivers like mgag200 or
>> > > ast, not only cirrus.  Intel graphics doesn't hit this problem just
>> > > because the reserved iomem by BOOTFB isn't required by i915 driver.
>> > >
>> > > The patch below is a quick attempt to solve the issue.  It adds a new
>> > > API function for releasing resources of platform_device, and call it
>> > > in destroy op of simplefb.  But, forcibly releasing resources of a
>> > > parent device doesn't sound like a correct design.  We may take such
>> > > as a band aid, but definitely need a more fundamental fix.
>> > >
>> > > Any thoughts?
>> >
>> > That bug always existed, simplefb is just the first driver to hit it
>> > (vesafb/efifb didn't use resources).
>>
>> Heh, the bug didn't "exist" because no other grabbed the resource
>> before.  The way the cirrus driver allocates the resource is no bug,
>> per se.  But the proper resource takeover is missing.
>>
>> > I'm aware of the issue but as a
>> > workaround you can simply disable CONFIG_X86_SYSFB. That restores the
>> > old behavior.
>>
>> Yes, but CONFIG_X86_SYSFB breaks things as of now.  Shouldn't it be
>> mentioned or give some kconfig hints instead of silently giving a
>> broken output, if any quick fix isn't possible?
>>
>> > As a proper fix, I'd propose something like:
>> >   dev = platform_find_device("platform-framebuffer");
>> >   platform_remove_device(dev);
>> >
>> > And we wrap this as:
>> >   sysfb_remove_framebuffers()
>> > in arch/x86/kernel/sysfb.c
>> >
>> > This should cause a ->remove() event for the platform-driver and
>> > correctly release the resources. Comments?
>>
>> Who will call this?  From destroy callback?
>> Or can we simply do put_device() the bound platform device instead?
>
> Just tested, put_device() doesn't work since the refcount isn't 1, so
> if any, we need to call platform_device_unregister() to release
> forcibly.
>
> The patch below seems working at a quick test.  But I still have
> some bad feeling for unregistering the parent device from the child's
> destroy callback...

The idea is right, but call it from
"remove_conflicting_framebuffers()". The problem is, if we load a
driver on top of a dummy like vesafb/efifb/simplefb, we never removed
them properly. Instead, we only unregistered their fb driver. But with
the driver-model, that's just removing the driver, not the dummy
device.

So we'd just call platform_device_unregister() in
remove_conflicting_framebuffers() instead of unregister_framebuffer()
on such devices. I'm now at home and will have a look.

Thanks
David

>
> thanks,
>
> Takashi
>
> ---
> diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
> index 210f3a02121a..196360c54157 100644
> --- a/drivers/video/simplefb.c
> +++ b/drivers/video/simplefb.c
> @@ -41,6 +41,11 @@ static struct fb_var_screeninfo simplefb_var = {
> .vmode  = FB_VMODE_NONINTERLACED,
>  };
>
> +struct simplefb_priv {
> +   u32 pseudo_palette[16];
> +   struct platform_device *pdev;
> +};
> +
>  static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int 
> blue,
>   u_int transp, struct fb_info *info)
>  {
> @@ -68,8 +73,19 @@ static int simplefb_setcolreg(u_int regno, u_int red, 
> u_int green, u_int blue,
>
>  static void simplefb_destroy(struct fb_info *info)
>  {
> +   struct simplefb_priv *priv = info->par;
> +   struct platform_device *pdev = priv->pdev;
> +
> if (info->screen_base)
> iounmap(info->screen_base);
> +
> +   /* release the bound platform device when called from
> +* remove_conflicting_framebuffers()
> +*/
> +   if (pdev) {
> +   priv->pdev = NULL; /* to avoid double-free */
> +   platform_device_unregister(pdev);
> +   }
>  }
>
>  static struct fb_ops simplefb_ops = {
> @@ -169,6 +185,7 @@ static int simplefb_probe(struct platform_device *pdev)
> struct simplefb_params params;
> struct fb_info *info;
> struct resource *me

Re: [PATCH 0/4] Fix ebizzy performance regression due to X86 TLB range flush v2

2013-12-18 Thread Ingo Molnar

* Mel Gorman  wrote:

> > Thanks again for going through all this. Tracking multi-commit 
> > performance regressions across 1.5 years worth of commits is 
> > generally very hard. Does your testing effort comes from 
> > enterprise Linux QA testing, or did you ran into this problem 
> > accidentally?
> 
> It does not come from enterprise Linux QA testing but it's motivated 
> by it. I want to catch as many "obvious" performance bugs before 
> they do as it saves time and stress in the long run. To assist that, 
> I setup continual performance regression testing and ebizzy was 
> included in the first report I opened. [...]

Neat!

> [...]  It makes me worry what the rest of the reports contain.

It will be full with reports of phenomenal speedups!

Thanks,

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


Re: changes caused by 0d11e6ac("blk-mq: fix use-after-free of request")

2013-12-18 Thread Matias Bjørling

On 12/18/2013 09:50 AM, Yuanhan Liu wrote:

Hi,

FYI, we noticed some changes caused by 0d11e6ac("blk-mq: fix use-after-free of 
request"):



The blk-mq accounting was faulty up to that commit. We should compare 
the blk-mq with the previous block layer.


Could you try to revert the following patches:

f02b9ac virtio-blk: virtqueue_kick() must be ordered with other...
1cf7e9c virtio_blk: blk-mq support

and compare the two runs (upto 0d11e6ac applied, and the same, with the 
two patches reverted)


Thanks


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


[tip:perf/core] perf timechart: Get number of CPUs from perf header

2013-12-18 Thread tip-bot for Stanislav Fomichev
Commit-ID:  58b9a18ecd251cbd6e666ad792023ab77c7d100e
Gitweb: http://git.kernel.org/tip/58b9a18ecd251cbd6e666ad792023ab77c7d100e
Author: Stanislav Fomichev 
AuthorDate: Mon, 2 Dec 2013 18:37:35 +0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 16:34:27 -0300

perf timechart: Get number of CPUs from perf header

Print all CPUs, even if there were no events (use perf header to get
number of CPUs).

This is required to support topology in the next patch.

Signed-off-by: Stanislav Fomichev 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Ramkumar Ramachandra 
Link: 
http://lkml.kernel.org/r/1385995056-20158-4-git-send-email-stfomic...@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-timechart.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 99fe363..db9c4c1 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -531,12 +531,10 @@ static int process_sample_event(struct perf_tool *tool,
tchart->last_time = sample->time;
}
 
-   if (sample->cpu > tchart->numcpus)
-   tchart->numcpus = sample->cpu;
-
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
-   return f(tchart, evsel, sample, cat_backtrace(event, sample, 
machine));
+   return f(tchart, evsel, sample,
+cat_backtrace(event, sample, machine));
}
 
return 0;
@@ -1038,8 +1036,6 @@ static void write_svg_file(struct timechart *tchart, 
const char *filename)
int count;
int thresh = TIME_THRESH;
 
-   tchart->numcpus++;
-
if (tchart->power_only)
tchart->proc_num = 0;
 
@@ -1069,6 +1065,25 @@ static void write_svg_file(struct timechart *tchart, 
const char *filename)
svg_close();
 }
 
+static int process_header(struct perf_file_section *section __maybe_unused,
+ struct perf_header *ph,
+ int feat,
+ int fd __maybe_unused,
+ void *data)
+{
+   struct timechart *tchart = data;
+
+   switch (feat) {
+   case HEADER_NRCPUS:
+   tchart->numcpus = ph->env.nr_cpus_avail;
+   break;
+   default:
+   break;
+   }
+
+   return 0;
+}
+
 static int __cmd_timechart(struct timechart *tchart, const char *output_name)
 {
const struct perf_evsel_str_handler power_tracepoints[] = {
@@ -1094,6 +1109,11 @@ static int __cmd_timechart(struct timechart *tchart, 
const char *output_name)
if (session == NULL)
return -ENOMEM;
 
+   (void)perf_header__process_sections(&session->header,
+   perf_data_file__fd(session->file),
+   tchart,
+   process_header);
+
if (!perf_session__has_traces(session, "timechart record"))
goto out_delete;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Print pid along the name

2013-12-18 Thread tip-bot for Stanislav Fomichev
Commit-ID:  de996228dedc74d9e72b749bbc8225f5e2bf19d8
Gitweb: http://git.kernel.org/tip/de996228dedc74d9e72b749bbc8225f5e2bf19d8
Author: Stanislav Fomichev 
AuthorDate: Mon, 2 Dec 2013 18:37:34 +0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 16:33:57 -0300

perf timechart: Print pid along the name

Add PID to the figures of CPU usage timechart.

Signed-off-by: Stanislav Fomichev 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Ramkumar Ramachandra 
Link: 
http://lkml.kernel.org/r/1385995056-20158-3-git-send-email-stfomic...@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-timechart.c | 1 +
 tools/perf/util/svghelper.c| 4 ++--
 tools/perf/util/svghelper.h| 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index d955095..99fe363 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -841,6 +841,7 @@ static void draw_cpu_usage(struct timechart *tchart)
svg_process(sample->cpu,
sample->start_time,
sample->end_time,
+   p->pid,
"sample",
c->comm,
sample->backtrace);
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 740f032..927851d 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -285,7 +285,7 @@ void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
fprintf(svgfile, "\n");
 }
 
-void svg_process(int cpu, u64 start, u64 end, const char *type, const char 
*name, const char *backtrace)
+void svg_process(int cpu, u64 start, u64 end, int pid, const char *type, const 
char *name, const char *backtrace)
 {
double width;
 
@@ -294,7 +294,7 @@ void svg_process(int cpu, u64 start, u64 end, const char 
*type, const char *name
 
 
fprintf(svgfile, "\n", 
time2pixels(start), cpu2y(cpu));
-   fprintf(svgfile, "%s %s\n", name, time_to_string(end - 
start));
+   fprintf(svgfile, "%d %s running %s\n", pid, name, 
time_to_string(end - start));
if (backtrace)
fprintf(svgfile, "Switched because:\n%s\n", 
backtrace);
fprintf(svgfile, "\n",
diff --git a/tools/perf/util/svghelper.h b/tools/perf/util/svghelper.h
index 7db6ae9..8b77ca6 100644
--- a/tools/perf/util/svghelper.h
+++ b/tools/perf/util/svghelper.h
@@ -11,7 +11,7 @@ extern void svg_waiting(int Yslot, int cpu, u64 start, u64 
end, const char *back
 extern void svg_cpu_box(int cpu, u64 max_frequency, u64 turbo_frequency);
 
 
-extern void svg_process(int cpu, u64 start, u64 end, const char *type, const 
char *name, const char *backtrace);
+extern void svg_process(int cpu, u64 start, u64 end, int pid, const char 
*type, const char *name, const char *backtrace);
 extern void svg_cstate(int cpu, u64 start, u64 end, int type);
 extern void svg_pstate(int cpu, u64 start, u64 end, u64 freq);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Add support for topology

2013-12-18 Thread tip-bot for Stanislav Fomichev
Commit-ID:  c507999790438cde78b5618fa64daefd697035af
Gitweb: http://git.kernel.org/tip/c507999790438cde78b5618fa64daefd697035af
Author: Stanislav Fomichev 
AuthorDate: Mon, 2 Dec 2013 18:37:36 +0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 16:34:53 -0300

perf timechart: Add support for topology

Add -t switch to sort CPUs topologically.

Signed-off-by: Stanislav Fomichev 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Ramkumar Ramachandra 
Link: 
http://lkml.kernel.org/r/1385995056-20158-5-git-send-email-stfomic...@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-timechart.txt |   3 +
 tools/perf/builtin-timechart.c  |  17 +++-
 tools/perf/util/svghelper.c | 132 +++-
 tools/perf/util/svghelper.h |   2 +
 4 files changed, 151 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-timechart.txt 
b/tools/perf/Documentation/perf-timechart.txt
index 271dd4e..367c1be 100644
--- a/tools/perf/Documentation/perf-timechart.txt
+++ b/tools/perf/Documentation/perf-timechart.txt
@@ -59,6 +59,9 @@ $ perf timechart
 -n::
 --proc-num::
 Print task info for at least given number of tasks.
+-t::
+--topology::
+Sort CPUs according to topology.
 
 RECORD OPTIONS
 --
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index db9c4c1..8bde57c 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -58,7 +58,8 @@ struct timechart {
first_time, last_time;
boolpower_only,
tasks_only,
-   with_backtrace;
+   with_backtrace,
+   topology;
 };
 
 struct per_pidcomm;
@@ -1077,6 +1078,18 @@ static int process_header(struct perf_file_section 
*section __maybe_unused,
case HEADER_NRCPUS:
tchart->numcpus = ph->env.nr_cpus_avail;
break;
+
+   case HEADER_CPU_TOPOLOGY:
+   if (!tchart->topology)
+   break;
+
+   if (svg_build_topology_map(ph->env.sibling_cores,
+  ph->env.nr_sibling_cores,
+  ph->env.sibling_threads,
+  ph->env.nr_sibling_threads))
+   fprintf(stderr, "problem building topology\n");
+   break;
+
default:
break;
}
@@ -1267,6 +1280,8 @@ int cmd_timechart(int argc, const char **argv,
"Look for files with symbols relative to this directory"),
OPT_INTEGER('n', "proc-num", &tchart.proc_num,
"min. number of tasks to print"),
+   OPT_BOOLEAN('t', "topology", &tchart.topology,
+   "sort CPUs according to topology"),
OPT_END()
};
const char * const timechart_usage[] = {
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 927851d..9468136 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -17,8 +17,11 @@
 #include 
 #include 
 #include 
+#include 
 
+#include "perf.h"
 #include "svghelper.h"
+#include "cpumap.h"
 
 static u64 first_time, last_time;
 static u64 turbo_frequency, max_freq;
@@ -39,9 +42,14 @@ static double cpu2slot(int cpu)
return 2 * cpu + 1;
 }
 
+static int *topology_map;
+
 static double cpu2y(int cpu)
 {
-   return cpu2slot(cpu) * SLOT_MULT;
+   if (topology_map)
+   return cpu2slot(topology_map[cpu]) * SLOT_MULT;
+   else
+   return cpu2slot(cpu) * SLOT_MULT;
 }
 
 static double time2pixels(u64 __time)
@@ -275,7 +283,7 @@ void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
time2pixels(last_time)-time2pixels(first_time),
cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT);
 
-   sprintf(cpu_string, "CPU %i", (int)cpu+1);
+   sprintf(cpu_string, "CPU %i", (int)cpu);
fprintf(svgfile, "%s\n",
10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, 
cpu_string);
 
@@ -568,3 +576,123 @@ void svg_close(void)
svgfile = NULL;
}
 }
+
+#define cpumask_bits(maskp) ((maskp)->bits)
+typedef struct { DECLARE_BITMAP(bits, MAX_NR_CPUS); } cpumask_t;
+
+struct topology {
+   cpumask_t *sib_core;
+   int sib_core_nr;
+   cpumask_t *sib_thr;
+   int sib_thr_nr;
+};
+
+static void scan_thread_topology(int *map, struct topology *t, int cpu, int 
*pos)
+{
+   int i;
+   int thr;
+
+   for (i = 0; i < t->sib_thr_nr; i++) {
+   if (!test_bit(cpu, cpumask_bits(&t->sib_thr[i])))
+   continue;
+
+   for_each_set_bit(thr,
+cpumask_bits(&t->sib_thr[i]),
+  

[tip:sched/core] sched: Assign correct scheduling domain to ' sd_llc'

2013-12-18 Thread tip-bot for Mel Gorman
Commit-ID:  5d4cf996cf134e8ddb4f906b8197feb9267c2b77
Gitweb: http://git.kernel.org/tip/5d4cf996cf134e8ddb4f906b8197feb9267c2b77
Author: Mel Gorman 
AuthorDate: Tue, 17 Dec 2013 09:21:25 +
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:08:43 +0100

sched: Assign correct scheduling domain to 'sd_llc'

Commit 42eb088e (sched: Avoid NULL dereference on sd_busy) corrected a NULL
dereference on sd_busy but the fix also altered what scheduling domain it
used for the 'sd_llc' percpu variable.

One impact of this is that a task selecting a runqueue may consider
idle CPUs that are not cache siblings as candidates for running.
Tasks are then running on CPUs that are not cache hot.

This was found through bisection where ebizzy threads were not seeing equal
performance and it looked like a scheduling fairness issue. This patch
mitigates but does not completely fix the problem on all machines tested
implying there may be an additional bug or a common root cause. Here are
the average range of performance seen by individual ebizzy threads. It
was tested on top of candidate patches related to x86 TLB range flushing.

4-core machine
3.13.0-rc33.13.0-rc3
   vanillafixsd-v3r3
Mean   10.00 (  0.00%)0.00 (  0.00%)
Mean   20.34 (  0.00%)0.10 ( 70.59%)
Mean   31.29 (  0.00%)0.93 ( 27.91%)
Mean   47.08 (  0.00%)0.77 ( 89.12%)
Mean   5  193.54 (  0.00%)2.14 ( 98.89%)
Mean   6  151.12 (  0.00%)2.06 ( 98.64%)
Mean   7  115.38 (  0.00%)2.04 ( 98.23%)
Mean   8  108.65 (  0.00%)1.92 ( 98.23%)

8-core machine
Mean   1 0.00 (  0.00%)0.00 (  0.00%)
Mean   2 0.40 (  0.00%)0.21 ( 47.50%)
Mean   323.73 (  0.00%)0.89 ( 96.25%)
Mean   412.79 (  0.00%)1.04 ( 91.87%)
Mean   513.08 (  0.00%)2.42 ( 81.50%)
Mean   623.21 (  0.00%)   69.46 (-199.27%)
Mean   715.85 (  0.00%)  101.72 (-541.77%)
Mean   8   109.37 (  0.00%)   19.13 ( 82.51%)
Mean   12  124.84 (  0.00%)   28.62 ( 77.07%)
Mean   16  113.50 (  0.00%)   24.16 ( 78.71%)

It's eliminated for one machine and reduced for another.

Signed-off-by: Mel Gorman 
Signed-off-by: Peter Zijlstra 
Cc: Alex Shi 
Cc: Andrew Morton 
Cc: Fengguang Wu 
Cc: H Peter Anvin 
Cc: Linus Torvalds 
Link: http://lkml.kernel.org/r/20131217092124.gv11...@suse.de
Signed-off-by: Ingo Molnar 
---
 kernel/sched/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 19af58f..a88f4a4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4902,6 +4902,7 @@ DEFINE_PER_CPU(struct sched_domain *, sd_asym);
 static void update_top_cache_domain(int cpu)
 {
struct sched_domain *sd;
+   struct sched_domain *busy_sd = NULL;
int id = cpu;
int size = 1;
 
@@ -4909,9 +4910,9 @@ static void update_top_cache_domain(int cpu)
if (sd) {
id = cpumask_first(sched_domain_span(sd));
size = cpumask_weight(sched_domain_span(sd));
-   sd = sd->parent; /* sd_busy */
+   busy_sd = sd->parent; /* sd_busy */
}
-   rcu_assign_pointer(per_cpu(sd_busy, cpu), sd);
+   rcu_assign_pointer(per_cpu(sd_busy, cpu), busy_sd);
 
rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
per_cpu(sd_llc_size, cpu) = size;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/core] sched/rt: Fix rq's cpupri leak while enqueue/ dequeue child RT entities

2013-12-18 Thread tip-bot for Kirill Tkhai
Commit-ID:  757dfcaa41844595964f1220f1d33182dae49976
Gitweb: http://git.kernel.org/tip/757dfcaa41844595964f1220f1d33182dae49976
Author: Kirill Tkhai 
AuthorDate: Wed, 27 Nov 2013 19:59:13 +0400
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:08:44 +0100

sched/rt: Fix rq's cpupri leak while enqueue/dequeue child RT entities

This patch touches the RT group scheduling case.

Functions inc_rt_prio_smp() and dec_rt_prio_smp() change (global) rq's
priority, while rt_rq passed to them may be not the top-level rt_rq.
This is wrong, because changing of priority on a child level does not
guarantee that the priority is the highest all over the rq. So, this
leak makes RT balancing unusable.

The short example: the task having the highest priority among all rq's
RT tasks (no one other task has the same priority) are waking on a
throttle rt_rq.  The rq's cpupri is set to the task's priority
equivalent, but real rq->rt.highest_prio.curr is less.

The patch below fixes the problem.

Signed-off-by: Kirill Tkhai 
Signed-off-by: Peter Zijlstra 
CC: Steven Rostedt 
CC: sta...@vger.kernel.org
Link: http://lkml.kernel.org/r/49231385567...@web4m.yandex.ru
Signed-off-by: Ingo Molnar 
---
 kernel/sched/rt.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7d57275..1c40655 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -901,6 +901,13 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int 
prev_prio)
 {
struct rq *rq = rq_of_rt_rq(rt_rq);
 
+#ifdef CONFIG_RT_GROUP_SCHED
+   /*
+* Change rq's cpupri only if rt_rq is the top queue.
+*/
+   if (&rq->rt != rt_rq)
+   return;
+#endif
if (rq->online && prio < prev_prio)
cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
 }
@@ -910,6 +917,13 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int 
prev_prio)
 {
struct rq *rq = rq_of_rt_rq(rt_rq);
 
+#ifdef CONFIG_RT_GROUP_SCHED
+   /*
+* Change rq's cpupri only if rt_rq is the top queue.
+*/
+   if (&rq->rt != rt_rq)
+   return;
+#endif
if (rq->online && rt_rq->highest_prio.curr != prev_prio)
cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf: Document the new transaction sample type

2013-12-18 Thread tip-bot for Vince Weaver
Commit-ID:  189b84fb54490ae2424346a8e63f8e019385
Gitweb: http://git.kernel.org/tip/189b84fb54490ae2424346a8e63f8e019385
Author: Vince Weaver 
AuthorDate: Fri, 13 Dec 2013 15:52:25 -0500
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:04:01 +0100

perf: Document the new transaction sample type

Commit fdfbbd07e91f8fe3871 ("perf: Add generic transaction flags")
added support for PERF_SAMPLE_TRANSACTION but forgot to add documentation
for the sample type to include/uapi/linux/perf_event.h

Signed-off-by: Vince Weaver 
Signed-off-by: Peter Zijlstra 
Cc: Andi Kleen 
Link: 
http://lkml.kernel.org/r/alpine.deb.2.02.1312131548450.10...@pianoman.cluster.toy
Signed-off-by: Ingo Molnar 
---
 include/uapi/linux/perf_event.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index e1802d6..959d454 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -679,6 +679,7 @@ enum perf_event_type {
 *
 *  { u64   weight;   } && PERF_SAMPLE_WEIGHT
 *  { u64   data_src; } && PERF_SAMPLE_DATA_SRC
+*  { u64   transaction; } && 
PERF_SAMPLE_TRANSACTION
 * };
 */
PERF_RECORD_SAMPLE  = 9,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Clarify method to get DSO binary_type filename

2013-12-18 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  ee4e9625c8d4ec3a35322a882f7b6e035d2a1ad5
Gitweb: http://git.kernel.org/tip/ee4e9625c8d4ec3a35322a882f7b6e035d2a1ad5
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 16 Dec 2013 17:03:18 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 17:03:18 -0300

perf symbols: Clarify method to get DSO binary_type filename

Using dso__binary_type_file() make it look like this function will
return a file, not just its filename, so rename it to:

dso__read_binary_type_filename()

to make its purpose clear, just like we have:

dso__read_running_kernel_build_id()

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Mike Galbraith 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-vkf3upzrfrxtr01wueej4...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/dso.c| 14 +++---
 tools/perf/util/dso.h|  4 ++--
 tools/perf/util/symbol.c |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index e7f4449..eef1662 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -28,8 +28,9 @@ char dso__symtab_origin(const struct dso *dso)
return origin[dso->symtab_type];
 }
 
-int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
- char *root_dir, char *filename, size_t size)
+int dso__read_binary_type_filename(const struct dso *dso,
+  enum dso_binary_type type,
+  char *root_dir, char *filename, size_t size)
 {
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
int ret = 0;
@@ -137,19 +138,18 @@ int dso__binary_type_file(const struct dso *dso, enum 
dso_binary_type type,
 
 static int open_dso(struct dso *dso, struct machine *machine)
 {
-   char *root_dir = (char *) "";
-   char *name;
int fd;
+   char *root_dir = (char *)"";
+   char *name = malloc(PATH_MAX);
 
-   name = malloc(PATH_MAX);
if (!name)
return -ENOMEM;
 
if (machine)
root_dir = machine->root_dir;
 
-   if (dso__binary_type_file(dso, dso->data_type,
- root_dir, name, PATH_MAX)) {
+   if (dso__read_binary_type_filename(dso, dso->data_type,
+   root_dir, name, PATH_MAX)) {
free(name);
return -EINVAL;
}
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index e1cc506..aa33847 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -128,8 +128,8 @@ void dso__read_running_kernel_build_id(struct dso *dso,
 int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
 
 char dso__symtab_origin(const struct dso *dso);
-int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
- char *root_dir, char *filename, size_t size);
+int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type 
type,
+  char *root_dir, char *filename, size_t size);
 
 int dso__data_fd(struct dso *dso, struct machine *machine);
 ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 61eb1cd..9ee4b80 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1258,8 +1258,8 @@ int dso__load(struct dso *dso, struct map *map, 
symbol_filter_t filter)
 
enum dso_binary_type symtab_type = binary_type_symtab[i];
 
-   if (dso__binary_type_file(dso, symtab_type,
- root_dir, name, PATH_MAX))
+   if (dso__read_binary_type_filename(dso, symtab_type,
+  root_dir, name, PATH_MAX))
continue;
 
/* Name is now the name of the next image to try */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Remove needless static binary_type array

2013-12-18 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  631d34b5626a8de828f3ab8da54013293097e678
Gitweb: http://git.kernel.org/tip/631d34b5626a8de828f3ab8da54013293097e678
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 16 Dec 2013 16:57:43 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 16:57:43 -0300

perf symbols: Remove needless static binary_type array

There are no references to that array anywhere, it is only used to try
a series of "binary" types in turn, always setting dso->data_type till
one can be used.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Mike Galbraith 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-4mw7xrbs12tln6v2uthg7...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/dso.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 436922f..e7f4449 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -161,7 +161,7 @@ static int open_dso(struct dso *dso, struct machine 
*machine)
 
 int dso__data_fd(struct dso *dso, struct machine *machine)
 {
-   static enum dso_binary_type binary_type_data[] = {
+   enum dso_binary_type binary_type_data[] = {
DSO_BINARY_TYPE__BUILD_ID_CACHE,
DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
DSO_BINARY_TYPE__NOT_FOUND,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf: Disable all pmus on unthrottling and rescheduling

2013-12-18 Thread tip-bot for Alexander Shishkin
Commit-ID:  443772776c69ac9293d66b4d69fd9af16299cc2a
Gitweb: http://git.kernel.org/tip/443772776c69ac9293d66b4d69fd9af16299cc2a
Author: Alexander Shishkin 
AuthorDate: Mon, 16 Dec 2013 14:17:36 +0200
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:04:00 +0100

perf: Disable all pmus on unthrottling and rescheduling

Currently, only one PMU in a context gets disabled during unthrottling
and event_sched_{out,in}(), however, events in one context may belong to
different pmus, which results in PMUs being reprogrammed while they are
still enabled.

This means that mixed PMU use [which is rare in itself] resulted in
potentially completely unreliable results: corrupted events, bogus
results, etc.

This patch temporarily disables PMUs that correspond to
each event in the context while these events are being modified.

Signed-off-by: Alexander Shishkin 
Reviewed-by: Andi Kleen 
Signed-off-by: Peter Zijlstra 
Cc: Frederic Weisbecker 
Cc: Mike Galbraith 
Cc: Paul Mackerras 
Cc: Stephane Eranian 
Cc: Alexander Shishkin 
Link: 
http://lkml.kernel.org/r/1387196256-8030-1-git-send-email-alexander.shish...@linux.intel.com
Signed-off-by: Ingo Molnar 
---
 kernel/events/core.c | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 72348dc..f574401 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1396,6 +1396,8 @@ event_sched_out(struct perf_event *event,
if (event->state != PERF_EVENT_STATE_ACTIVE)
return;
 
+   perf_pmu_disable(event->pmu);
+
event->state = PERF_EVENT_STATE_INACTIVE;
if (event->pending_disable) {
event->pending_disable = 0;
@@ -1412,6 +1414,8 @@ event_sched_out(struct perf_event *event,
ctx->nr_freq--;
if (event->attr.exclusive || !cpuctx->active_oncpu)
cpuctx->exclusive = 0;
+
+   perf_pmu_enable(event->pmu);
 }
 
 static void
@@ -1652,6 +1656,7 @@ event_sched_in(struct perf_event *event,
 struct perf_event_context *ctx)
 {
u64 tstamp = perf_event_time(event);
+   int ret = 0;
 
if (event->state <= PERF_EVENT_STATE_OFF)
return 0;
@@ -1674,10 +1679,13 @@ event_sched_in(struct perf_event *event,
 */
smp_wmb();
 
+   perf_pmu_disable(event->pmu);
+
if (event->pmu->add(event, PERF_EF_START)) {
event->state = PERF_EVENT_STATE_INACTIVE;
event->oncpu = -1;
-   return -EAGAIN;
+   ret = -EAGAIN;
+   goto out;
}
 
event->tstamp_running += tstamp - event->tstamp_stopped;
@@ -1693,7 +1701,10 @@ event_sched_in(struct perf_event *event,
if (event->attr.exclusive)
cpuctx->exclusive = 1;
 
-   return 0;
+out:
+   perf_pmu_enable(event->pmu);
+
+   return ret;
 }
 
 static int
@@ -2743,6 +2754,8 @@ static void perf_adjust_freq_unthr_context(struct 
perf_event_context *ctx,
if (!event_filter_match(event))
continue;
 
+   perf_pmu_disable(event->pmu);
+
hwc = &event->hw;
 
if (hwc->interrupts == MAX_INTERRUPTS) {
@@ -2752,7 +2765,7 @@ static void perf_adjust_freq_unthr_context(struct 
perf_event_context *ctx,
}
 
if (!event->attr.freq || !event->attr.sample_freq)
-   continue;
+   goto next;
 
/*
 * stop the event and update event->count
@@ -2774,6 +2787,8 @@ static void perf_adjust_freq_unthr_context(struct 
perf_event_context *ctx,
perf_adjust_period(event, period, delta, false);
 
event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
+   next:
+   perf_pmu_enable(event->pmu);
}
 
perf_pmu_enable(ctx->pmu);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] tools/: Convert to new topic libraries

2013-12-18 Thread tip-bot for Borislav Petkov
Commit-ID:  553873e1df63a20559ac9c336765dc7055cfc3d4
Gitweb: http://git.kernel.org/tip/553873e1df63a20559ac9c336765dc7055cfc3d4
Author: Borislav Petkov 
AuthorDate: Mon, 9 Dec 2013 17:14:23 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 16 Dec 2013 16:03:27 -0300

tools/: Convert to new topic libraries

Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
the Makefile lives and then we place the headers in subdirs.

For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-)) and
we link it into the tools which need it - in this case perf and
tools/vm/page-types.

acme:

"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.

But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."

Fixup documentation cleaning target while at it.

Signed-off-by: Borislav Petkov 
Acked-by: Ingo Molnar 
Cc: Adrian Hunter 
Cc: Andi Kleen 
Cc: Arjan van de Ven 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Mike Galbraith 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Pekka Enberg 
Cc: Peter Zijlstra 
Cc: Robert Richter 
Cc: Stanislav Fomichev 
Cc: Stephane Eranian 
Cc: Steven Rostedt 
Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email...@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/Makefile | 12 ++--
 tools/lib/{lk => api}/Makefile | 18 +++---
 tools/lib/{lk => api/fs}/debugfs.c |  0
 tools/lib/{lk => api/fs}/debugfs.h |  6 +++---
 tools/perf/Makefile.perf   | 33 -
 tools/perf/builtin-kvm.c   |  2 +-
 tools/perf/builtin-probe.c |  2 +-
 tools/perf/perf.c  |  2 +-
 tools/perf/tests/parse-events.c|  2 +-
 tools/perf/util/evlist.c   |  2 +-
 tools/perf/util/evsel.c|  2 +-
 tools/perf/util/parse-events.c |  2 +-
 tools/perf/util/probe-event.c  |  2 +-
 tools/perf/util/setup.py   |  4 ++--
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/util.h |  2 +-
 tools/vm/Makefile  | 14 +++---
 tools/vm/page-types.c  |  2 +-
 18 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index a9b0200..927cd46 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,10 +39,10 @@ cpupower: FORCE
 cgroup firewire guest usb virtio vm net: FORCE
$(call descend,$@)
 
-liblk: FORCE
-   $(call descend,lib/lk)
+libapikfs: FORCE
+   $(call descend,lib/api)
 
-perf: liblk FORCE
+perf: libapikfs FORCE
$(call descend,$@)
 
 selftests: FORCE
@@ -80,10 +80,10 @@ cpupower_clean:
 cgroup_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean 
net_clean:
$(call descend,$(@:_clean=),clean)
 
-liblk_clean:
-   $(call descend,lib/lk,clean)
+libapikfs_clean:
+   $(call descend,lib/api,clean)
 
-perf_clean: liblk_clean
+perf_clean: libapikfs_clean
$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
diff --git a/tools/lib/lk/Makefile b/tools/lib/api/Makefile
similarity index 66%
rename from tools/lib/lk/Makefile
rename to tools/lib/api/Makefile
index 3dba0a4..ed2f51e 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/api/Makefile
@@ -1,4 +1,5 @@
 include ../../scripts/Makefile.include
+include ../../perf/config/utilities.mak# QUIET_CLEAN
 
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
@@ -7,11 +8,11 @@ AR = $(CROSS_COMPILE)ar
 LIB_H=
 LIB_OBJS=
 
-LIB_H += debugfs.h
+LIB_H += fs/debugfs.h
 
-LIB_OBJS += $(OUTPUT)debugfs.o
+LIB_OBJS += $(OUTPUT)fs/debugfs.o
 
-LIBFILE = liblk.a
+LIBFILE = libapikfs.a
 
 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 
$(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
 EXTLIBS = -lelf -lpthread -lrt -lm
@@ -25,14 +26,17 @@ $(LIBFILE): $(LIB_OBJS)
 
 $(LIB_OBJS): $(LIB_H)
 
-$(OUTPUT)%.o: %.c
+libapi_dirs:
+   $(QUIET_MKDIR)mkdir -p $(OUTPUT)fs/
+
+$(OUTPUT)%.o: %.c libapi_dirs
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
-$(OUTPUT)%.s: %.c
+$(OUTPUT)%.s: %.c libapi_dirs
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
-$(OUTPUT)%.o: %.S
+$(OUTPUT)%.o: %.S libapi_dirs
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
 
 clean:
-   $(RM) $(LIB_OBJS) $(LIBFILE)
+   $(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
 
 .PHONY: clean
diff --git a/tools/lib/lk/debugfs.c b/tools/lib/api/fs/debugfs.c
similarity index 100%
rename from tools/lib/lk/debugfs.c
rename to tools/lib/api/fs/debugfs.c
diff --git a/tools/lib/lk/debugfs.h b/tools/lib/api/fs/debugfs.h
similarity index 86%
rename from tools/lib/lk/debugfs.h
rename to tools/lib/api/fs/debugfs.h
index 935c59b..f19d3df 100644
--- a/tools/lib/lk/debugfs.h
+++ b/tools/lib/api/fs/debugfs.h
@@ -1,5 +1,5 @@
-#ifndef __LK_DEBUGFS_H__
-#define _

[tip:sched/core] sched/numa: Drop sysctl_numa_balancing_settle_count sysctl

2013-12-18 Thread tip-bot for Wanpeng Li
Commit-ID:  1bd53a7efdc988163ec4c25f656df38dbe500632
Gitweb: http://git.kernel.org/tip/1bd53a7efdc988163ec4c25f656df38dbe500632
Author: Wanpeng Li 
AuthorDate: Thu, 12 Dec 2013 15:23:23 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:24:38 +0100

sched/numa: Drop sysctl_numa_balancing_settle_count sysctl

commit 887c290e (sched/numa: Decide whether to favour task or group weights
based on swap candidate relationships) drop the check against
sysctl_numa_balancing_settle_count, this patch remove the sysctl.

Signed-off-by: Wanpeng Li 
Acked-by: Mel Gorman 
Reviewed-by: Rik van Riel 
Acked-by: David Rientjes 
Signed-off-by: Peter Zijlstra 
Cc: Andrew Morton 
Cc: Naoya Horiguchi 
Link: 
http://lkml.kernel.org/r/1386833006-6600-1-git-send-email-liw...@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar 
---
 Documentation/sysctl/kernel.txt | 5 -
 include/linux/sched/sysctl.h| 1 -
 kernel/sched/fair.c | 9 -
 kernel/sysctl.c | 7 ---
 4 files changed, 22 deletions(-)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 26b7ee4..6d48640 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -428,11 +428,6 @@ rate for each task.
 numa_balancing_scan_size_mb is how many megabytes worth of pages are
 scanned for a given scan.
 
-numa_balancing_settle_count is how many scan periods must complete before
-the schedule balancer stops pushing the task towards a preferred node. This
-gives the scheduler a chance to place the task on an alternative node if the
-preferred node is overloaded.
-
 numa_balancing_migrate_deferred is how many page migrations get skipped
 unconditionally, after a page migration is skipped because a page is shared
 with other tasks. This reduces page migration overhead, and determines
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 41467f8..31e0193 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -48,7 +48,6 @@ extern unsigned int sysctl_numa_balancing_scan_delay;
 extern unsigned int sysctl_numa_balancing_scan_period_min;
 extern unsigned int sysctl_numa_balancing_scan_period_max;
 extern unsigned int sysctl_numa_balancing_scan_size;
-extern unsigned int sysctl_numa_balancing_settle_count;
 
 #ifdef CONFIG_SCHED_DEBUG
 extern unsigned int sysctl_sched_migration_cost;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a9185f7..fcb6c17 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -872,15 +872,6 @@ static unsigned int task_scan_max(struct task_struct *p)
return max(smin, smax);
 }
 
-/*
- * Once a preferred node is selected the scheduler balancer will prefer moving
- * a task to that node for sysctl_numa_balancing_settle_count number of PTE
- * scans. This will give the process the chance to accumulate more faults on
- * the preferred node but still allow the scheduler to move the task again if
- * the nodes CPUs are overloaded.
- */
-unsigned int sysctl_numa_balancing_settle_count __read_mostly = 4;
-
 static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
 {
rq->nr_numa_running += (p->numa_preferred_nid != -1);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 34a6047..c8da99f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -385,13 +385,6 @@ static struct ctl_table kern_table[] = {
.proc_handler   = proc_dointvec,
},
{
-   .procname   = "numa_balancing_settle_count",
-   .data   = &sysctl_numa_balancing_settle_count,
-   .maxlen = sizeof(unsigned int),
-   .mode   = 0644,
-   .proc_handler   = proc_dointvec,
-   },
-   {
.procname   = "numa_balancing_migrate_deferred",
.data   = &sysctl_numa_balancing_migrate_deferred,
.maxlen = sizeof(unsigned int),
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Add --highlight option

2013-12-18 Thread tip-bot for Stanislav Fomichev
Commit-ID:  e57a2dffbc7e28cef5f4659b98a9d5595010ab4d
Gitweb: http://git.kernel.org/tip/e57a2dffbc7e28cef5f4659b98a9d5595010ab4d
Author: Stanislav Fomichev 
AuthorDate: Tue, 17 Dec 2013 19:53:49 +0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 17 Dec 2013 16:33:55 -0300

perf timechart: Add --highlight option

This option highlights tasks (using different color) that run more than
given duration or tasks with given name.

Signed-off-by: Stanislav Fomichev 
Acked-by: Ingo Molnar 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Ramkumar Ramachandra 
Link: http://lkml.kernel.org/r/20131217155349.GA13021@stfomichev-desktop
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-timechart.txt | 13 +
 tools/perf/builtin-timechart.c  | 21 -
 tools/perf/util/svghelper.c | 23 ---
 tools/perf/util/svghelper.h |  4 +++-
 4 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Documentation/perf-timechart.txt 
b/tools/perf/Documentation/perf-timechart.txt
index 367c1be..bc5990c 100644
--- a/tools/perf/Documentation/perf-timechart.txt
+++ b/tools/perf/Documentation/perf-timechart.txt
@@ -56,12 +56,25 @@ $ perf timechart
 
   Written 10.2 seconds of trace to output.svg.
 
+Record system-wide timechart:
+
+  $ perf timechart record
+
+  then generate timechart and highlight 'gcc' tasks:
+
+  $ perf timechart --highlight gcc
+
 -n::
 --proc-num::
 Print task info for at least given number of tasks.
 -t::
 --topology::
 Sort CPUs according to topology.
+--highlight=::
+   Highlight tasks (using different color) that run more than given
+   duration or tasks with given name. If number is given it's interpreted
+   as number of nanoseconds. If non-numeric string is given it's
+   interpreted as task name.
 
 RECORD OPTIONS
 --
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 8bde57c..20d4212 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -841,7 +841,6 @@ static void draw_cpu_usage(struct timechart *tchart)
sample->start_time,
sample->end_time,
p->pid,
-   "sample",
c->comm,
sample->backtrace);
}
@@ -1252,6 +1251,23 @@ parse_process(const struct option *opt __maybe_unused, 
const char *arg,
return 0;
 }
 
+static int
+parse_highlight(const struct option *opt __maybe_unused, const char *arg,
+   int __maybe_unused unset)
+{
+   unsigned long duration = strtoul(arg, NULL, 0);
+
+   if (svg_highlight || svg_highlight_name)
+   return -1;
+
+   if (duration)
+   svg_highlight = duration;
+   else
+   svg_highlight_name = strdup(arg);
+
+   return 0;
+}
+
 int cmd_timechart(int argc, const char **argv,
  const char *prefix __maybe_unused)
 {
@@ -1270,6 +1286,9 @@ int cmd_timechart(int argc, const char **argv,
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_STRING('o', "output", &output_name, "file", "output file name"),
OPT_INTEGER('w', "width", &svg_page_width, "page width"),
+   OPT_CALLBACK(0, "highlight", NULL, "duration or task name",
+ "highlight tasks. Pass duration in ns or process name.",
+  parse_highlight),
OPT_BOOLEAN('P', "power-only", &tchart.power_only, "output power data 
only"),
OPT_BOOLEAN('T', "tasks-only", &tchart.tasks_only,
"output processes data only"),
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 9468136..56a84f2 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -31,6 +31,8 @@ static u64 turbo_frequency, max_freq;
 #define SLOT_HEIGHT 25.0
 
 int svg_page_width = 1000;
+u64 svg_highlight;
+const char *svg_highlight_name;
 
 #define MIN_TEXT_SIZE 0.01
 
@@ -112,6 +114,7 @@ void open_svg(const char *filename, int cpus, int rows, u64 
start, u64 end)
fprintf(svgfile, "  rect.process  { fill:rgb(180,180,180); 
fill-opacity:0.9; stroke-width:1;   stroke:rgb(  0,  0,  0); } \n");
fprintf(svgfile, "  rect.process2 { fill:rgb(180,180,180); 
fill-opacity:0.9; stroke-width:0;   stroke:rgb(  0,  0,  0); } \n");
fprintf(svgfile, "  rect.sample   { fill:rgb(  0,  0,255); 
fill-opacity:0.8; stroke-width:0;   stroke:rgb(  0,  0,  0); } \n");
+   fprintf(svgfile, "  rect.sample_hi{ fill:rgb(255,128,  0); 
fill-opacity:0.8; stroke-width:0;   stroke:rgb(  0,  0,  0);

[tip:perf/core] perf/x86: enable Haswell Celeron RAPL support

2013-12-18 Thread tip-bot for Stephane Eranian
Commit-ID:  7fd565e27547c913b83b46d94662103be81a88ec
Gitweb: http://git.kernel.org/tip/7fd565e27547c913b83b46d94662103be81a88ec
Author: Stephane Eranian 
AuthorDate: Mon, 16 Dec 2013 21:20:23 +0100
Committer:  Ingo Molnar 
CommitDate: Tue, 17 Dec 2013 15:21:32 +0100

perf/x86: enable Haswell Celeron RAPL support

Enable RAPL support for Haswell Celeron (model 69).

Signed-off-by: Stephane Eranian 
Signed-off-by: Peter Zijlstra 
Cc: a...@linux.intel.com
Cc: a...@redhat.com
Cc: jo...@redhat.com
Cc: zheng.z@intel.com
Cc: b...@alien8.de
Cc: vincent.wea...@maine.edu
Cc: maria.n.dimakopou...@gmail.com
Cc: pet...@infradead.org
Link: 
http://lkml.kernel.org/r/1387225224-27799-2-git-send-email-eran...@google.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/cpu/perf_event_intel_rapl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c 
b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
index bf8e4a7..0e3754e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
@@ -615,6 +615,7 @@ static int __init rapl_pmu_init(void)
case 42: /* Sandy Bridge */
case 58: /* Ivy Bridge */
case 60: /* Haswell */
+   case 69: /* Haswell-Celeron */
rapl_cntr_mask = RAPL_IDX_CLN;
rapl_pmu_events_group.attrs = rapl_events_cln_attr;
break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >