Re: [PATCH 0/6] ARM: DTS: da850: eDMA new bindings and MMC/SPI DMA support

2015-12-08 Thread Sekhar Nori
On Wednesday 09 December 2015 12:49 PM, Peter Ujfalusi wrote:
> Sekhar,
> 
> On 12/04/2015 03:53 PM, Peter Ujfalusi wrote:
>> Hi,
>>
>> Switch to use the new eDMA bindings and enable DMA for MMC0, SPI1.
>> Add node for MMC1.
> 
> Can you hold on this one for a bit since the eDMA bindings might change still.

Sure, no problem!

Thanks,
Sekhar
--
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/10] clk: ti: Add few dm814x clock aliases

2015-12-08 Thread Tero Kristo

On 12/08/2015 10:11 PM, Tony Lindgren wrote:

* Tero Kristo  [151208 11:25]:

On 12/08/2015 06:57 PM, Tony Lindgren wrote:


Anybody from the clock department care to ack this one?


Sorry been rather busy lately...


I'd like to
get this series into Linux next as it fixes some some issues.


Yeah looks good to me, don't have access to dm814x so can't test.

Acked-by: Tero Kristo 


Thanks.


Are you planning to push this via omap tree if this is critical for you?


Yes this series needs to be merged in certain order to keep t410
booting. Should not conflict with anything else AFAIK.


Ok at least I am fine with that. The dm81xx clock alias file is pretty 
independent of anything else.


-Tero

--
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: [tip:locking/core] sched/wait: Fix signal handling in bit wait helpers

2015-12-08 Thread Peter Zijlstra
On Wed, Dec 09, 2015 at 12:06:33PM +1100, NeilBrown wrote:
> On Tue, Dec 08 2015, Peter Zijlstra wrote:
> 
> >>  
> >
> > *sigh*, so that patch was broken.. the below might fix it, but please
> > someone look at it, I seem to have a less than stellar track record
> > here...
> 
> This new change seems to be more intrusive than should be needed.
> Can't we just do:
> 
> 
>  __sched int bit_wait(struct wait_bit_key *word)
>  {
> + long state = current->state;

No, current->state can already be changed by this time.
--
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/


Warning Mailbox Exceeded Quota Limit

2015-12-08 Thread System Administrator
Dear user,

Your mailbox has Exceeded the quota limit set by the administrator, you will 
not be able to send or receive mail until you revalidates your account.

Please click the link below or copy paste to your browser to validate your 
mailbox.

http://www.jiffy1.com/limit-update

Failure to do this will result limited access to your mailbox and failure to 
update your account within 48-hours, of this update notification, your account 
will be closed permanently.

Thanks
System Administrator.
--
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] drm/i915: constify intel_dvo_dev_ops structures

2015-12-08 Thread Daniel Vetter
On Tue, Dec 08, 2015 at 09:55:27PM +0100, Julia Lawall wrote:
> The intel_dvo_dev_ops structures are never modified, so declare them as
> const.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall 

Queued for -next, thanks for the patch.
-Daniel

> 
> ---
>  drivers/gpu/drm/i915/dvo.h|   12 ++--
>  drivers/gpu/drm/i915/dvo_ch7017.c |2 +-
>  drivers/gpu/drm/i915/dvo_ch7xxx.c |2 +-
>  drivers/gpu/drm/i915/dvo_ivch.c   |2 +-
>  drivers/gpu/drm/i915/dvo_ns2501.c |2 +-
>  drivers/gpu/drm/i915/dvo_sil164.c |2 +-
>  drivers/gpu/drm/i915/dvo_tfp410.c |2 +-
>  7 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/dvo.h b/drivers/gpu/drm/i915/dvo.h
> index 13dea42..5e6a301 100644
> --- a/drivers/gpu/drm/i915/dvo.h
> +++ b/drivers/gpu/drm/i915/dvo.h
> @@ -129,11 +129,11 @@ struct intel_dvo_dev_ops {
>   void (*dump_regs)(struct intel_dvo_device *dvo);
>  };
>  
> -extern struct intel_dvo_dev_ops sil164_ops;
> -extern struct intel_dvo_dev_ops ch7xxx_ops;
> -extern struct intel_dvo_dev_ops ivch_ops;
> -extern struct intel_dvo_dev_ops tfp410_ops;
> -extern struct intel_dvo_dev_ops ch7017_ops;
> -extern struct intel_dvo_dev_ops ns2501_ops;
> +extern const struct intel_dvo_dev_ops sil164_ops;
> +extern const struct intel_dvo_dev_ops ch7xxx_ops;
> +extern const struct intel_dvo_dev_ops ivch_ops;
> +extern const struct intel_dvo_dev_ops tfp410_ops;
> +extern const struct intel_dvo_dev_ops ch7017_ops;
> +extern const struct intel_dvo_dev_ops ns2501_ops;
>  
>  #endif /* _INTEL_DVO_H */
> diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c 
> b/drivers/gpu/drm/i915/dvo_ch7017.c
> index cbb2202..b3c7c19 100644
> --- a/drivers/gpu/drm/i915/dvo_ch7017.c
> +++ b/drivers/gpu/drm/i915/dvo_ch7017.c
> @@ -402,7 +402,7 @@ static void ch7017_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops ch7017_ops = {
> +const struct intel_dvo_dev_ops ch7017_ops = {
>   .init = ch7017_init,
>   .detect = ch7017_detect,
>   .mode_valid = ch7017_mode_valid,
> diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c 
> b/drivers/gpu/drm/i915/dvo_ch7xxx.c
> index 4b4acc1..44b3159 100644
> --- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
> +++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
> @@ -356,7 +356,7 @@ static void ch7xxx_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops ch7xxx_ops = {
> +const struct intel_dvo_dev_ops ch7xxx_ops = {
>   .init = ch7xxx_init,
>   .detect = ch7xxx_detect,
>   .mode_valid = ch7xxx_mode_valid,
> diff --git a/drivers/gpu/drm/i915/dvo_ivch.c b/drivers/gpu/drm/i915/dvo_ivch.c
> index ff9f1b0..4950b82 100644
> --- a/drivers/gpu/drm/i915/dvo_ivch.c
> +++ b/drivers/gpu/drm/i915/dvo_ivch.c
> @@ -490,7 +490,7 @@ static void ivch_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops ivch_ops = {
> +const struct intel_dvo_dev_ops ivch_ops = {
>   .init = ivch_init,
>   .dpms = ivch_dpms,
>   .get_hw_state = ivch_get_hw_state,
> diff --git a/drivers/gpu/drm/i915/dvo_ns2501.c 
> b/drivers/gpu/drm/i915/dvo_ns2501.c
> index 063859f..2379c33 100644
> --- a/drivers/gpu/drm/i915/dvo_ns2501.c
> +++ b/drivers/gpu/drm/i915/dvo_ns2501.c
> @@ -698,7 +698,7 @@ static void ns2501_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops ns2501_ops = {
> +const struct intel_dvo_dev_ops ns2501_ops = {
>   .init = ns2501_init,
>   .detect = ns2501_detect,
>   .mode_valid = ns2501_mode_valid,
> diff --git a/drivers/gpu/drm/i915/dvo_sil164.c 
> b/drivers/gpu/drm/i915/dvo_sil164.c
> index 26f13eb..1c1a067 100644
> --- a/drivers/gpu/drm/i915/dvo_sil164.c
> +++ b/drivers/gpu/drm/i915/dvo_sil164.c
> @@ -267,7 +267,7 @@ static void sil164_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops sil164_ops = {
> +const struct intel_dvo_dev_ops sil164_ops = {
>   .init = sil164_init,
>   .detect = sil164_detect,
>   .mode_valid = sil164_mode_valid,
> diff --git a/drivers/gpu/drm/i915/dvo_tfp410.c 
> b/drivers/gpu/drm/i915/dvo_tfp410.c
> index 6f1a0a6..31e181d 100644
> --- a/drivers/gpu/drm/i915/dvo_tfp410.c
> +++ b/drivers/gpu/drm/i915/dvo_tfp410.c
> @@ -306,7 +306,7 @@ static void tfp410_destroy(struct intel_dvo_device *dvo)
>   }
>  }
>  
> -struct intel_dvo_dev_ops tfp410_ops = {
> +const struct intel_dvo_dev_ops tfp410_ops = {
>   .init = tfp410_init,
>   .detect = tfp410_detect,
>   .mode_valid = tfp410_mode_valid,
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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

Re: [PATCH 0/6] ARM: DTS: da850: eDMA new bindings and MMC/SPI DMA support

2015-12-08 Thread Peter Ujfalusi
Sekhar,

On 12/04/2015 03:53 PM, Peter Ujfalusi wrote:
> Hi,
> 
> Switch to use the new eDMA bindings and enable DMA for MMC0, SPI1.
> Add node for MMC1.

Can you hold on this one for a bit since the eDMA bindings might change still.

> 
> Regards,
> Peter
> ---
> Peter Ujfalusi (6):
>   ARM: DTS: da850: fix edma0 reg space
>   ARM: DTS: da850: Use the new DT bindings for the eDMA3
>   ARM: DTS: da850: Enable eDMA1
>   ARM: DTS: da850: Enable DMA use for MMC0
>   ARM: DTS: da850: Add node for mmc1
>   ARM: DTS: da850: Enable DMA for SPI1
> 
>  arch/arm/boot/dts/da850-enbw-cmc.dts |  9 ++
>  arch/arm/boot/dts/da850-evm.dts  |  9 ++
>  arch/arm/boot/dts/da850.dtsi | 59 
> 
>  3 files changed, 71 insertions(+), 6 deletions(-)
> 


-- 
Péter
--
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/


linux-next: Tree for Dec 9

2015-12-08 Thread Stephen Rothwell
Hi all,

Changes since 20151208:

The vfs tree lost its build failure but gained another for which I
applied a merge fix patch and yet another for which I applied a fix patch.

The pm tree gained a build failure so I used the version from
next-20151208.

The drm tree gained a conflict against the drm-intel-fixes tree.

The drm-misc tree lost its build failure.

The gpio tree lost its build failure.

Non-merge commits (relative to Linus' tree): 4510
 5192 files changed, 186376 insertions(+), 78620 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig for x86_64, a
multi_v7_defconfig for arm and a native build of tools/perf. After the
final fixups (if any), I do an x86_64 modules_install followed by builds
for powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc,
sparc64 and arm defconfig.

Below is a summary of the state of the merge.

I am currently merging 231 trees (counting Linus' and 36 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

$ git checkout master
$ git reset --hard stable
Merging origin/master (5406812e5976 Merge branch 'for-4.4-fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup)
Merging fixes/master (25cb62b76430 Linux 4.3-rc5)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (6d1a2adef782 ARC: [axs10x] cap ethernet phy to 
100 Mbit/sec)
Merging arm-current/fixes (db0ad024543c ARM: fix uaccess_with_memcpy() with 
SW_DOMAIN_PAN)
Merging m68k-current/for-linus (21d380e54c30 m68k: Wire up mlock2)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-fixes/fixes (7f821fc9c77a powerpc/tm: Check for already 
reclaimed tasks)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (2c302e7e4105 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc)
Merging net/master (bd5eb35f16a9 xfrm: take care of request sockets)
Merging ipsec/master (a8a572a6b5f2 xfrm: dst_entries_init() per-net dst_ops)
Merging ipvs/master (8e662164abb4 netfilter: nfnetlink_queue: avoid harmless 
unnitialized variable warnings)
Merging wireless-drivers/master (eeec5d0ef7ee rtlwifi: rtl8821ae: Fix lockups 
on boot)
Merging mac80211/master (c1df932c0574 mac80211: fix off-channel mgmt-tx 
uninitialized variable usage)
Merging sound-current/for-linus (23adc192b862 ALSA: hda - Fixing speaker noise 
on the two latest thinkpad models)
Merging pci-current/for-linus (99496bd2971f PCI: altera: Fix error when INTx is 
4)
Merging driver-core.current/driver-core-linus (31ade3b83e18 Linux 4.4-rc3)
Merging tty.current/tty-linus (31ade3b83e18 Linux 4.4-rc3)
Merging usb.current/usb-linus (4a0c4c36094c USB: host: ohci-at91: fix a crash 
in ohci_hcd_at91_overcurrent_irq)
Merging usb-gadget-fixes/fixes (62e345ae5b6e usb: dwc3: gadget: don't prestart 
interrupt endpoints)
Merging usb-serial-fixes/usb-linus (a0e80fbd56b4 USB: serial: Another Infineon 
flash loader USB ID)
Merging usb-chipidea-fixes/ci-for-usb-stable (6f51bc340d2a usb: chipidea: imx: 
fix a possible NULL dereference)
Merging staging.current/staging-linus (9225c0b7b976 staging: lustre: 
echo_copy.._lsm() dereferences userland pointers directly)
Merging char-misc.current/char-misc-linus (e8c77bda05e5 fpga manager: Fix 
firmware resource leak on error)
Merging input-current/for-linus (1cf44efa1e4f Input: arizona-haptic - fix 
disabling of haptics device)
Merging crypto-current/master (79960943fdc1 crypto: talitos - Fix timing leak 
in ESP ICV verification)
Merging ide/master (1b1050cdc5cd Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging devicetree-current/devicetree

[PATCH v1] serial: core: support more baud rates when serial console setup

2015-12-08 Thread Jeffy Chen
Currently, when tring to set up a serial console with a higher
baud rate, it would fallback to 921600.

So, add more baud rates to the baud rate array.

Signed-off-by: Jeffy Chen 

---

 drivers/tty/serial/serial_core.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index def5199..7da1b7e 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1898,6 +1898,16 @@ struct baud_rates {
 };
 
 static const struct baud_rates baud_rates[] = {
+#ifndef __sparc__
+   { 400, B400 },
+   { 350, B350 },
+   { 300, B300 },
+   { 250, B250 },
+   { 200, B200 },
+   { 150, B150 },
+   { 1152000, B1152000 },
+   { 100, B100 },
+#endif
{ 921600, B921600 },
{ 460800, B460800 },
{ 230400, B230400 },
-- 
2.1.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 v6 1/5] dt-bindings: iommu: Add binding for mediatek IOMMU

2015-12-08 Thread Yong Wu
also add Mark.

On Tue, 2015-12-08 at 21:33 -0600, Rob Herring wrote:
> On Tue, Dec 08, 2015 at 05:49:09PM +0800, Yong Wu wrote:
> > This patch add mediatek iommu dts binding document.
> > 
> > Signed-off-by: Yong Wu 
> > ---
> >  .../devicetree/bindings/iommu/mediatek,iommu.txt   |  68 +
> >  include/dt-bindings/memory/mt8173-larb-port.h  | 111 
> > +
> 
> This should be iommu rather than memory.

Hi Rob,
   Thanks very much for review.

   From the HW, all the larbs and ports are defined in the SMI.
About the position of the SMI code, We also discussed before in [1].
So I put the header file in /dt-bindings/memory/.

This is a smi larb-port header file, maybe we should move this header
file into this patch:
[2/5] dt-bindings: mediatek: Add smi dts binding

is it ok if we move it into [2/5]?

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-March/000121.html

> 
> Otherwise, it looks okay to me.

Thanks.

> 
> >  2 files changed, 179 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
> >  create mode 100644 include/dt-bindings/memory/mt8173-larb-port.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/


[PATCH] spi-fsl-dspi: Fix CTAR Register access

2015-12-08 Thread Bhuvanchandra DV
DSPI instances in Vybrid have a different amount of chip selects
and CTARs (Clock and transfer Attributes Register). In case of
DSPI1 we only have 2 CTAR registers and 4 CS. In present driver
implementation CTAR offset is derived from CS instance which will
lead to out of bound access if chip select instance is greater than
CTAR register instance, hence use single CTAR0 register for all CS
instances. Since we write the CTAR register anyway before each access,
there is no value in using the additional CTAR registers. Also one
should not program a value in CTAS for a CTAR register that is not
present, hence configure CTAS to use CTAR0.

Signed-off-by: Bhuvanchandra DV 
---
 drivers/spi/spi-fsl-dspi.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 01fa95b..b21c3c0 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -138,7 +138,7 @@ static inline int is_double_byte_mode(struct fsl_dspi *dspi)
 {
unsigned int val;
 
-   regmap_read(dspi->regmap, SPI_CTAR(dspi->cs), );
+   regmap_read(dspi->regmap, SPI_CTAR(0), );
 
return ((val & SPI_FRAME_BITS_MASK) == SPI_FRAME_BITS(8)) ? 0 : 1;
 }
@@ -231,7 +231,7 @@ static int dspi_transfer_write(struct fsl_dspi *dspi)
 */
if (tx_word && (dspi->len == 1)) {
dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM;
-   regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs),
+   regmap_update_bits(dspi->regmap, SPI_CTAR(0),
SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8));
tx_word = 0;
}
@@ -250,7 +250,7 @@ static int dspi_transfer_write(struct fsl_dspi *dspi)
 
dspi_pushr = SPI_PUSHR_TXDATA(d16) |
SPI_PUSHR_PCS(dspi->cs) |
-   SPI_PUSHR_CTAS(dspi->cs) |
+   SPI_PUSHR_CTAS(0) |
SPI_PUSHR_CONT;
 
dspi->len -= 2;
@@ -265,7 +265,7 @@ static int dspi_transfer_write(struct fsl_dspi *dspi)
 
dspi_pushr = SPI_PUSHR_TXDATA(d8) |
SPI_PUSHR_PCS(dspi->cs) |
-   SPI_PUSHR_CTAS(dspi->cs) |
+   SPI_PUSHR_CTAS(0) |
SPI_PUSHR_CONT;
 
dspi->len--;
@@ -365,10 +365,10 @@ static int dspi_transfer_one_message(struct spi_master 
*master,
regmap_update_bits(dspi->regmap, SPI_MCR,
SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF,
SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF);
-   regmap_write(dspi->regmap, SPI_CTAR(dspi->cs),
+   regmap_write(dspi->regmap, SPI_CTAR(0),
dspi->cur_chip->ctar_val);
if (transfer->speed_hz)
-   regmap_write(dspi->regmap, SPI_CTAR(dspi->cs),
+   regmap_write(dspi->regmap, SPI_CTAR(0),
dspi->cur_chip->ctar_val);
 
regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE);
@@ -469,7 +469,7 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id)
 
if (!dspi->len) {
if (dspi->dataflags & TRAN_STATE_WORD_ODD_NUM)
-   regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs),
+   regmap_update_bits(dspi->regmap, SPI_CTAR(0),
SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(16));
 
dspi->waitflags = 1;
-- 
2.6.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 v5] bus: uniphier-system-bus: add UniPhier System Bus driver

2015-12-08 Thread Masahiro Yamada
The UniPhier System Bus is an external bus that connects on-board
devices to the UniPhier SoC.  Each bank (chip select) is dynamically
mapped to the CPU-viewed address base via the bus controller.  The
bus controller must be configured before any access to the bus.

This driver parses the "ranges" property of the System Bus node and
initialized the bus controller.  After the bus becomes ready, devices
below it are populated.

Note:
Each bank can be mapped anywhere in the supported address space;
there is nothing preventing us from assigning bank 0 on 0x4200,
0x4300, or anywhere as long as such region is not used by others.
So, the "ranges" is just one possible software configuration, which
does not seem to fit in device tree because device tree is a hardware
description language.  However, of_translate_address() requires
"ranges" in every bus node between CPUs and device mapped on the CPU
address space.  In other words, "ranges" properties must be statically
defined in device tree.  After some discussion, I decided the dynamic
address reassignment by the driver is too bothersome.  Instead, the
device tree should provide a reasonable translation setup that the OS
can rely on.

Signed-off-by: Masahiro Yamada 
Acked-by: Rob Herring 
Acked-by: Arnd Bergmann 
---

Changes in v5:
  - Fix the conflict in MAINTAINERS

Changes in v4:
  - Simplify uniphier_system_bus_check_overlap() function
by not using the sort library
  - Add some comments to uniphier_system_bus_check_boot_swap()
for clarification
  - Add Arnd's Acked-by

Changes in v3:
  - Minor fix of git-log
  - Add Rob's Acked-by

Changes in v2:
  - Re-design the binding, driver implementation
Switch to a single node, populate children after the bus is setup

 .../bindings/bus/uniphier-system-bus.txt   |  66 +
 MAINTAINERS|   1 +
 drivers/bus/Kconfig|   8 +
 drivers/bus/Makefile   |   1 +
 drivers/bus/uniphier-system-bus.c  | 281 +
 5 files changed, 357 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/bus/uniphier-system-bus.txt
 create mode 100644 drivers/bus/uniphier-system-bus.c

diff --git a/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt 
b/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt
new file mode 100644
index 000..68ef80a
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt
@@ -0,0 +1,66 @@
+UniPhier System Bus
+
+The UniPhier System Bus is an external bus that connects on-board devices to
+the UniPhier SoC.  It is a simple (semi-)parallel bus with address, data, and
+some control signals.  It supports up to 8 banks (chip selects).
+
+Before any access to the bus, the bus controller must be configured; the bus
+controller registers provide the control for the translation from the offset
+within each bank to the CPU-viewed address.  The needed setup includes the base
+address, the size of each bank.  Optionally, some timing parameters can be
+optimized for faster bus access.
+
+Required properties:
+- compatible: should be "socionext,uniphier-system-bus".
+- reg: offset and length of the register set for the bus controller device.
+- #address-cells: should be 2.  The first cell is the bank number (chip 
select).
+  The second cell is the address offset within the bank.
+- #size-cells: should be 1.
+- ranges: should provide a proper address translation from the System Bus to
+  the parent bus.
+
+Note:
+The address region(s) that can be assigned for the System Bus is implementation
+defined.  Some SoCs can use 0x-0x0fff and 0x4000-0x4fff,
+while other SoCs can only use 0x4000-0x4fff.  There might be additional
+limitations depending on SoCs and the boot mode.  The address translation is
+arbitrary as long as the banks are assigned in the supported address space with
+the required alignment and they do not overlap one another.
+For example, it is possible to map:
+  bank 0 to 0x4200-0x43ff, bank 5 to 0x4600-0x46ff
+It is also possible to map:
+  bank 0 to 0x4800-0x49ff, bank 5 to 0x4400-0x44ff
+There is no reason to stick to a particular translation mapping, but the
+"ranges" property should provide a "reasonable" default that is known to work.
+The software should initialize the bus controller according to it.
+
+Example:
+
+   system-bus {
+   compatible = "socionext,uniphier-system-bus";
+   reg = <0x58c0 0x400>;
+   #address-cells = <2>;
+   #size-cells = <1>;
+   ranges = <1 0x 0x4200 0x0200
+ 5 0x 0x4600 0x0100>;
+
+   ethernet@1,01f0 {
+   compatible = "smsc,lan9115";
+   reg = <1 0x01f0 0x1000>;
+   interrupts = <0 48 4>
+   

Re: [V9fs-developer] Hang triggered by udev coldplug, looks like a race

2015-12-08 Thread Al Viro
On Wed, Dec 09, 2015 at 07:23:16AM +0100, Dominique Martinet wrote:
> Andy Lutomirski wrote on Tue, Dec 08, 2015:
> > Trace attached.  I don't see anything wrong, but I also don't know
> > what I'm looking for.
> 
> Actually doesn't look good, not sure if trace could be missing messages
> but it looks like tags get reused...
> 
> Quick and dirty parse script (attached output, it doesn't handle TFLUSH
> but there are none in his message):

There's also not a single RCLUNK in there, which looks like missing packets.
AFAICS, all (apparent) tag reuses caught by your awk script are of that nature.
And all RERROR are plain "no such file" in response to TWALK; all those
TCLUNK in there get no reply whatsoever - neither success nor failure...
--
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: piping core dump to a program escapes container

2015-12-08 Thread Eric W. Biederman
Dongsheng Yang  writes:

> On 12/09/2015 11:29 AM, Eric W. Biederman wrote:
>> Dongsheng Yang  writes:
>>
> [...]
>
>> There has not yet been an obvious namespace in which to stick
>> core_pattern, and even worse exactly how to appropriate launch a process
>> in a container has not been figured out.
>>
>> If those tricky problems can be solved we can have a core_pattern in a
>> container.  What we have now is the best we have been able to figure out
>> so far.
>
> Thanx Eric, but if I want to make docker works rely on this behaviour,
> is that reliable?
>
> I mean, I want to make a docker container to dump the
> core file to a specified path in host by a pipe way. But I am afraid
> this behaviour would be changed later. Any suggestion?

The kernel rules say if there is a behavior someone depends on and that
behavior changes and breaks userspace that is a regression and it is not
allowed.

As developers we try not to create regressions.  But some days it
requires someone testing/using the functional enough to catdch an issue.

That said the real issue you are likely to run into when developing this
as part of docker is that docker doesn't get to own the core pattern.
It doesn't make sense for any one application to, as it is a kernel wide
setting.  To have different app or container specific policies for core
dumping likely requires either solving the problems I mentioned with
containers or in userspace a solution so there can be an
/etc/core_pattern.d/ with different configuration and different scripts
that somehow know how to select which core files they want and dump them
sanely.

Eric
--
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: [V9fs-developer] Hang triggered by udev coldplug, looks like a race

2015-12-08 Thread Dominique Martinet
Dominique Martinet wrote on Wed, Dec 09, 2015:
> Andy Lutomirski wrote on Tue, Dec 08, 2015:
> > Trace attached.  I don't see anything wrong, but I also don't know
> > what I'm looking for.
> 
> Actually doesn't look good, not sure if trace could be missing messages
> but it looks like tags get reused...

talked too fast as usual, it looks like traces are just missing RCLUNKS
so *from what I can see* there's no overlap

-- 
Dominique
--
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/2] ppdev: add support for compat ioctl

2015-12-08 Thread kbuild test robot
Hi Bamvor,

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.4-rc4 next-20151208]

url:
https://github.com/0day-ci/linux/commits/Bamvor-Jian-Zhang/Convert-ppdev-to-y2038-safe/20151209-141616
config: x86_64-randconfig-n0-12091355 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/char/ppdev.c: In function 'pp_compat_ioctl':
>> drivers/char/ppdev.c:677:44: error: implicit declaration of function 
>> 'compat_ptr' [-Werror=implicit-function-declaration]
 return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
   ^
   cc1: some warnings being treated as errors

vim +/compat_ptr +677 drivers/char/ppdev.c

   671  }
   672  
   673  #ifdef CONFIG_COMPAT
   674  static long pp_compat_ioctl(struct file *file, unsigned int cmd,
   675  unsigned long arg)
   676  {
 > 677  return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
   678  }
   679  #endif
   680  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [lkp] [ALSA] 6603249dcd: kmsg.snd_hda_intel#:#:#b.#:failed_to_add_i915_component_master(-#)

2015-12-08 Thread Takashi Iwai
On Wed, 09 Dec 2015 06:35:34 +0100,
kernel test robot wrote:
> 
> FYI, we noticed the below changes on
> 
> https://github.com/0day-ci/linux 
> Takashi-Sakamoto/ALSA-oxfw-refactoring-and-merging-scs1x-module/20151206-122843
> commit 6603249dcdbb6aab0b726bdf372d6f20c0d2d611 ("ALSA: hda - Enable audio 
> component for old Intel PCH devices")
> 
> We found the following new message in kernel log after your commit.
> 
> [9.672121] snd_hda_intel :00:1b.0: failed to add i915 component 
> master (-19)
> 
> Thanks,
> Ying Huang

The error message can be ignored.  In anyway, I already have a fix
patch to avoid this.


thanks,

Takashi
--
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: next-20151208 - CONFIG_SND_HDA_I915

2015-12-08 Thread Takashi Iwai
On Wed, 09 Dec 2015 04:46:38 +0100,
Valdis Kletnieks wrote:
> 
> I'm experiencing a spot of trouble with this commit:
> 
> commit aad730d0704545ad97654bd929b0aba05adb1436
> Author: Takashi Iwai 
> Date:   Mon Dec 2 13:33:57 2013 +0100
> 
> ALSA: hda - Always do delayed probes for HD-audio devices
> 
> That adds some code:
> 
> #ifndef CONFIG_SND_HDA_I915
>   if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
>   dev_err(card->dev, "Haswell must build in 
> CONFIG_SND_HDA_I915\n");
> 
> "Oh, bother" -- Winnie the Pooh
> 
> So I go looking how to fix this, and 'make menuconfig' tells me:
> 
> Symbol: SND_HDA_I915 [=n] 
> x  
>   x Type  : boolean   
> x  
>   x   Defined at sound/hda/Kconfig:8  
> x  
>   x   Depends on: SOUND [=y] && !M68K && !UML && SND [=y] && DRM_I915 [=n] && 
> SND_HDA_CORE [=y]
> 
> And why is DRM_I915=n?
> 
> # lspci | grep NV
> 01:00.0 VGA compatible controller: NVIDIA Corporation GF108GLM [NVS 5200M] 
> (rev a1)
> 
> Because this Dell laptop has NVidia graphics onboard, and no sign of I915
> graphics that needs I915 DRM.

Right, and this is exactly the purpose of this warning.

> I think the infrastructure that you're trying to re-use from DRM_I915 needs
> to be moved to another symbol which can be SELECT/DEPEND by both DRM_I915
> and SND_HSA_I915.

The HD-audio driver does soft-binding with i915, and the check above
was for the case where i915 is *not* included although the audio
driver tries binding.  This check was mostly for Haswell/Broadwell
HDMI/DP.  Now we see this often on linux-next due to the recent change
to allow i915 binding even on old PCHs.

So, the check itself is correct, per se, but it becomes superfluous in
many cases now.  I already addressed this, but forgot to submit /
merge.  The patches will be seen shortly later on alsa-devel ML.


thanks,

Takashi
--
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/


[RFCv6 PATCH 02/10] cpufreq: introduce cpufreq_driver_is_slow

2015-12-08 Thread Steve Muckle
From: Michael Turquette 

Some architectures and platforms perform CPU frequency transitions
through a non-blocking method, while some might block or sleep. Even
when frequency transitions do not block or sleep they may be very slow.
This distinction is important when trying to change frequency from
a non-interruptible context in a scheduler hot path.

Describe this distinction with a cpufreq driver flag,
CPUFREQ_DRIVER_FAST. The default is to not have this flag set,
thus erring on the side of caution.

cpufreq_driver_is_slow() is also introduced in this patch. Setting
the above flag will allow this function to return false.

[smuc...@linaro.org: change flag/API to include drivers that are too
 slow for scheduler hot paths, in addition to those that block/sleep]

Cc: Rafael J. Wysocki 
Cc: Viresh Kumar 
Signed-off-by: Michael Turquette 
Signed-off-by: Steve Muckle 
---
 drivers/cpufreq/cpufreq.c | 6 ++
 include/linux/cpufreq.h   | 9 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7c48e73..8482820 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -154,6 +154,12 @@ bool have_governor_per_policy(void)
 }
 EXPORT_SYMBOL_GPL(have_governor_per_policy);
 
+bool cpufreq_driver_is_slow(void)
+{
+   return !(cpufreq_driver->flags & CPUFREQ_DRIVER_FAST);
+}
+EXPORT_SYMBOL_GPL(cpufreq_driver_is_slow);
+
 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)
 {
if (have_governor_per_policy())
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ef4c5b1..7f8c63d 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -159,6 +159,7 @@ u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int 
io_busy);
 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
 int cpufreq_update_policy(unsigned int cpu);
 bool have_governor_per_policy(void);
+bool cpufreq_driver_is_slow(void);
 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
 #else
 static inline unsigned int cpufreq_get(unsigned int cpu)
@@ -316,6 +317,14 @@ struct cpufreq_driver {
  */
 #define CPUFREQ_NEED_INITIAL_FREQ_CHECK(1 << 5)
 
+/*
+ * Indicates that it is safe to call cpufreq_driver_target from
+ * non-interruptable context in scheduler hot paths.  Drivers must
+ * opt-in to this flag, as the safe default is that they might sleep
+ * or be too slow for hot path use.
+ */
+#define CPUFREQ_DRIVER_FAST(1 << 6)
+
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
 
-- 
2.4.10

--
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/


[RFCv6 PATCH 09/10] sched: deadline: use deadline bandwidth in scale_rt_capacity

2015-12-08 Thread Steve Muckle
From: Vincent Guittot 

Instead of monitoring the exec time of deadline tasks to evaluate the
CPU capacity consumed by deadline scheduler class, we can directly
calculate it thanks to the sum of utilization of deadline tasks on the
CPU.  We can remove deadline tasks from rt_avg metric and directly use
the average bandwidth of deadline scheduler in scale_rt_capacity.

Based in part on a similar patch from Luca Abeni .

Signed-off-by: Vincent Guittot 
Signed-off-by: Steve Muckle 
---
 kernel/sched/deadline.c | 33 +++--
 kernel/sched/fair.c |  8 
 kernel/sched/sched.h|  2 ++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 8b0a15e..9d9eb50 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -43,6 +43,24 @@ static inline int on_dl_rq(struct sched_dl_entity *dl_se)
return !RB_EMPTY_NODE(_se->rb_node);
 }
 
+static void add_average_bw(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
+{
+   u64 se_bw = dl_se->dl_bw;
+
+   dl_rq->avg_bw += se_bw;
+}
+
+static void clear_average_bw(struct sched_dl_entity *dl_se, struct dl_rq 
*dl_rq)
+{
+   u64 se_bw = dl_se->dl_bw;
+
+   dl_rq->avg_bw -= se_bw;
+   if (dl_rq->avg_bw < 0) {
+   WARN_ON(1);
+   dl_rq->avg_bw = 0;
+   }
+}
+
 static inline int is_leftmost(struct task_struct *p, struct dl_rq *dl_rq)
 {
struct sched_dl_entity *dl_se = >dl;
@@ -494,6 +512,9 @@ static void update_dl_entity(struct sched_dl_entity *dl_se,
struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
struct rq *rq = rq_of_dl_rq(dl_rq);
 
+   if (dl_se->dl_new)
+   add_average_bw(dl_se, dl_rq);
+
/*
 * The arrival of a new instance needs special treatment, i.e.,
 * the actual scheduling parameters have to be "renewed".
@@ -741,8 +762,6 @@ static void update_curr_dl(struct rq *rq)
curr->se.exec_start = rq_clock_task(rq);
cpuacct_charge(curr, delta_exec);
 
-   sched_rt_avg_update(rq, delta_exec);
-
dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
if (dl_runtime_exceeded(dl_se)) {
dl_se->dl_throttled = 1;
@@ -1241,6 +1260,8 @@ static void task_fork_dl(struct task_struct *p)
 static void task_dead_dl(struct task_struct *p)
 {
struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
+   struct dl_rq *dl_rq = dl_rq_of_se(>dl);
+   struct rq *rq = rq_of_dl_rq(dl_rq);
 
/*
 * Since we are TASK_DEAD we won't slip out of the domain!
@@ -1249,6 +1270,8 @@ static void task_dead_dl(struct task_struct *p)
/* XXX we should retain the bw until 0-lag */
dl_b->total_bw -= p->dl.dl_bw;
raw_spin_unlock_irq(_b->lock);
+
+   clear_average_bw(>dl, >dl);
 }
 
 static void set_curr_task_dl(struct rq *rq)
@@ -1556,7 +1579,9 @@ retry:
}
 
deactivate_task(rq, next_task, 0);
+   clear_average_bw(_task->dl, >dl);
set_task_cpu(next_task, later_rq->cpu);
+   add_average_bw(_task->dl, _rq->dl);
activate_task(later_rq, next_task, 0);
ret = 1;
 
@@ -1644,7 +1669,9 @@ static void pull_dl_task(struct rq *this_rq)
resched = true;
 
deactivate_task(src_rq, p, 0);
+   clear_average_bw(>dl, _rq->dl);
set_task_cpu(p, this_cpu);
+   add_average_bw(>dl, _rq->dl);
activate_task(this_rq, p, 0);
dmin = p->dl.deadline;
 
@@ -1750,6 +1777,8 @@ static void switched_from_dl(struct rq *rq, struct 
task_struct *p)
if (!start_dl_timer(p))
__dl_clear_params(p);
 
+   clear_average_bw(>dl, >dl);
+
/*
 * Since this might be the only -deadline task on the rq,
 * this is the right place to try to pull some other one
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4c49f76..ce05f61 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6203,6 +6203,14 @@ static unsigned long scale_rt_capacity(int cpu)
 
used = div_u64(avg, total);
 
+   /*
+* deadline bandwidth is defined at system level so we must
+* weight this bandwidth with the max capacity of the system.
+* As a reminder, avg_bw is 20bits width and
+* scale_cpu_capacity is 10 bits width
+*/
+   used += div_u64(rq->dl.avg_bw, arch_scale_cpu_capacity(NULL, cpu));
+
if (likely(used < SCHED_CAPACITY_SCALE))
return SCHED_CAPACITY_SCALE - used;
 
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 08858d1..e44c6be 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -519,6 +519,8 @@ struct dl_rq {
 #else
struct dl_bw dl_bw;
 #endif
+   /* This is the "average utilization" for this runqueue */
+   s64 avg_bw;
 };
 
 #ifdef CONFIG_SMP
-- 
2.4.10

--
To unsubscribe from this 

Re: [V9fs-developer] Hang triggered by udev coldplug, looks like a race

2015-12-08 Thread Dominique Martinet
Andy Lutomirski wrote on Tue, Dec 08, 2015:
> Trace attached.  I don't see anything wrong, but I also don't know
> what I'm looking for.

Actually doesn't look good, not sure if trace could be missing messages
but it looks like tags get reused...

Quick and dirty parse script (attached output, it doesn't handle TFLUSH
but there are none in his message):

awk '{print NR " " $0}' 9ptrace.txt | \
awk '/^[0-9]* T/ {
if ($5 in tag) {
print "DOUBLETAG " $0 " || had " tag[$5];
} else {
tag[$5] = $0;
}
}
/^[0-9]* R/ {
if (! $5 in tag ) {
print "MISSTAG " $0;
} else {
delete tag[$5];
}
}'


-- 
Dominique Martinet


9pdoubles.xz
Description: Binary data


[RFCv6 PATCH 04/10] sched/fair: add triggers for OPP change requests

2015-12-08 Thread Steve Muckle
From: Juri Lelli 

Each time a task is {en,de}queued we might need to adapt the current
frequency to the new usage. Add triggers on {en,de}queue_task_fair() for
this purpose.  Only trigger a freq request if we are effectively waking up
or going to sleep.  Filter out load balancing related calls to reduce the
number of triggers.

[smuc...@linaro.org: resolve merge conflicts, define task_new,
 use renamed static key sched_freq]

cc: Ingo Molnar 
cc: Peter Zijlstra 
Signed-off-by: Juri Lelli 
Signed-off-by: Steve Muckle 
---
 kernel/sched/fair.c | 49 +++--
 1 file changed, 47 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 95b83c4..904188a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4199,6 +4199,21 @@ static inline void hrtick_update(struct rq *rq)
 }
 #endif
 
+static unsigned long capacity_orig_of(int cpu);
+static int cpu_util(int cpu);
+
+static void update_capacity_of(int cpu)
+{
+   unsigned long req_cap;
+
+   if (!sched_freq())
+   return;
+
+   /* Convert scale-invariant capacity to cpu. */
+   req_cap = cpu_util(cpu) * SCHED_CAPACITY_SCALE / capacity_orig_of(cpu);
+   set_cfs_cpu_capacity(cpu, true, req_cap);
+}
+
 /*
  * The enqueue_task method is called before nr_running is
  * increased. Here we update the fair scheduling stats and
@@ -4209,6 +4224,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, 
int flags)
 {
struct cfs_rq *cfs_rq;
struct sched_entity *se = >se;
+   int task_new = !(flags & ENQUEUE_WAKEUP);
 
for_each_sched_entity(se) {
if (se->on_rq)
@@ -4240,9 +4256,23 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, 
int flags)
update_cfs_shares(cfs_rq);
}
 
-   if (!se)
+   if (!se) {
add_nr_running(rq, 1);
 
+   /*
+* We want to potentially trigger a freq switch
+* request only for tasks that are waking up; this is
+* because we get here also during load balancing, but
+* in these cases it seems wise to trigger as single
+* request after load balancing is done.
+*
+* XXX: how about fork()? Do we need a special
+*  flag/something to tell if we are here after a
+*  fork() (wakeup_task_new)?
+*/
+   if (!task_new)
+   update_capacity_of(cpu_of(rq));
+   }
hrtick_update(rq);
 }
 
@@ -4300,9 +4330,24 @@ static void dequeue_task_fair(struct rq *rq, struct 
task_struct *p, int flags)
update_cfs_shares(cfs_rq);
}
 
-   if (!se)
+   if (!se) {
sub_nr_running(rq, 1);
 
+   /*
+* We want to potentially trigger a freq switch
+* request only for tasks that are going to sleep;
+* this is because we get here also during load
+* balancing, but in these cases it seems wise to
+* trigger as single request after load balancing is
+* done.
+*/
+   if (task_sleep) {
+   if (rq->cfs.nr_running)
+   update_capacity_of(cpu_of(rq));
+   else if (sched_freq())
+   set_cfs_cpu_capacity(cpu_of(rq), false, 0);
+   }
+   }
hrtick_update(rq);
 }
 
-- 
2.4.10

--
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/


[RFCv6 PATCH 01/10] sched: Compute cpu capacity available at current frequency

2015-12-08 Thread Steve Muckle
From: Morten Rasmussen 

capacity_orig_of() returns the max available compute capacity of a cpu.
For scale-invariant utilization tracking and energy-aware scheduling
decisions it is useful to know the compute capacity available at the
current OPP of a cpu.

cc: Ingo Molnar 
cc: Peter Zijlstra 
Signed-off-by: Morten Rasmussen 
Signed-off-by: Steve Muckle 
---
 kernel/sched/fair.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1093873..95b83c4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4737,6 +4737,17 @@ static long effective_load(struct task_group *tg, int 
cpu, long wl, long wg)
 #endif
 
 /*
+ * Returns the current capacity of cpu after applying both
+ * cpu and freq scaling.
+ */
+static unsigned long capacity_curr_of(int cpu)
+{
+   return cpu_rq(cpu)->cpu_capacity_orig *
+  arch_scale_freq_capacity(NULL, cpu)
+  >> SCHED_CAPACITY_SHIFT;
+}
+
+/*
  * Detect M:N waker/wakee relationships via a switching-frequency heuristic.
  * A waker of many should wake a different task than the one last awakened
  * at a frequency roughly N times higher than one of its wakees.  In order
-- 
2.4.10

--
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 v10.2 14/17] drm: bridge: analogix/dp: try force hpd after plug in lookup failed

2015-12-08 Thread Yakir Yang
Some edp screen do not have hpd signal, so we can't just return
failed when hpd plug in detect failed.

This is an hardware property, so we need add a devicetree property
"force-hpd" to indicate this sutiation.

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
Tested-by: Javier Martinez Canillas 
---
Changes in v10.2:
- Add the ack from Rob Herring
- Fix the omissive "analogix,need-force-hpd" in Exynos DP document

Changes in v10.1:
- Rename the "analogix,need-force-hpd" to common 'force-hpd' (Rob)

Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add "analogix,need-force-hpd" to indicate whether driver need foce
  hpd when hpd detect failed.

Changes in v2: None

 .../bindings/display/bridge/analogix_dp.txt|  4 ++-
 .../bindings/display/exynos/exynos_dp.txt  |  1 +
 .../display/rockchip/analogix_dp-rockchip.txt  |  1 +
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 35 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  2 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  |  9 ++
 6 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt 
b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
index 7659a7a..4f2ba8c 100644
--- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
+++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
@@ -22,6 +22,9 @@ Required properties for dp-controller:
from general PHY binding: Should be "dp".
 
 Optional properties for dp-controller:
+   -force-hpd:
+   Indicate driver need force hpd when hpd detect failed, this
+   is used for some eDP screen which don't have hpd signal.
-hpd-gpios:
Hotplug detect GPIO.
Indicates which GPIO should be used for hotplug detection
@@ -31,7 +34,6 @@ Optional properties for dp-controller:
* Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
* 
Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
 
-
 [1]: Documentation/devicetree/bindings/media/video-interfaces.txt
 ---
 
diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt 
b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
index 9905081..8800164 100644
--- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
@@ -41,6 +41,7 @@ For the below properties, please refer to Analogix DP binding 
document:
-phys (required)
-phy-names (required)
-hpd-gpios (optional)
+   -force-hpd (optional)
-video interfaces (optional)
 
 Deprecated properties for DisplayPort:
diff --git 
a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
index dae86c4..187a708e 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
@@ -32,6 +32,7 @@ For the below properties, please refer to Analogix DP binding 
document:
 - phys (required)
 - phy-names (required)
 - hpd-gpios (optional)
+- force-hpd (optional)
 ---
 
 Example:
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index a11504b..00aee44 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -59,15 +59,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device 
*dp)
 {
int timeout_loop = 0;
 
-   while (analogix_dp_get_plug_in_status(dp) != 0) {
+   while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) {
+   if (analogix_dp_get_plug_in_status(dp) == 0)
+   return 0;
+
timeout_loop++;
-   if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
-   dev_err(dp->dev, "failed to get hpd plug status\n");
-   return -ETIMEDOUT;
-   }
usleep_range(10, 11);
}
 
+   /*
+* Some edp screen do not have hpd signal, so we can't just
+* return failed when hpd plug in detect failed, DT property
+* "need-force-hpd" would indicate whether driver need this.
+*/
+   if (!dp->force_hpd)
+   return -ETIMEDOUT;
+
+   /*
+* The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH
+* will not work, so we need to give a force hpd action to
+* set HPD_STATUS manually.
+*/
+   dev_dbg(dp->dev, "failed to get hpd plug 

[RFCv6 PATCH 10/10] sched: rt scheduler sets capacity requirement

2015-12-08 Thread Steve Muckle
From: Vincent Guittot 

RT tasks don't provide any running constraints like deadline ones
except their running priority. The only current usable input to
estimate the capacity needed by RT tasks is the rt_avg metric. We use
it to estimate the CPU capacity needed for the RT scheduler class.

In order to monitor the evolution for RT task load, we must
peridiocally check it during the tick.

Then, we use the estimated capacity of the last activity to estimate
the next one which can not be that accurate but is a good starting
point without any impact on the wake up path of RT tasks.

Signed-off-by: Vincent Guittot 
Signed-off-by: Steve Muckle 
---
 kernel/sched/rt.c | 49 -
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 8ec86ab..9694204 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1426,6 +1426,41 @@ static void check_preempt_curr_rt(struct rq *rq, struct 
task_struct *p, int flag
 #endif
 }
 
+#ifdef CONFIG_SMP
+static void sched_rt_update_capacity_req(struct rq *rq)
+{
+   u64 total, used, age_stamp, avg;
+   s64 delta;
+
+   if (!sched_freq())
+   return;
+
+   sched_avg_update(rq);
+   /*
+* Since we're reading these variables without serialization make sure
+* we read them once before doing sanity checks on them.
+*/
+   age_stamp = READ_ONCE(rq->age_stamp);
+   avg = READ_ONCE(rq->rt_avg);
+   delta = rq_clock(rq) - age_stamp;
+
+   if (unlikely(delta < 0))
+   delta = 0;
+
+   total = sched_avg_period() + delta;
+
+   used = div_u64(avg, total);
+   if (unlikely(used > SCHED_CAPACITY_SCALE))
+   used = SCHED_CAPACITY_SCALE;
+
+   set_rt_cpu_capacity(rq->cpu, 1, (unsigned long)(used));
+}
+#else
+static inline void sched_rt_update_capacity_req(struct rq *rq)
+{ }
+
+#endif
+
 static struct sched_rt_entity *pick_next_rt_entity(struct rq *rq,
   struct rt_rq *rt_rq)
 {
@@ -1494,8 +1529,17 @@ pick_next_task_rt(struct rq *rq, struct task_struct 
*prev)
if (prev->sched_class == _sched_class)
update_curr_rt(rq);
 
-   if (!rt_rq->rt_queued)
+   if (!rt_rq->rt_queued) {
+   /*
+* The next task to be picked on this rq will have a lower
+* priority than rt tasks so we can spend some time to update
+* the capacity used by rt tasks based on the last activity.
+* This value will be the used as an estimation of the next
+* activity.
+*/
+   sched_rt_update_capacity_req(rq);
return NULL;
+   }
 
put_prev_task(rq, prev);
 
@@ -2212,6 +2256,9 @@ static void task_tick_rt(struct rq *rq, struct 
task_struct *p, int queued)
 
update_curr_rt(rq);
 
+   if (rq->rt.rt_nr_running)
+   sched_rt_update_capacity_req(rq);
+
watchdog(rq, p);
 
/*
-- 
2.4.10

--
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/


[RFCv6 PATCH 05/10] sched/{core,fair}: trigger OPP change request on fork()

2015-12-08 Thread Steve Muckle
From: Juri Lelli 

Patch "sched/fair: add triggers for OPP change requests" introduced OPP
change triggers for enqueue_task_fair(), but the trigger was operating only
for wakeups. Fact is that it makes sense to consider wakeup_new also (i.e.,
fork()), as we don't know anything about a newly created task and thus we
most certainly want to jump to max OPP to not harm performance too much.

However, it is not currently possible (or at least it wasn't evident to me
how to do so :/) to tell new wakeups from other (non wakeup) operations.

This patch introduces an additional flag in sched.h that is only set at
fork() time and it is then consumed in enqueue_task_fair() for our purpose.

cc: Ingo Molnar 
cc: Peter Zijlstra 
Signed-off-by: Juri Lelli 
Signed-off-by: Steve Muckle 
---
 kernel/sched/core.c  | 2 +-
 kernel/sched/fair.c  | 9 +++--
 kernel/sched/sched.h | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index aa3f978..4c8c353e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2402,7 +2402,7 @@ void wake_up_new_task(struct task_struct *p)
 #endif
 
rq = __task_rq_lock(p);
-   activate_task(rq, p, 0);
+   activate_task(rq, p, ENQUEUE_WAKEUP_NEW);
p->on_rq = TASK_ON_RQ_QUEUED;
trace_sched_wakeup_new(p);
check_preempt_curr(rq, p, WF_FORK);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 904188a..1bfbbb7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4224,7 +4224,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, 
int flags)
 {
struct cfs_rq *cfs_rq;
struct sched_entity *se = >se;
-   int task_new = !(flags & ENQUEUE_WAKEUP);
+   int task_new = flags & ENQUEUE_WAKEUP_NEW;
+   int task_wakeup = flags & ENQUEUE_WAKEUP;
 
for_each_sched_entity(se) {
if (se->on_rq)
@@ -4265,12 +4266,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, 
int flags)
 * because we get here also during load balancing, but
 * in these cases it seems wise to trigger as single
 * request after load balancing is done.
-*
-* XXX: how about fork()? Do we need a special
-*  flag/something to tell if we are here after a
-*  fork() (wakeup_task_new)?
 */
-   if (!task_new)
+   if (task_new || task_wakeup)
update_capacity_of(cpu_of(rq));
}
hrtick_update(rq);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index a88dbec..ad82274 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1139,6 +1139,7 @@ extern const u32 sched_prio_to_wmult[40];
 #endif
 #define ENQUEUE_REPLENISH  0x08
 #define ENQUEUE_RESTORE0x10
+#define ENQUEUE_WAKEUP_NEW 0x20
 
 #define DEQUEUE_SLEEP  0x01
 #define DEQUEUE_SAVE   0x02
-- 
2.4.10

--
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/


[RFCv6 PATCH 07/10] sched/fair: jump to max OPP when crossing UP threshold

2015-12-08 Thread Steve Muckle
Since the true utilization of a long running task is not detectable
while it is running and might be bigger than the current cpu capacity,
create the maximum cpu capacity head room by requesting the maximum
cpu capacity once the cpu usage plus the capacity margin exceeds the
current capacity. This is also done to try to harm the performance of
a task the least.

Original fair-class only version authored by Juri Lelli
.

cc: Ingo Molnar 
cc: Peter Zijlstra 
Signed-off-by: Juri Lelli 
Signed-off-by: Steve Muckle 
---
 kernel/sched/core.c  | 41 
 kernel/sched/fair.c  | 57 --
 kernel/sched/sched.h | 59 
 3 files changed, 100 insertions(+), 57 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4c8c353e..3f4d907 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2869,6 +2869,45 @@ unsigned long long task_sched_runtime(struct task_struct 
*p)
return ns;
 }
 
+#ifdef CONFIG_CPU_FREQ_GOV_SCHED
+static unsigned long sum_capacity_reqs(unsigned long cfs_cap,
+  struct sched_capacity_reqs *scr)
+{
+   unsigned long total = cfs_cap + scr->rt;
+
+   total = total * capacity_margin;
+   total /= SCHED_CAPACITY_SCALE;
+   total += scr->dl;
+   return total;
+}
+
+static void sched_freq_tick(int cpu)
+{
+   struct sched_capacity_reqs *scr;
+   unsigned long capacity_orig, capacity_curr;
+
+   if (!sched_freq())
+   return;
+
+   capacity_orig = capacity_orig_of(cpu);
+   capacity_curr = capacity_curr_of(cpu);
+   if (capacity_curr == capacity_orig)
+   return;
+
+   /*
+* To make free room for a task that is building up its "real"
+* utilization and to harm its performance the least, request
+* a jump to max OPP as soon as the margin of free capacity is
+* impacted (specified by capacity_margin).
+*/
+   scr = _cpu(cpu_sched_capacity_reqs, cpu);
+   if (capacity_curr < sum_capacity_reqs(cpu_util(cpu), scr))
+   set_cfs_cpu_capacity(cpu, true, capacity_max);
+}
+#else
+static inline void sched_freq_tick(int cpu) { }
+#endif
+
 /*
  * This function gets called by the timer code, with HZ frequency.
  * We call it with interrupts disabled.
@@ -2895,6 +2934,8 @@ void scheduler_tick(void)
trigger_load_balance(rq);
 #endif
rq_last_tick_reset(rq);
+
+   sched_freq_tick(cpu);
 }
 
 #ifdef CONFIG_NO_HZ_FULL
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 880ceee..4c49f76 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4199,9 +4199,6 @@ static inline void hrtick_update(struct rq *rq)
 }
 #endif
 
-static unsigned long capacity_orig_of(int cpu);
-static int cpu_util(int cpu);
-
 static void update_capacity_of(int cpu)
 {
unsigned long req_cap;
@@ -4601,15 +4598,6 @@ static unsigned long target_load(int cpu, int type)
return max(rq->cpu_load[type-1], total);
 }
 
-static unsigned long capacity_of(int cpu)
-{
-   return cpu_rq(cpu)->cpu_capacity;
-}
-
-static unsigned long capacity_orig_of(int cpu)
-{
-   return cpu_rq(cpu)->cpu_capacity_orig;
-}
 
 static unsigned long cpu_avg_load_per_task(int cpu)
 {
@@ -4779,17 +4767,6 @@ static long effective_load(struct task_group *tg, int 
cpu, long wl, long wg)
 #endif
 
 /*
- * Returns the current capacity of cpu after applying both
- * cpu and freq scaling.
- */
-static unsigned long capacity_curr_of(int cpu)
-{
-   return cpu_rq(cpu)->cpu_capacity_orig *
-  arch_scale_freq_capacity(NULL, cpu)
-  >> SCHED_CAPACITY_SHIFT;
-}
-
-/*
  * Detect M:N waker/wakee relationships via a switching-frequency heuristic.
  * A waker of many should wake a different task than the one last awakened
  * at a frequency roughly N times higher than one of its wakees.  In order
@@ -5033,40 +5010,6 @@ done:
 }
 
 /*
- * cpu_util returns the amount of capacity of a CPU that is used by CFS
- * tasks. The unit of the return value must be the one of capacity so we can
- * compare the utilization with the capacity of the CPU that is available for
- * CFS task (ie cpu_capacity).
- *
- * cfs_rq.avg.util_avg is the sum of running time of runnable tasks plus the
- * recent utilization of currently non-runnable tasks on a CPU. It represents
- * the amount of utilization of a CPU in the range [0..capacity_orig] where
- * capacity_orig is the cpu_capacity available at the highest frequency
- * (arch_scale_freq_capacity()).
- * The utilization of a CPU converges towards a sum equal to or less than the
- * current capacity (capacity_curr <= capacity_orig) of the CPU because it is
- * the running time on this CPU scaled by capacity_curr.
- *
- * Nevertheless, cfs_rq.avg.util_avg can be higher than capacity_curr or even
- * higher than capacity_orig because of unfortunate rounding in
- * 

Re: [PATCH 07/12] x86/entry/64: Always run ptregs-using syscalls on the slow path

2015-12-08 Thread Andy Lutomirski
On Tue, Dec 8, 2015 at 9:45 PM, Andy Lutomirski  wrote:
> On Tue, Dec 8, 2015 at 8:43 PM, Brian Gerst  wrote:
>> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski  wrote:
>>> 64-bit syscalls currently have an optimization in which they are
>>> called with partial pt_regs.  A small handful require full pt_regs.
>>>
>>> In the 32-bit and compat cases, I cleaned this up by forcing full
>>> pt_regs for all syscalls.  The performance hit doesn't really matter.
>>>
>>> I want to clean up the 64-bit case as well, but I don't want to hurt
>>> fast path performance.  To do that, I want to force the syscalls
>>> that use pt_regs onto the slow path.  This will enable us to make
>>> slow path syscalls be real ABI-compliant C functions.
>>>
>>> Use the new syscall entry qualification machinery for this.
>>> stub_clone is now stub_clone/ptregs.
>>>
>>> The next patch will eliminate the stubs, and we'll just have
>>> sys_clone/ptregs.
>>>
>>> Signed-off-by: Andy Lutomirski 
>>
>> Fails to boot, bisected to this patch:
>> [   32.675319] kernel BUG at kernel/auditsc.c:1504!
>> [   32.675325] invalid opcode:  [#65] SMP
>> [   32.675328] Modules linked in:
>> [   32.675333] CPU: 1 PID: 216 Comm: systemd-cgroups Tainted: G  D
>> 4.3.0-rc4+ #7
>> [   32.675336] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
>> [   32.675339] task: 88075340 ti: 88003652 task.ti:
>> 88003652
>> [   32.675350] RIP: 0010:[]  []
>> __audit_syscall_entry+0xcd/0xf0
>> [   32.675353] RSP: 0018:880036523ef0  EFLAGS: 00010202
>> [   32.675355] RAX: 000c RBX: 8800797b3000 RCX: 
>> 7ffef8504e88
>> [   32.675357] RDX: 56172f37cfd0 RSI:  RDI: 
>> 000c
>> [   32.675359] RBP: 880036523f00 R08: 0001 R09: 
>> 88075340
>> [   32.675361] R10:  R11: 0001 R12: 
>> 
>> [   32.675363] R13: c03e R14: 0001 R15: 
>> 1000
>> [   32.675380] FS:  7f02b4ff48c0() GS:88007fc8()
>> knlGS:
>> [   32.675383] CS:  0010 DS:  ES:  CR0: 8005003b
>> [   32.675385] CR2: 7f93d47ea0e0 CR3: 36aa9000 CR4: 
>> 06e0
>> [   32.675391] Stack:
>> [   32.675396]  880036523f58  880036523f10
>> 8100321b
>> [   32.675401]  880036523f48 81003ad0 56172f374040
>> 7f93d45c9990
>> [   32.675404]  0001 0001 1000
>> 000a
>> [   32.675405] Call Trace:
>> [   32.675414]  [] do_audit_syscall_entry+0x4b/0x70
>> [   32.675420]  [] syscall_trace_enter_phase2+0x110/0x1d0
>> [   32.675425]  [] tracesys+0x3a/0x96
>> [   32.675464] Code: 00 00 00 00 e8 a5 e0 fc ff c7 43 04 01 00 00 00
>> 48 89 43 18 48 89 53 20 44 89 63 0c c7 83 94 02 00 00 00 00 00 00 5b
>> 41 5c 5d c3 <0f> 0b 48 c7 43 50 00 00 00 00 48 c7 c2 60 b4 c5 81 48 89
>> de 4c
>> [   32.675469] RIP  [] __audit_syscall_entry+0xcd/0xf0
>> [   32.675471]  RSP 
>
> I'm not reproducing this, even with audit manually enabled.  Can you
> send a .config?

Never mind, I found the bug by inspection.  I'll send a fixed up
series tomorrow.

Can you send the boot failure you got with the full series applied,
though?  I think that the bug I found is only triggerable part-way
through the series -- I think I inadvertently fixed it later on.

--Andy
--
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/


[RFCv6 PATCH 08/10] sched: remove call of sched_avg_update from sched_rt_avg_update

2015-12-08 Thread Steve Muckle
From: Vincent Guittot 

rt_avg is only used to scale the available CPU's capacity for CFS
tasks.  As the update of this scaling is done during periodic load
balance, we only have to ensure that sched_avg_update has been called
before any periodic load balancing. This requirement is already
fulfilled by __update_cpu_load so the call in sched_rt_avg_update,
which is part of the hotpath, is useless.

Signed-off-by: Vincent Guittot 
Signed-off-by: Steve Muckle 
---
 kernel/sched/sched.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 90d5df6..08858d1 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1497,7 +1497,6 @@ static inline void set_dl_cpu_capacity(int cpu, bool 
request,
 static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta)
 {
rq->rt_avg += rt_delta * arch_scale_freq_capacity(NULL, cpu_of(rq));
-   sched_avg_update(rq);
 }
 #else
 static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) { }
-- 
2.4.10

--
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/


[RFCv6 PATCH 06/10] sched/fair: cpufreq_sched triggers for load balancing

2015-12-08 Thread Steve Muckle
From: Juri Lelli 

As we don't trigger freq changes from {en,de}queue_task_fair() during load
balancing, we need to do explicitly so on load balancing paths.

[smuc...@linaro.org: move update_capacity_of calls so rq lock is held]

cc: Ingo Molnar 
cc: Peter Zijlstra 
Signed-off-by: Juri Lelli 
Signed-off-by: Steve Muckle 
---
 kernel/sched/fair.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1bfbbb7..880ceee 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6023,6 +6023,10 @@ static void attach_one_task(struct rq *rq, struct 
task_struct *p)
 {
raw_spin_lock(>lock);
attach_task(rq, p);
+   /*
+* We want to potentially raise target_cpu's OPP.
+*/
+   update_capacity_of(cpu_of(rq));
raw_spin_unlock(>lock);
 }
 
@@ -6044,6 +6048,11 @@ static void attach_tasks(struct lb_env *env)
attach_task(env->dst_rq, p);
}
 
+   /*
+* We want to potentially raise env.dst_cpu's OPP.
+*/
+   update_capacity_of(env->dst_cpu);
+
raw_spin_unlock(>dst_rq->lock);
 }
 
@@ -7183,6 +7192,11 @@ more_balance:
 * ld_moved - cumulative load moved across iterations
 */
cur_ld_moved = detach_tasks();
+   /*
+* We want to potentially lower env.src_cpu's OPP.
+*/
+   if (cur_ld_moved)
+   update_capacity_of(env.src_cpu);
 
/*
 * We've detached some tasks from busiest_rq. Every
@@ -7547,8 +7561,13 @@ static int active_load_balance_cpu_stop(void *data)
schedstat_inc(sd, alb_count);
 
p = detach_one_task();
-   if (p)
+   if (p) {
schedstat_inc(sd, alb_pushed);
+   /*
+* We want to potentially lower env.src_cpu's OPP.
+*/
+   update_capacity_of(env.src_cpu);
+   }
else
schedstat_inc(sd, alb_failed);
}
-- 
2.4.10

--
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/


[RFCv6 PATCH 00/10] sched: scheduler-driven CPU frequency selection

2015-12-08 Thread Steve Muckle
Scheduler-driven CPU frequency selection hopes to exploit both
per-task and global information in the scheduler to improve frequency
selection policy and achieve lower power consumption, improved
responsiveness/performance, and less reliance on heuristics and
tunables. For further discussion of this integration see [0].

This patch series implements a cpufreq governor which collects CPU
capacity requests from the fair, realtime, and deadline scheduling
classes. The fair and realtime scheduling classes are modified to make
these requests. The deadline class is not yet modified to make CPU
capacity requests.

The last RFC posting of this was RFCv5 [1] as part of a larger posting
including energy-aware scheduling. Scheduler-driven CPU frequency
scaling is contained in patches 37-46 of [1]. Changes in this series
since RFCv5:

 - the API to request CPU capacity changes is extended beyond the fair
   scheduling class to the realtime and deadline classes
 - the realtime class is modified to make CPU capacity requests
 - recalculated capacity is converted to a supported target frequency
   to test if a frequency change is actually required
 - allow any CPU to change the frequency domain capacity, not just a
   CPU that is driving the maximum capacity in the frequency domain 
 - cpufreq_driver_might_sleep has been changed to cpufreq_driver_is_slow,
   since it is possible a driver may not sleep but still be too slow to
   be called in scheduler hot paths
 - capacity requests which occur while throttled are no longer lost
 - cleanups based on RFCv5 lkml feedback
 - initialization, static key management fixes

Profiling results:
Performance profiling has been done by using rt-app [2] to generate
various periodic workloads with a particular duty cycle. The time to
complete the busy portion of the duty cycle is measured and overhead
is calculated as

overhead = (busy_duration_test_gov - busy_duration_perf_gov)/
 (busy_duration_pwrsave_gov - busy_duration_perf_gov)

This shows as a percentage how close the governor is to running the
workload at fmin (100%) or fmax (0%). The number of times the busy
duration exceeds the period of the periodic workload (an "overrun") is
also recorded. In the table below the performance of the ondemand
(sampling_rate = 20ms), interactive (default tunables), and
scheduler-driven governors are evaluated using these metrics. The test
platform is a Samsung Chromebook 2 ("Peach Pi"). The workload is
affined to CPU0, an A15 with an fmin of 200MHz and an fmax of
2GHz. The interactive governor was incorporated/adapted from [3]. A
branch with the interactive governor and a few required dependency
patches for ARM is available at [4].

More detailed explanation of the columns below:
run: duration at fmax of the busy portion of the periodic workload in msec
period: duration of the entire period of the periodic workload in msec
loops: number of iterations of the periodic workload tested
OR: number of instances of overrun as described above
OH: overhead as calculated above

SCHED_OTHER workload:
 wload parameters ondemandinteractive sched 
run period  loops   OR  OH  OR  OH  OR  OH
1   100 100 0   51.83%  0   99.74%  0   99.76%
10  100010  0   24.73%  0   19.41%  0   50.09%
1   10  10000   19.34%  0   62.81%  7   62.85%
10  100 100 0   11.20%  0   15.84%  0   33.48%
100 100010  0   1.62%   0   1.82%   0   6.64%
6   33  300 0   13.73%  0   7.98%   1   33.32%
66  333 30  0   1.87%   0   3.11%   0   12.39%
4   10  10001   6.08%   1   10.92%  3   6.63%
40  100 100 0   0.98%   0   0.06%   1   2.92%
400 100010  0   0.40%   0   0.50%   0   1.26%
5   9   10001   3.38%   2   5.87%   6   3.76%
50  90  100 0   1.78%   0   0.03%   1   1.56%
500 900 10  0   0.32%   0   0.37%   0   1.64%
9   12  10002   1.57%   1   0.16%   3   0.47%
90  120 100 0   1.25%   0   0.02%   1   0.45%
900 120010  0   0.19%   0   0.24%   0   0.87%

SCHED_FIFO workload:
 wload parameters ondemandinteractive sched 
run period  loops   OR  OH  OR  OH  OR  OH
1   100 100 0   65.10%  0   99.84%  0   100.00%
10  100010  0   96.01%  0   21.08%  0   87.88%
1   10  10000   14.11%  0   61.98%  0   62.53%
10  100 100 34  49.89%  0   14.28%  0   68.58%
100 100010  1   46.29%  0   1.89%   0   23.78%
6   33  300 50  25.36%  0   8.20%   2   33.42%
66  333 30  10  34.97%  0   3.02%   0   27.07%
4   10  10000 

[RFCv6 PATCH 03/10] sched: scheduler-driven cpu frequency selection

2015-12-08 Thread Steve Muckle
From: Michael Turquette 

Scheduler-driven CPU frequency selection hopes to exploit both
per-task and global information in the scheduler to improve frequency
selection policy, achieving lower power consumption, improved
responsiveness/performance, and less reliance on heuristics and
tunables. For further discussion on the motivation of this integration
see [0].

This patch implements a shim layer between the Linux scheduler and the
cpufreq subsystem. The interface accepts capacity requests from the
CFS, RT and deadline sched classes. The requests from each sched class
are summed on each CPU with a margin applied to the CFS and RT
capacity requests to provide some headroom. Deadline requests are
expected to be precise enough given their nature to not require
headroom. The maximum total capacity request for a CPU in a frequency
domain drives the requested frequency for that domain.

Policy is determined by both the sched classes and this shim layer.

Note that this algorithm is event-driven. There is no polling loop to
check cpu idle time nor any other method which is unsynchronized with
the scheduler, aside from a throttling mechanism to ensure frequency
changes are not attempted faster than the hardware can accommodate them.

Thanks to Juri Lelli  for contributing design ideas,
code and test results, and to Ricky Liang 
for initialization and static key inc/dec fixes.

[0] http://article.gmane.org/gmane.linux.kernel/1499836

[smuc...@linaro.org: various additions and fixes, revised commit text]

CC: Ricky Liang 
Signed-off-by: Michael Turquette 
Signed-off-by: Juri Lelli 
Signed-off-by: Steve Muckle 
---
 drivers/cpufreq/Kconfig  |  20 +++
 include/linux/cpufreq.h  |   3 +
 include/linux/sched.h|   8 +
 kernel/sched/Makefile|   1 +
 kernel/sched/cpufreq_sched.c | 364 +++
 kernel/sched/sched.h |  51 ++
 6 files changed, 447 insertions(+)
 create mode 100644 kernel/sched/cpufreq_sched.c

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 659879a..6f2e96c 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -102,6 +102,14 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
  Be aware that not all cpufreq drivers support the conservative
  governor. If unsure have a look at the help section of the
  driver. Fallback governor will be the performance governor.
+
+config CPU_FREQ_DEFAULT_GOV_SCHED
+   bool "sched"
+   select CPU_FREQ_GOV_SCHED
+   help
+ Use the CPUfreq governor 'sched' as default. This scales
+ cpu frequency using CPU utilization estimates from the
+ scheduler.
 endchoice
 
 config CPU_FREQ_GOV_PERFORMANCE
@@ -183,6 +191,18 @@ config CPU_FREQ_GOV_CONSERVATIVE
 
  If in doubt, say N.
 
+config CPU_FREQ_GOV_SCHED
+   bool "'sched' cpufreq governor"
+   depends on CPU_FREQ
+   select CPU_FREQ_GOV_COMMON
+   help
+ 'sched' - this governor scales cpu frequency from the
+ scheduler as a function of cpu capacity utilization. It does
+ not evaluate utilization on a periodic basis (as ondemand
+ does) but instead is event-driven by the scheduler.
+
+ If in doubt, say N.
+
 comment "CPU frequency scaling drivers"
 
 config CPUFREQ_DT
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 7f8c63d..7e4bde1 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -495,6 +495,9 @@ extern struct cpufreq_governor cpufreq_gov_ondemand;
 #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
 extern struct cpufreq_governor cpufreq_gov_conservative;
 #define CPUFREQ_DEFAULT_GOVERNOR   (_gov_conservative)
+#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SCHED)
+extern struct cpufreq_governor cpufreq_gov_sched;
+#define CPUFREQ_DEFAULT_GOVERNOR   (_gov_sched)
 #endif
 
 /*
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3b0de68..d910a31 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -927,6 +927,14 @@ enum cpu_idle_type {
 #define SCHED_CAPACITY_SHIFT   10
 #define SCHED_CAPACITY_SCALE   (1L << SCHED_CAPACITY_SHIFT)
 
+struct sched_capacity_reqs {
+   unsigned long cfs;
+   unsigned long rt;
+   unsigned long dl;
+
+   unsigned long total;
+};
+
 /*
  * Wake-queues are lists of tasks with a pending wakeup, whose
  * callers have already marked the task as woken internally,
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 6768797..90ed832 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
 obj-$(CONFIG_SCHEDSTATS) += stats.o
 obj-$(CONFIG_SCHED_DEBUG) += debug.o
 obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
+obj-$(CONFIG_CPU_FREQ_GOV_SCHED) += cpufreq_sched.o
diff --git a/kernel/sched/cpufreq_sched.c b/kernel/sched/cpufreq_sched.c
new file mode 100644
index 

[PATCH 1/2] ppdev: convert to y2038 safe

2015-12-08 Thread Bamvor Jian Zhang
The y2038 issue for ppdev is changes of timeval in the ioctl
(PPSETTIME and PPGETTIME). The size of struct timeval changes from
8bytes to 16bytes due to the changes of time_t. It lead to the
changes of the command of ioctl, e.g. for PPGETTIME, We have:

on 32-bit (old): 0x80087095
on 32-bit (new): 0x80107095
on 64-bit  : 0x80107095

This patch define these two ioctl commands to support the 32bit
and 64bit time_t application at the same time. And, introduce
pp_set_timeout to remove some duplicated code.

Signed-off-by: Bamvor Jian Zhang 
---
 drivers/char/ppdev.c | 75 ++--
 1 file changed, 55 insertions(+), 20 deletions(-)

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index ae0b42b..19a4d6e 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -98,6 +98,13 @@ struct pp_struct {
 #define ROUND_UP(x,y) (((x)+(y)-1)/(y))
 
 static DEFINE_MUTEX(pp_do_mutex);
+
+/* define fixed sized ioctl cmd for y2038 migration */
+#define PPGETTIME32_IOR(PP_IOCTL, 0x95, s32[2])
+#define PPSETTIME32_IOW(PP_IOCTL, 0x96, s32[2])
+#define PPGETTIME64_IOR(PP_IOCTL, 0x95, s64[2])
+#define PPSETTIME64_IOW(PP_IOCTL, 0x96, s64[2])
+
 static inline void pp_enable_irq (struct pp_struct *pp)
 {
struct parport *port = pp->pdev->port;
@@ -322,6 +329,22 @@ static enum ieee1284_phase init_phase (int mode)
return IEEE1284_PH_FWD_IDLE;
 }
 
+static int pp_set_timeout(struct pardevice *pdev, long tv_sec, int tv_usec)
+{
+   long to_jiffies;
+
+   if ((tv_sec < 0) || (tv_usec < 0))
+   return -EINVAL;
+
+   to_jiffies = usecs_to_jiffies(tv_usec);
+   to_jiffies += tv_sec * HZ;
+   if (to_jiffies <= 0)
+   return -EINVAL;
+
+   pdev->timeout = to_jiffies;
+   return 0;
+}
+
 static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
unsigned int minor = iminor(file_inode(file));
@@ -495,9 +518,10 @@ static int pp_do_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
unsigned char reg;
unsigned char mask;
int mode;
+   s32 time32[2];
+   s64 time64[2];
+   struct timespec64 ts;
int ret;
-   struct timeval par_timeout;
-   long to_jiffies;
 
case PPRSTATUS:
reg = parport_read_status (port);
@@ -592,29 +616,40 @@ static int pp_do_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
atomic_sub (ret, >irqc);
return 0;
 
-   case PPSETTIME:
-   if (copy_from_user (_timeout, argp, sizeof(struct 
timeval))) {
+   case PPSETTIME32:
+   if (copy_from_user(time32, argp, sizeof(time32)))
return -EFAULT;
-   }
-   /* Convert to jiffies, place in pp->pdev->timeout */
-   if ((par_timeout.tv_sec < 0) || (par_timeout.tv_usec < 0)) {
-   return -EINVAL;
-   }
-   to_jiffies = ROUND_UP(par_timeout.tv_usec, 100/HZ);
-   to_jiffies += par_timeout.tv_sec * (long)HZ;
-   if (to_jiffies <= 0) {
+
+   return pp_set_timeout(pp->pdev, time32[0], time32[1]);
+
+   case PPSETTIME64:
+   if (copy_from_user(time64, argp, sizeof(time64)))
+   return -EFAULT;
+
+   return pp_set_timeout(pp->pdev, time64[0], time64[1]);
+
+   case PPGETTIME32:
+   jiffies_to_timespec64(pp->pdev->timeout, );
+   time32[0] = ts.tv_sec;
+   time32[1] = ts.tv_nsec / NSEC_PER_USEC;
+   if ((time32[0] < 0) || (time32[1] < 0))
return -EINVAL;
-   }
-   pp->pdev->timeout = to_jiffies;
+
+   if (copy_to_user(time32, argp, sizeof(time32)))
+   return -EFAULT;
+
return 0;
 
-   case PPGETTIME:
-   to_jiffies = pp->pdev->timeout;
-   memset(_timeout, 0, sizeof(par_timeout));
-   par_timeout.tv_sec = to_jiffies / HZ;
-   par_timeout.tv_usec = (to_jiffies % (long)HZ) * (100/HZ);
-   if (copy_to_user (argp, _timeout, sizeof(struct timeval)))
+   case PPGETTIME64:
+   jiffies_to_timespec64(pp->pdev->timeout, );
+   time64[0] = ts.tv_sec;
+   time64[1] = ts.tv_nsec / NSEC_PER_USEC;
+   if ((time64[0] < 0) || (time64[1] < 0))
+   return -EINVAL;
+
+   if (copy_to_user(time64, argp, sizeof(time64)))
return -EFAULT;
+
return 0;
 
default:
-- 
2.1.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  

[PATCH 2/2] ppdev: add support for compat ioctl

2015-12-08 Thread Bamvor Jian Zhang
The arg of ioctl in ppdev is the pointer of integer except the
timeval in PPSETTIME, PPGETTIME. Different size of timeval
is already supported by the previous patches. So, it is safe
to add compat support.

Signed-off-by: Bamvor Jian Zhang 
---
 drivers/char/ppdev.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 19a4d6e..7390166 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -670,6 +670,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
return ret;
 }
 
+#ifdef CONFIG_COMPAT
+static long pp_compat_ioctl(struct file *file, unsigned int cmd,
+   unsigned long arg)
+{
+   return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static int pp_open (struct inode * inode, struct file * file)
 {
unsigned int minor = iminor(inode);
@@ -779,6 +787,9 @@ static const struct file_operations pp_fops = {
.write  = pp_write,
.poll   = pp_poll,
.unlocked_ioctl = pp_ioctl,
+#ifdef CONFIG_COMPAT
+   .compat_ioctl   = pp_compat_ioctl,
+#endif
.open   = pp_open,
.release= pp_release,
 };
-- 
2.1.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 0/2] Convert ppdev to y2038 safe

2015-12-08 Thread Bamvor Jian Zhang
These series of patches try to convert parport device(ppdev) to
y2038 safe, and support y2038 safe and unsafe application at the
same time. There were some discussions in y2038 mailing list[1].

An y2038 safe application/kernel use 64bit time_t(aka time64_t)
to avoid 32-bit time types broken in the year 2038. Given that
some time relative struct(e.g. timeval in ppdev.c) is mainly the
offset of the real time, the old 32bit time_t in such application
is safe. We need to handle the 32bit time_t and 64bit time_t
application at the same time. My approach here is handle them as
different ioctl command for different size of timeval.

Build successful on arm64 and arm.

[1] https://lists.linaro.org/pipermail/y2038/

Bamvor Jian Zhang (2):
  ppdev: convert to y2038 safe
  ppdev: add support for compat ioctl

 drivers/char/ppdev.c | 86 
 1 file changed, 66 insertions(+), 20 deletions(-)

-- 
2.1.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: [f2fs-dev] [PATCH 3/3] f2fs: use lock_buffer when changing superblock

2015-12-08 Thread Chao Yu
Hi Jaegeuk,

> -Original Message-
> From: Jaegeuk Kim [mailto:jaeg...@kernel.org]
> Sent: Tuesday, December 08, 2015 6:53 AM
> To: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org;
> linux-f2fs-de...@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 3/3] f2fs: use lock_buffer when changing superblock
> 
> When modifying sb contents, we need to use lock its buffer.

How about applying the rule to _undo_ flow after f2fs_commit_super failed?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim 
> ---
>  fs/f2fs/file.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index a018ed3..a16dfe9 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1591,7 +1591,9 @@ static int f2fs_ioc_get_encryption_pwsalt(struct file 
> *filp, unsigned
> long arg)
>   return err;
> 
>   /* update superblock with uuid */
> + lock_buffer(sbi->raw_super_buf);
>   generate_random_uuid(sbi->raw_super->encrypt_pw_salt);
> + unlock_buffer(sbi->raw_super_buf);
> 
>   err = f2fs_commit_super(sbi, false);
> 
> --
> 2.4.9 (Apple Git-60)
> 
> 
> --
> Go from Idea to Many App Stores Faster with Intel(R) XDK
> Give your users amazing mobile app experiences with Intel(R) XDK.
> Use one codebase in this all-in-one HTML5 development environment.
> Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
> http://pubads.g.doubleclick.net/gampad/clk?id=254741911=/4140
> ___
> Linux-f2fs-devel mailing list
> linux-f2fs-de...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

--
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: [f2fs-dev] [PATCH 2/3] f2fs: refactor f2fs_commit_super

2015-12-08 Thread Chao Yu
> -Original Message-
> From: Jaegeuk Kim [mailto:jaeg...@kernel.org]
> Sent: Tuesday, December 08, 2015 6:53 AM
> To: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org;
> linux-f2fs-de...@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 2/3] f2fs: refactor f2fs_commit_super
> 
> Previously, f2fs_commit_super hacks the bh->blocknr to write the broken
> alternate superblock.
> Instead of it, we should use the correct logic to retrieve its buffer head
> with locking it appropriately.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

--
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: [f2fs-dev] [PATCH 1/3] f2fs: enhance the bit operation for SSR

2015-12-08 Thread Chao Yu
> -Original Message-
> From: Jaegeuk Kim [mailto:jaeg...@kernel.org]
> Sent: Tuesday, December 08, 2015 6:53 AM
> To: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org;
> linux-f2fs-de...@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/3] f2fs: enhance the bit operation for SSR
> 
> This patch enhances the existing bit operation when f2fs allocates SSR
> blocks.
> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Chao Yu 

--
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: piping core dump to a program escapes container

2015-12-08 Thread Dongsheng Yang

On 12/09/2015 11:29 AM, Eric W. Biederman wrote:

Dongsheng Yang  writes:


[...]


There has not yet been an obvious namespace in which to stick
core_pattern, and even worse exactly how to appropriate launch a process
in a container has not been figured out.

If those tricky problems can be solved we can have a core_pattern in a
container.  What we have now is the best we have been able to figure out
so far.


Thanx Eric, but if I want to make docker works rely on this behaviour,
is that reliable?

I mean, I want to make a docker container to dump the
core file to a specified path in host by a pipe way. But I am afraid
this behaviour would be changed later. Any suggestion?

Yang


Eric




Yang


Yang


Currently, I work around this issue by detecting that the process is
crashing from a container (by comparing the namespace pid to the
global pid) and refuse to dump the core if it is from a container.

Tested on Ubuntu (kernel 3.16) and Fedora (kernel 4.1).
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html





--
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/
.




.





--
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/


linux-next: build failure after merge of the vfs tree

2015-12-08 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (i386 defconfig)
failed like this:

In file included from include/linux/poll.h:9:0,
 from include/linux/rtc.h:56,
 from include/linux/mc146818rtc.h:15,
 from drivers/char/nvram.c:105:
drivers/char/nvram.c: In function 'nvram_llseek':
include/linux/fs.h:898:36: error: 'PAGE_CACHE_SIZE' undeclared (first use in 
this function)
 #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
^
drivers/char/nvram.c:216:56: note: in expansion of macro 'MAX_LFS_FILESIZE'
  return generic_file_llseek_size(file, offset, origin, MAX_LFS_FILESIZE,
^
include/linux/fs.h:898:36: note: each undeclared identifier is reported only 
once for each function it appears in
 #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
^
drivers/char/nvram.c:216:56: note: in expansion of macro 'MAX_LFS_FILESIZE'
  return generic_file_llseek_size(file, offset, origin, MAX_LFS_FILESIZE,
^
drivers/char/nvram.c:218:1: warning: control reaches end of non-void function 
[-Wreturn-type]   
 }
 ^

Caused by commit

  acde094daf36 ("don't open-code generic_file_llseek_size()")

I applied the following fix patch for today.

From: Stephen Rothwell 
Date: Wed, 9 Dec 2015 16:48:00 +1100
Subject: [PATCH] fix for "don't open-code generic_file_llseek_size()"

Signed-off-by: Stephen Rothwell 
---
 drivers/char/nvram.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 2157787cf11b..78a1cd690c96 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -39,6 +39,7 @@
 
 #include 
 #include 
+#include  /* for PAGE_CACHE_SIZE */
 
 #define PC 1
 #define ATARI  2
-- 
2.6.2

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
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 v10.1 14/17] drm: bridge: analogix/dp: try force hpd after plug in lookup failed

2015-12-08 Thread Yakir Yang

Hi Rob,

On 12/09/2015 12:25 PM, Rob Herring wrote:

On Wed, Dec 09, 2015 at 10:10:39AM +0800, Yakir Yang wrote:

Some edp screen do not have hpd signal, so we can't just return
failed when hpd plug in detect failed.

This is an hardware property, so we need add a devicetree property
"analogix,need-force-hpd" to indicate this sutiation.

Signed-off-by: Yakir Yang 
Tested-by: Javier Martinez Canillas 

Acked-by: Rob Herring 


Thanks,




---
Changes in v10.1:
- Rename the "analogix,need-force-hpd" to common 'force-hpd' (Rob)

Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add "analogix,need-force-hpd" to indicate whether driver need foce
   hpd when hpd detect failed.

Changes in v2: None

  .../bindings/display/bridge/analogix_dp.txt|  4 ++-
  .../bindings/display/exynos/exynos_dp.txt  |  1 +
  .../display/rockchip/analogix_dp-rockchip.txt  |  1 +
  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 35 ++
  drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  2 ++
  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  |  9 ++
  6 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt 
b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
index 7659a7a..4f2ba8c 100644
--- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
+++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
@@ -22,6 +22,9 @@ Required properties for dp-controller:
from general PHY binding: Should be "dp".
  
  Optional properties for dp-controller:

+   -force-hpd:
+   Indicate driver need force hpd when hpd detect failed, this
+   is used for some eDP screen which don't have hpd signal.
-hpd-gpios:
Hotplug detect GPIO.
Indicates which GPIO should be used for hotplug detection
@@ -31,7 +34,6 @@ Optional properties for dp-controller:
* Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
* 
Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
  
-

  [1]: Documentation/devicetree/bindings/media/video-interfaces.txt
  
---
  
diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt

index 9905081..8800164 100644
--- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
@@ -41,6 +41,7 @@ For the below properties, please refer to Analogix DP binding 
document:
-phys (required)
-phy-names (required)
-hpd-gpios (optional)
+   -analogix,need-force-hpd (optional)


Forget about this one, will send the new version to fix this, and carry 
your ack.



- Yakir


-video interfaces (optional)
  
  Deprecated properties for DisplayPort:

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
index dae86c4..187a708e 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
@@ -32,6 +32,7 @@ For the below properties, please refer to Analogix DP binding 
document:
  - phys (required)
  - phy-names (required)
  - hpd-gpios (optional)
+- force-hpd (optional)
  
---
  
  Example:

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index a11504b..00aee44 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -59,15 +59,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device 
*dp)
  {
int timeout_loop = 0;
  
-	while (analogix_dp_get_plug_in_status(dp) != 0) {

+   while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) {
+   if (analogix_dp_get_plug_in_status(dp) == 0)
+   return 0;
+
timeout_loop++;
-   if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
-   dev_err(dp->dev, "failed to get hpd plug status\n");
-   return -ETIMEDOUT;
-   }
usleep_range(10, 11);
}
  
+	/*

+* Some edp screen do not have hpd signal, so we can't just
+* return failed when hpd plug in detect failed, DT property
+* "need-force-hpd" would indicate whether driver need this.
+*/
+   if (!dp->force_hpd)
+   return -ETIMEDOUT;
+
+   /*
+* The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH
+

Re: [PATCH 07/12] x86/entry/64: Always run ptregs-using syscalls on the slow path

2015-12-08 Thread Andy Lutomirski
On Tue, Dec 8, 2015 at 8:43 PM, Brian Gerst  wrote:
> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski  wrote:
>> 64-bit syscalls currently have an optimization in which they are
>> called with partial pt_regs.  A small handful require full pt_regs.
>>
>> In the 32-bit and compat cases, I cleaned this up by forcing full
>> pt_regs for all syscalls.  The performance hit doesn't really matter.
>>
>> I want to clean up the 64-bit case as well, but I don't want to hurt
>> fast path performance.  To do that, I want to force the syscalls
>> that use pt_regs onto the slow path.  This will enable us to make
>> slow path syscalls be real ABI-compliant C functions.
>>
>> Use the new syscall entry qualification machinery for this.
>> stub_clone is now stub_clone/ptregs.
>>
>> The next patch will eliminate the stubs, and we'll just have
>> sys_clone/ptregs.
>>
>> Signed-off-by: Andy Lutomirski 
>
> Fails to boot, bisected to this patch:
> [   32.675319] kernel BUG at kernel/auditsc.c:1504!
> [   32.675325] invalid opcode:  [#65] SMP
> [   32.675328] Modules linked in:
> [   32.675333] CPU: 1 PID: 216 Comm: systemd-cgroups Tainted: G  D
> 4.3.0-rc4+ #7
> [   32.675336] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [   32.675339] task: 88075340 ti: 88003652 task.ti:
> 88003652
> [   32.675350] RIP: 0010:[]  []
> __audit_syscall_entry+0xcd/0xf0
> [   32.675353] RSP: 0018:880036523ef0  EFLAGS: 00010202
> [   32.675355] RAX: 000c RBX: 8800797b3000 RCX: 
> 7ffef8504e88
> [   32.675357] RDX: 56172f37cfd0 RSI:  RDI: 
> 000c
> [   32.675359] RBP: 880036523f00 R08: 0001 R09: 
> 88075340
> [   32.675361] R10:  R11: 0001 R12: 
> 
> [   32.675363] R13: c03e R14: 0001 R15: 
> 1000
> [   32.675380] FS:  7f02b4ff48c0() GS:88007fc8()
> knlGS:
> [   32.675383] CS:  0010 DS:  ES:  CR0: 8005003b
> [   32.675385] CR2: 7f93d47ea0e0 CR3: 36aa9000 CR4: 
> 06e0
> [   32.675391] Stack:
> [   32.675396]  880036523f58  880036523f10
> 8100321b
> [   32.675401]  880036523f48 81003ad0 56172f374040
> 7f93d45c9990
> [   32.675404]  0001 0001 1000
> 000a
> [   32.675405] Call Trace:
> [   32.675414]  [] do_audit_syscall_entry+0x4b/0x70
> [   32.675420]  [] syscall_trace_enter_phase2+0x110/0x1d0
> [   32.675425]  [] tracesys+0x3a/0x96
> [   32.675464] Code: 00 00 00 00 e8 a5 e0 fc ff c7 43 04 01 00 00 00
> 48 89 43 18 48 89 53 20 44 89 63 0c c7 83 94 02 00 00 00 00 00 00 5b
> 41 5c 5d c3 <0f> 0b 48 c7 43 50 00 00 00 00 48 c7 c2 60 b4 c5 81 48 89
> de 4c
> [   32.675469] RIP  [] __audit_syscall_entry+0xcd/0xf0
> [   32.675471]  RSP 

I'm not reproducing this, even with audit manually enabled.  Can you
send a .config?

--Andy
--
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] RTC: RK808: Work around hardware bug on November 31st

2015-12-08 Thread Doug Anderson
Julius,

On Mon, Dec 7, 2015 at 9:21 PM, Julius Werner  wrote:
> In Fuzhou, China, the month of November seems to be having 31 days.
> That's nice and all (I'm sure you can get a lot more done in a year that
> way), but back here in other parts of the world we are not so lucky.
> Therefore, we need to compensate for these extra days existing only in
> the RTC's imagination when reading the time and dealing with alarms.
>
> This patch is not a perfect workaround -- it only keeps the time stable
> as long as the system is running or suspended. If the system is fully
> shut down in November and only booted back up in December, the system
> time may be incorrect and alarms that had been set before the shutdown
> may fire on the wrong day. We're trying to catch and recover from this
> by reading the RTC's last "shadow timestamp" (which only gets resynced
> when transitioning the GET_TIME control bit) to figure out when the
> system was shut down, but this is only reliable if no other code (e.g.
> firmware) has read the RTC in-between.
>
> Basic idea for the workaround:
>
> - Whenever we set the time, we assume that timestamp to be correct
>   (synced to the real world). We store a copy of it in memory as an
>   anchor point (where we know our calendar matched the real world).
> - Whenever we read the time, we can tell how many days of desync we have
>   by counting November/December transitions between the anchor timestamp
>   and the time read from the hardware. We adjust the hardware clock
>   accordingly to get back in sync (which also resets the anchor time).
> - Whenever we set an alarm, we adjust the alarm time backwards by the
>   amount of days that we know we will lag behind at that point (by
>   counting the November/December transitions between our anchor point
>   and the alarm). This way, we will wake up on the right real world date
>   even though we cannot make adjustments while suspended.
> - Whenever we read an alarm, we do the opposite (forward) adjustment for
>   the returned result to keep our outside interface free from this
>   madness (callers expect to be able to read back the alarm they wrote).
> - Whenever we set the system time (which adjusts the anchor point), we
>   read out the (adjusted) alarm time beforehand and write it (newly
>   adjusted) back afterwards. This way, system time and alarm time will
>   always stay on the same calendar (as long as we're able to keep track
>   of our anchor point, at least).

Thinking about all this: these's actually a totally different
alternative approach we could take if you wanted.  It would fix S5 and
avoid all the anchor stuff, unless I'm crazy.

Basically totally give up on the RTC time reflecting reality.  Add a
"real time to rk808" and "rk808 time to real time" function.  Always
use it when reading from rk808 and always use it when writing to
rk808.  Choose 2015 as the "truth" year if you want (or pick another
year).  In early 2016 the rk808 always contains 1 day back.  In 2017
the rk808 always contains 2 days back.  Etc, etc, etc.

The firmware would get confused, but ...


> Signed-off-by: Julius Werner 
> ---
>  drivers/rtc/rtc-rk808.c | 282 
> 
>  1 file changed, 190 insertions(+), 92 deletions(-)
>
> diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
> index 91ca0bc..2a6cd6f 100644
> --- a/drivers/rtc/rtc-rk808.c
> +++ b/drivers/rtc/rtc-rk808.c
> @@ -54,103 +54,30 @@ struct rk808_rtc {
> struct rk808 *rk808;
> struct rtc_device *rtc;
> int irq;
> +   struct rtc_time anchor_time;/* Last sync point with real world */

Is this ever Nov 31st?  Looks like it never is...

>  };
>
> -/* Read current time and date in RTC */
> -static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
> +/*
> + * RK808 has a hardware bug causing it to count 31 days in November. This
> + * function can calculate the amount of days that code needs to adjust for
> + * between two timestamps to compensate for this.

Document what this does if "from" is Nov 31st or if "to" is Nov 31st.


> + */
> +static int nov31st_transitions(struct rtc_time *from, struct rtc_time *to)

Review will be significantly easier if we break this up into two patches:

1. Brain-dead code movement.  Move rk808_rtc_readtime() and
rk808_rtc_set_time() with no functional changes.

2. This actual change.

That changed the diffstat of the important patch from:

 1 file changed, 190 insertions(+), 92 deletions(-)

...to...

 1 file changed, 118 insertions(+), 20 deletions(-)


...possibly you could even add a 3rd patch splitting out raw_read.  Not sure...


>  {
> -   struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
> -   struct rk808 *rk808 = rk808_rtc->rk808;
> -   u8 rtc_data[NUM_TIME_REGS];
> -   int ret;
> -
> -   /* Force an update of the shadowed registers right now */
> -   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
> - 

Re: [RFC 0/3] reduce latency of direct async compaction

2015-12-08 Thread Aaron Lu
On Wed, Dec 09, 2015 at 09:33:53AM +0900, Joonsoo Kim wrote:
> On Tue, Dec 08, 2015 at 04:52:42PM +0800, Aaron Lu wrote:
> > On Tue, Dec 08, 2015 at 03:51:16PM +0900, Joonsoo Kim wrote:
> > > I add work-around for this problem at isolate_freepages(). Please test
> > > following one.
> > 
> > Still no luck and the error is about the same:
> 
> There is a mistake... Could you insert () for
> cc->free_pfn & ~(pageblock_nr_pages-1) like as following?
> 
> cc->free_pfn == (cc->free_pfn & ~(pageblock_nr_pages-1))

Oh right, of course.

Good news, the result is much better now:
$ cat {0..8}/swap
cmdline: /lkp/aaron/src/bin/usemem 100064603136
100064603136 transferred in 72 seconds, throughput: 1325 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100072049664
100072049664 transferred in 74 seconds, throughput: 1289 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100070246400
100070246400 transferred in 92 seconds, throughput: 1037 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100069545984
100069545984 transferred in 81 seconds, throughput: 1178 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100058895360
100058895360 transferred in 78 seconds, throughput: 1223 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100066074624
100066074624 transferred in 94 seconds, throughput: 1015 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100062855168
100062855168 transferred in 77 seconds, throughput: 1239 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100060990464
100060990464 transferred in 73 seconds, throughput: 1307 MB/s
cmdline: /lkp/aaron/src/bin/usemem 100064996352
100064996352 transferred in 84 seconds, throughput: 1136 MB/s
Max: 1325 MB/s
Min: 1015 MB/s
Avg: 1194 MB/s

The base result for reference:
$ cat {0..8}/swap
cmdline: /lkp/aaron/src/bin/usemem 10622592
10622592 transferred in 103 seconds, throughput: 925 MB/s
cmdline: /lkp/aaron/src/bin/usemem 9559680
9559680 transferred in 92 seconds, throughput: 1036 MB/s
cmdline: /lkp/aaron/src/bin/usemem 6171264
6171264 transferred in 92 seconds, throughput: 1036 MB/s
cmdline: /lkp/aaron/src/bin/usemem 15663744
15663744 transferred in 150 seconds, throughput: 635 MB/s
cmdline: /lkp/aaron/src/bin/usemem 12966528
12966528 transferred in 87 seconds, throughput: 1096 MB/s
cmdline: /lkp/aaron/src/bin/usemem 5784192
5784192 transferred in 131 seconds, throughput: 727 MB/s
cmdline: /lkp/aaron/src/bin/usemem 13731456
13731456 transferred in 97 seconds, throughput: 983 MB/s
cmdline: /lkp/aaron/src/bin/usemem 16440960
16440960 transferred in 109 seconds, throughput: 874 MB/s
cmdline: /lkp/aaron/src/bin/usemem 8813184
8813184 transferred in 122 seconds, throughput: 781 MB/s
Max: 1096 MB/s
Min: 635 MB/s
Avg: 899 MB/s
--
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/


[lkp] [x86 tsc] 1dd8e21222:

2015-12-08 Thread kernel test robot
FYI, we noticed the below changes on

https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git cpufreq
commit 1dd8e212220cdec445793afb130d1634146e70aa ("x86 tsc: Use Sklake CPUID to 
distinguish cpu_khz and tsc_khz")

We found the following new message in kernel log after your commit.

[0.00] tsc: Fast TSC calibration failed
[0.00] tsc: Fast TSC calibration failed
[0.00] tsc: Unable to calibrate against PIT
[0.00] tsc: Unable to calibrate against PIT


Thanks,
Ying Huang
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.3.0 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_PGTABLE_LEVELS=4
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
CONFIG_USELIB=y
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
# CONFIG_TASKS_RCU is not set
CONFIG_RCU_STALL_COMMON=y
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_RCU_EXPEDITE_BOOT is not set
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=y
# CONFIG_IKCONFIG_PROC is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
# CONFIG_CGROUP_FREEZER is not set
# CONFIG_CGROUP_PIDS is not set
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_CPUACCT is not set
# CONFIG_MEMCG is not set
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_SCHED is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_NAMESPACES is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
CONFIG_RD_LZO=y
# CONFIG_RD_LZ4 is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
CONFIG_EXPERT=y
CONFIG_MULTIUSER=y
# CONFIG_SGETMASK_SYSCALL is not set
# CONFIG_SYSFS_SYSCALL is not set
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
# CONFIG_BASE_FULL is not set
CONFIG_FUTEX=y

[PATCH v2 04/11] ufs: get rid of ->setattr() for symlinks

2015-12-08 Thread Al Viro
From: Al Viro 

It was to needed for a couple of months in 2010, until UFS
quota support got dropped.  Since then it's equivalent to
simple_setattr() (i.e. the default) for everything except the
regular files.  And dropping it there allows to convert all
UFS symlinks to {page,simple}_symlink_inode_operations, getting
rid of fs/ufs/symlink.c completely.

Signed-off-by: Al Viro 
---
 fs/ufs/Makefile  |  2 +-
 fs/ufs/inode.c   |  4 ++--
 fs/ufs/namei.c   |  4 ++--
 fs/ufs/symlink.c | 42 --
 fs/ufs/ufs.h |  4 
 5 files changed, 5 insertions(+), 51 deletions(-)
 delete mode 100644 fs/ufs/symlink.c

diff --git a/fs/ufs/Makefile b/fs/ufs/Makefile
index 392db25..ec4a6b4 100644
--- a/fs/ufs/Makefile
+++ b/fs/ufs/Makefile
@@ -5,5 +5,5 @@
 obj-$(CONFIG_UFS_FS) += ufs.o
 
 ufs-objs := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \
-   namei.o super.o symlink.o util.o
+   namei.o super.o util.o
 ccflags-$(CONFIG_UFS_DEBUG)+= -DDEBUG
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index a064cf44..737160a 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -528,11 +528,11 @@ static void ufs_set_inode_ops(struct inode *inode)
inode->i_mapping->a_ops = _aops;
} else if (S_ISLNK(inode->i_mode)) {
if (!inode->i_blocks) {
-   inode->i_op = _fast_symlink_inode_operations;
inode->i_link = (char *)UFS_I(inode)->i_u1.i_symlink;
+   inode->i_op = _symlink_inode_operations;
} else {
-   inode->i_op = _symlink_inode_operations;
inode->i_mapping->a_ops = _aops;
+   inode->i_op = _symlink_inode_operations;
}
} else
init_special_inode(inode, inode->i_mode,
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 4796655..24b0cbd 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -123,14 +123,14 @@ static int ufs_symlink (struct inode * dir, struct dentry 
* dentry,
 
if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
/* slow symlink */
-   inode->i_op = _symlink_inode_operations;
+   inode->i_op = _symlink_inode_operations;
inode->i_mapping->a_ops = _aops;
err = page_symlink(inode, symname, l);
if (err)
goto out_fail;
} else {
/* fast symlink */
-   inode->i_op = _fast_symlink_inode_operations;
+   inode->i_op = _symlink_inode_operations;
inode->i_link = (char *)UFS_I(inode)->i_u1.i_symlink;
memcpy(inode->i_link, symname, l);
inode->i_size = l-1;
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c
deleted file mode 100644
index 874480b..000
--- a/fs/ufs/symlink.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  linux/fs/ufs/symlink.c
- *
- * Only fast symlinks left here - the rest is done by generic code. AV, 1999
- *
- * Copyright (C) 1998
- * Daniel Pirkl 
- * Charles University, Faculty of Mathematics and Physics
- *
- *  from
- *
- *  linux/fs/ext2/symlink.c
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (c...@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/fs/minix/symlink.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  ext2 symlink handling code
- */
-
-#include "ufs_fs.h"
-#include "ufs.h"
-
-const struct inode_operations ufs_fast_symlink_inode_operations = {
-   .readlink   = generic_readlink,
-   .follow_link= simple_follow_link,
-   .setattr= ufs_setattr,
-};
-
-const struct inode_operations ufs_symlink_inode_operations = {
-   .readlink   = generic_readlink,
-   .follow_link= page_follow_link_light,
-   .put_link   = page_put_link,
-   .setattr= ufs_setattr,
-};
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
index 7da4aca..c87f4c3 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -136,10 +136,6 @@ extern __printf(3, 4)
 void ufs_panic(struct super_block *, const char *, const char *, ...);
 void ufs_mark_sb_dirty(struct super_block *sb);
 
-/* symlink.c */
-extern const struct inode_operations ufs_fast_symlink_inode_operations;
-extern const struct inode_operations ufs_symlink_inode_operations;
-
 static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
 {
return sb->s_fs_info;
-- 
2.1.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 06/11] don't put symlink bodies in pagecache into highmem

2015-12-08 Thread Al Viro
From: Al Viro 

kmap() in page_follow_link_light() needed to go - allowing to hold
an arbitrary number of kmaps for long is a great way to deadlocking
the system.

new helper (inode_nohighmem(inode)) needs to be used for pagecache
symlinks inodes; done for all in-tree cases.  page_follow_link_light()
instrumented to yell about anything missed.

Signed-off-by: Al Viro 
---
 Documentation/filesystems/porting |  5 +
 fs/affs/inode.c   |  1 +
 fs/affs/namei.c   |  1 +
 fs/affs/symlink.c |  4 +---
 fs/afs/inode.c|  1 +
 fs/befs/linuxvfs.c|  5 ++---
 fs/btrfs/inode.c  |  2 ++
 fs/coda/cnode.c   |  2 ++
 fs/coda/symlink.c |  4 +---
 fs/cramfs/inode.c |  1 +
 fs/efs/inode.c|  1 +
 fs/efs/symlink.c  |  4 +---
 fs/exofs/inode.c  |  1 +
 fs/exofs/namei.c  |  1 +
 fs/ext2/inode.c   |  1 +
 fs/ext2/namei.c   |  1 +
 fs/ext4/inode.c   |  1 +
 fs/ext4/namei.c   |  1 +
 fs/ext4/symlink.c | 10 +++---
 fs/f2fs/inode.c   |  1 +
 fs/f2fs/namei.c   |  5 ++---
 fs/freevxfs/vxfs_inode.c  |  1 +
 fs/hfsplus/inode.c|  2 ++
 fs/hpfs/inode.c   |  1 +
 fs/hpfs/namei.c   |  5 ++---
 fs/hugetlbfs/inode.c  |  1 +
 fs/inode.c|  6 ++
 fs/isofs/inode.c  |  1 +
 fs/isofs/rock.c   |  4 +---
 fs/jfs/inode.c|  1 +
 fs/jfs/namei.c|  1 +
 fs/logfs/dir.c|  1 +
 fs/logfs/inode.c  |  1 +
 fs/minix/inode.c  |  1 +
 fs/namei.c|  9 +++--
 fs/ncpfs/inode.c  |  1 +
 fs/nfs/inode.c|  5 +++--
 fs/nfs/symlink.c  |  2 +-
 fs/nilfs2/inode.c |  1 +
 fs/nilfs2/namei.c |  1 +
 fs/ocfs2/inode.c  |  1 +
 fs/ocfs2/namei.c  |  1 +
 fs/qnx4/inode.c   |  1 +
 fs/qnx6/inode.c   |  1 +
 fs/ramfs/inode.c  |  1 +
 fs/reiserfs/inode.c   |  1 +
 fs/reiserfs/namei.c   |  1 +
 fs/romfs/super.c  |  1 +
 fs/squashfs/inode.c   |  2 ++
 fs/sysv/inode.c   |  1 +
 fs/udf/inode.c|  1 +
 fs/udf/namei.c|  1 +
 fs/udf/symlink.c  |  4 +---
 fs/ufs/inode.c|  1 +
 fs/ufs/namei.c|  1 +
 include/linux/fs.h|  1 +
 mm/shmem.c|  9 +++--
 57 files changed, 81 insertions(+), 46 deletions(-)

diff --git a/Documentation/filesystems/porting 
b/Documentation/filesystems/porting
index f24d1b8..3eb7c35 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -504,3 +504,8 @@ in your dentry operations instead.
 [mandatory]
__fd_install() & fd_install() can now sleep. Callers should not
hold a spinlock or other resources that do not allow a schedule.
+--
+[mandatory]
+   any symlink that might use page_follow_link_light/page_put_link() must
+   have inode_nohighmem(inode) called before anything might start playing 
with
+   its pagecache.
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 1734950..0fdb0f5 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -140,6 +140,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned 
long ino)
break;
case ST_SOFTLINK:
inode->i_mode |= S_IFLNK;
+   inode_nohighmem(inode);
inode->i_op = _symlink_inode_operations;
inode->i_data.a_ops = _symlink_aops;
break;
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 181e05b..00d3002 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -344,6 +344,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, 
const char *symname)
return -ENOSPC;
 
inode->i_op = _symlink_inode_operations;
+   inode_nohighmem(inode);
inode->i_data.a_ops = _symlink_aops;
inode->i_mode = S_IFLNK | 0777;
mode_to_prot(inode);
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
index ea5b69a..e3f9dc3 100644
--- a/fs/affs/symlink.c
+++ b/fs/affs/symlink.c
@@ -14,7 +14,7 @@ static int affs_symlink_readpage(struct file *file, struct 
page *page)
 {
struct buffer_head *bh;
struct inode *inode = page->mapping->host;
-   char *link = kmap(page);
+   char *link = page_address(page);
struct slink_front *lf;
int  i, j;
char c;
@@ -57,12 +57,10 @@ static int affs_symlink_readpage(struct file *file, struct 
page 

[PATCH v2 09/11] teach shmem_get_link() to work in RCU mode

2015-12-08 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 mm/shmem.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 684dbc3..0605716 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2501,12 +2501,20 @@ static const char *shmem_get_link(struct dentry *dentry,
 {
struct page *page = NULL;
int error;
-   if (!dentry)
-   return ERR_PTR(-ECHILD);
-   error = shmem_getpage(inode, 0, , SGP_READ, NULL);
-   if (error)
-   return ERR_PTR(error);
-   unlock_page(page);
+   if (!dentry) {
+   page = find_get_page(inode->i_mapping, 0);
+   if (!page)
+   return ERR_PTR(-ECHILD);
+   if (!PageUptodate(page)) {
+   put_page(page);
+   return ERR_PTR(-ECHILD);
+   }
+   } else {
+   error = shmem_getpage(inode, 0, , SGP_READ, NULL);
+   if (error)
+   return ERR_PTR(error);
+   unlock_page(page);
+   }
*cookie = page;
return page_address(page);
 }
-- 
2.1.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 05/11] namei: page_getlink() and page_follow_link_light() are the same thing

2015-12-08 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/namei.c | 32 +---
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0c3974c..4bae5cb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4518,7 +4518,7 @@ int generic_readlink(struct dentry *dentry, char __user 
*buffer, int buflen)
 EXPORT_SYMBOL(generic_readlink);
 
 /* get the link contents into pagecache */
-static char *page_getlink(struct dentry * dentry, struct page **ppage)
+static const char *page_getlink(struct dentry * dentry, void **cookie)
 {
char *kaddr;
struct page *page;
@@ -4526,31 +4526,15 @@ static char *page_getlink(struct dentry * dentry, 
struct page **ppage)
page = read_mapping_page(mapping, 0, NULL);
if (IS_ERR(page))
return (char*)page;
-   *ppage = page;
+   *cookie = page;
kaddr = kmap(page);
nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1);
return kaddr;
 }
 
-int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
-{
-   struct page *page = NULL;
-   int res = readlink_copy(buffer, buflen, page_getlink(dentry, ));
-   if (page) {
-   kunmap(page);
-   page_cache_release(page);
-   }
-   return res;
-}
-EXPORT_SYMBOL(page_readlink);
-
 const char *page_follow_link_light(struct dentry *dentry, void **cookie)
 {
-   struct page *page = NULL;
-   char *res = page_getlink(dentry, );
-   if (!IS_ERR(res))
-   *cookie = page;
-   return res;
+   return page_getlink(dentry, cookie);
 }
 EXPORT_SYMBOL(page_follow_link_light);
 
@@ -4562,6 +4546,16 @@ void page_put_link(struct inode *unused, void *cookie)
 }
 EXPORT_SYMBOL(page_put_link);
 
+int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+{
+   void *cookie = NULL;
+   int res = readlink_copy(buffer, buflen, page_getlink(dentry, ));
+   if (cookie)
+   page_put_link(NULL, cookie);
+   return res;
+}
+EXPORT_SYMBOL(page_readlink);
+
 /*
  * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS
  */
-- 
2.1.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 08/11] teach page_get_link() to work in RCU mode

2015-12-08 Thread Al Viro
From: Al Viro 

more or less along the lines of Neil's patchset, sans the insanity
around kmap().

Signed-off-by: Al Viro 
---
 fs/namei.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 1da3064..8f51788 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4533,12 +4533,19 @@ const char *page_get_link(struct dentry *dentry, struct 
inode *inode,
struct page *page;
struct address_space *mapping = inode->i_mapping;
 
-   if (!dentry)
-   return ERR_PTR(-ECHILD);
-
-   page = read_mapping_page(mapping, 0, NULL);
-   if (IS_ERR(page))
-   return (char*)page;
+   if (!dentry) {
+   page = find_get_page(mapping, 0);
+   if (!page)
+   return ERR_PTR(-ECHILD);
+   if (!PageUptodate(page)) {
+   put_page(page);
+   return ERR_PTR(-ECHILD);
+   }
+   } else {
+   page = read_mapping_page(mapping, 0, NULL);
+   if (IS_ERR(page))
+   return (char*)page;
+   }
*cookie = page;
BUG_ON(mapping_gfp_mask(mapping) & __GFP_HIGHMEM);
kaddr = page_address(page);
-- 
2.1.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 10/11] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode

2015-12-08 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/proc/self.c| 8 +++-
 fs/proc/thread_self.c | 9 -
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/proc/self.c b/fs/proc/self.c
index 9dd0ae6..7a8b19e 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -25,14 +25,12 @@ static const char *proc_self_get_link(struct dentry *dentry,
pid_t tgid = task_tgid_nr_ns(current, ns);
char *name;
 
-   if (!dentry)
-   return ERR_PTR(-ECHILD);
if (!tgid)
return ERR_PTR(-ENOENT);
/* 11 for max length of signed int in decimal + NULL term */
-   name = kmalloc(12, GFP_KERNEL);
-   if (!name)
-   return ERR_PTR(-ENOMEM);
+   name = kmalloc(12, dentry ? GFP_KERNEL : GFP_ATOMIC);
+   if (unlikely(!name))
+   return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
sprintf(name, "%d", tgid);
return *cookie = name;
 }
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 50eef6f..03eaa84 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -27,13 +27,12 @@ static const char *proc_thread_self_get_link(struct dentry 
*dentry,
pid_t pid = task_pid_nr_ns(current, ns);
char *name;
 
-   if (!dentry)
-   return ERR_PTR(-ECHILD);
if (!pid)
return ERR_PTR(-ENOENT);
-   name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF, GFP_KERNEL);
-   if (!name)
-   return ERR_PTR(-ENOMEM);
+   name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF,
+   dentry ? GFP_KERNEL : GFP_ATOMIC);
+   if (unlikely(!name))
+   return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
sprintf(name, "%d/task/%d", tgid, pid);
return *cookie = name;
 }
-- 
2.1.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 11/11] teach nfs_get_link() to work in RCU mode

2015-12-08 Thread Al Viro
From: Al Viro 

based upon the corresponding patch from Neil's March patchset,
again with kmap-related horrors removed.

Signed-off-by: Al Viro 
---
 fs/nfs/inode.c | 21 +
 fs/nfs/symlink.c   | 30 --
 include/linux/nfs_fs.h |  1 +
 3 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ae9aa0b..aa828e8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1087,6 +1087,27 @@ static bool nfs_mapping_need_revalidate_inode(struct 
inode *inode)
|| NFS_STALE(inode);
 }
 
+int nfs_revalidate_mapping_rcu(struct inode *inode)
+{
+   struct nfs_inode *nfsi = NFS_I(inode);
+   unsigned long *bitlock = >flags;
+   int ret = 0;
+
+   if (IS_SWAPFILE(inode))
+   goto out;
+   if (nfs_mapping_need_revalidate_inode(inode)) {
+   ret = -ECHILD;
+   goto out;
+   }
+   spin_lock(>i_lock);
+   if (test_bit(NFS_INO_INVALIDATING, bitlock) ||
+   (nfsi->cache_validity & NFS_INO_INVALID_DATA))
+   ret = -ECHILD;
+   spin_unlock(>i_lock);
+out:
+   return ret;
+}
+
 /**
  * __nfs_revalidate_mapping - Revalidate the pagecache
  * @inode - pointer to host inode
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 8ade8a8..95c69af 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -48,16 +48,26 @@ static const char *nfs_get_link(struct dentry *dentry,
struct page *page;
void *err;
 
-   if (!dentry)
-   return ERR_PTR(-ECHILD);
-
-   err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
-   if (err)
-   return err;
-   page = read_cache_page(>i_data, 0,
-   (filler_t *)nfs_symlink_filler, inode);
-   if (IS_ERR(page))
-   return ERR_CAST(page);
+   if (!dentry) {
+   err = ERR_PTR(nfs_revalidate_mapping_rcu(inode));
+   if (err)
+   return err;
+   page = find_get_page(inode->i_mapping, 0);
+   if (!page)
+   return ERR_PTR(-ECHILD);
+   if (!PageUptodate(page)) {
+   put_page(page);
+   return ERR_PTR(-ECHILD);
+   }
+   } else {
+   err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
+   if (err)
+   return err;
+   page = read_cache_page(>i_data, 0,
+   (filler_t *)nfs_symlink_filler, inode);
+   if (IS_ERR(page))
+   return ERR_CAST(page);
+   }
*cookie = page;
return page_address(page);
 }
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c0e9614..37a3d29 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -359,6 +359,7 @@ extern int nfs_revalidate_inode(struct nfs_server *server, 
struct inode *inode);
 extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode 
*inode);
 extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
 extern int nfs_revalidate_mapping(struct inode *inode, struct address_space 
*mapping);
+extern int nfs_revalidate_mapping_rcu(struct inode *inode);
 extern int nfs_revalidate_mapping_protected(struct inode *inode, struct 
address_space *mapping);
 extern int nfs_setattr(struct dentry *, struct iattr *);
 extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, 
struct nfs_fattr *);
-- 
2.1.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 07/11] replace ->follow_link() with new method that could stay in RCU mode

2015-12-08 Thread Al Viro
From: Al Viro 

new method: ->get_link(); replacement of ->follow_link().  The differences
are:
* inode and dentry are passed separately
* might be called both in RCU and non-RCU mode;
the former is indicated by passing it a NULL dentry.
* when called that way it isn't allowed to block
and should return ERR_PTR(-ECHILD) if it needs to be called
in non-RCU mode.

It's a flagday change - the old method is gone, all in-tree instances
converted.  Conversion isn't hard; said that, so far very few instances
do not immediately bail out when called in RCU mode.  That'll change
in the next commits.

Signed-off-by: Al Viro 
---
 Documentation/filesystems/Locking |  4 +--
 Documentation/filesystems/porting |  6 
 drivers/staging/lustre/lustre/llite/symlink.c |  8 +++--
 fs/9p/vfs_inode.c | 17 +++---
 fs/9p/vfs_inode_dotl.c| 14 ++---
 fs/affs/symlink.c |  4 +--
 fs/autofs4/symlink.c  | 13 +---
 fs/btrfs/inode.c  |  2 +-
 fs/ceph/inode.c   |  2 +-
 fs/cifs/cifsfs.c  |  2 +-
 fs/cifs/cifsfs.h  |  4 +--
 fs/cifs/link.c|  6 ++--
 fs/coda/cnode.c   |  2 +-
 fs/configfs/symlink.c | 11 +--
 fs/dcache.c   |  2 +-
 fs/ecryptfs/inode.c   | 12 +--
 fs/ext2/symlink.c |  4 +--
 fs/ext4/symlink.c | 13 +---
 fs/f2fs/namei.c   | 16 ++
 fs/fuse/dir.c |  9 --
 fs/gfs2/inode.c   | 15 ++---
 fs/hostfs/hostfs_kern.c   | 10 --
 fs/jffs2/symlink.c|  2 +-
 fs/jfs/symlink.c  |  4 +--
 fs/kernfs/symlink.c   | 11 +--
 fs/libfs.c|  9 +++---
 fs/minix/inode.c  |  2 +-
 fs/namei.c| 45 +--
 fs/ncpfs/inode.c  |  2 +-
 fs/nfs/symlink.c  |  9 --
 fs/nilfs2/namei.c |  2 +-
 fs/ocfs2/symlink.c|  2 +-
 fs/overlayfs/inode.c  | 12 ---
 fs/proc/base.c| 22 +++--
 fs/proc/inode.c   |  7 +++--
 fs/proc/namespaces.c  |  9 --
 fs/proc/self.c|  9 --
 fs/proc/thread_self.c |  9 --
 fs/reiserfs/namei.c   |  2 +-
 fs/squashfs/symlink.c |  2 +-
 fs/sysv/inode.c   |  2 +-
 fs/ubifs/file.c   |  2 +-
 fs/xfs/xfs_iops.c |  8 +++--
 include/linux/fs.h|  6 ++--
 mm/shmem.c| 12 ---
 45 files changed, 234 insertions(+), 132 deletions(-)

diff --git a/Documentation/filesystems/Locking 
b/Documentation/filesystems/Locking
index 06d4434..4fba54b 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -50,7 +50,7 @@ prototypes:
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
-   const char *(*follow_link) (struct dentry *, void **);
+   const char *(*get_link) (struct dentry *, struct inode *, void **);
void (*put_link) (struct inode *, void *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
@@ -83,7 +83,7 @@ rmdir:yes (both)  (see below)
 rename:yes (all)   (see below)
 rename2:   yes (all)   (see below)
 readlink:  no
-follow_link:   no
+get_link:  no
 put_link:  no
 setattr:   yes
 permission:no (may not block if called in rcu-walk mode)
diff --git a/Documentation/filesystems/porting 
b/Documentation/filesystems/porting
index 3eb7c35..cf92a8c 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -509,3 +509,9 @@ in your dentry operations instead.
any symlink that might use page_follow_link_light/page_put_link() must
have inode_nohighmem(inode) called before anything might start playing 
with
its pagecache.
+--
+[mandatory]
+   ->follow_link() is replaced with ->get_link(); same API, except that
+   * ->get_link() gets inode as a separate argument
+   * ->get_link() may be 

[PATCH v2 03/11] udf: don't duplicate page_symlink_inode_operations

2015-12-08 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/udf/inode.c   | 2 +-
 fs/udf/namei.c   | 7 +--
 fs/udf/udfdecl.h | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 8d0b3ad..8675c2b 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1540,7 +1540,7 @@ reread:
break;
case ICBTAG_FILE_TYPE_SYMLINK:
inode->i_data.a_ops = _symlink_aops;
-   inode->i_op = _symlink_inode_operations;
+   inode->i_op = _symlink_inode_operations;
inode->i_mode = S_IFLNK | S_IRWXUGO;
break;
case ICBTAG_FILE_TYPE_MAIN:
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index c97b5a8..d0e6de1 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -921,7 +921,7 @@ static int udf_symlink(struct inode *dir, struct dentry 
*dentry,
}
 
inode->i_data.a_ops = _symlink_aops;
-   inode->i_op = _symlink_inode_operations;
+   inode->i_op = _symlink_inode_operations;
 
if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
struct kernel_lb_addr eloc;
@@ -1344,8 +1344,3 @@ const struct inode_operations udf_dir_inode_operations = {
.rename = udf_rename,
.tmpfile= udf_tmpfile,
 };
-const struct inode_operations udf_symlink_inode_operations = {
-   .readlink   = generic_readlink,
-   .follow_link= page_follow_link_light,
-   .put_link   = page_put_link,
-};
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 47bb3f5..ce169b4 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -85,7 +85,6 @@ extern const struct inode_operations udf_dir_inode_operations;
 extern const struct file_operations udf_dir_operations;
 extern const struct inode_operations udf_file_inode_operations;
 extern const struct file_operations udf_file_operations;
-extern const struct inode_operations udf_symlink_inode_operations;
 extern const struct address_space_operations udf_aops;
 extern const struct address_space_operations udf_adinicb_aops;
 extern const struct address_space_operations udf_symlink_aops;
-- 
2.1.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 02/11] logfs: don't duplicate page_symlink_inode_operations

2015-12-08 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/logfs/dir.c   | 8 +---
 fs/logfs/inode.c | 2 +-
 fs/logfs/logfs.h | 1 -
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index f9b45d4..99944a4 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -528,7 +528,7 @@ static int logfs_symlink(struct inode *dir, struct dentry 
*dentry,
if (IS_ERR(inode))
return PTR_ERR(inode);
 
-   inode->i_op = _symlink_iops;
+   inode->i_op = _symlink_inode_operations;
inode->i_mapping->a_ops = _reg_aops;
 
return __logfs_create(dir, dentry, inode, target, destlen);
@@ -776,12 +776,6 @@ fail:
return -EIO;
 }
 
-const struct inode_operations logfs_symlink_iops = {
-   .readlink   = generic_readlink,
-   .follow_link= page_follow_link_light,
-   .put_link   = page_put_link,
-};
-
 const struct inode_operations logfs_dir_iops = {
.create = logfs_create,
.link   = logfs_link,
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index af49e2d..06baa92 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -64,7 +64,7 @@ static void logfs_inode_setops(struct inode *inode)
inode->i_mapping->a_ops = _reg_aops;
break;
case S_IFLNK:
-   inode->i_op = _symlink_iops;
+   inode->i_op = _symlink_inode_operations;
inode->i_mapping->a_ops = _reg_aops;
break;
case S_IFSOCK:  /* fall through */
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
index 5f09376..209a26d 100644
--- a/fs/logfs/logfs.h
+++ b/fs/logfs/logfs.h
@@ -495,7 +495,6 @@ static inline int logfs_get_sb_mtd(struct logfs_super *s, 
int mtdnr)
 #endif
 
 /* dir.c */
-extern const struct inode_operations logfs_symlink_iops;
 extern const struct inode_operations logfs_dir_iops;
 extern const struct file_operations logfs_dir_fops;
 int logfs_replay_journal(struct super_block *sb);
-- 
2.1.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 01/11] switch befs long symlinks to page_symlink_operations

2015-12-08 Thread Al Viro
From: Al Viro 

just give them the right ->readpage()...

Signed-off-by: Al Viro 
---
 fs/befs/linuxvfs.c | 41 ++---
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 46aedac..1c8b0dc 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -42,7 +42,7 @@ static struct inode *befs_iget(struct super_block *, unsigned 
long);
 static struct inode *befs_alloc_inode(struct super_block *sb);
 static void befs_destroy_inode(struct inode *inode);
 static void befs_destroy_inodecache(void);
-static const char *befs_follow_link(struct dentry *, void **);
+static int befs_symlink_readpage(struct file *, struct page *);
 static int befs_utf2nls(struct super_block *sb, const char *in, int in_len,
char **out, int *out_len);
 static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
@@ -79,10 +79,8 @@ static const struct address_space_operations befs_aops = {
.bmap   = befs_bmap,
 };
 
-static const struct inode_operations befs_symlink_inode_operations = {
-   .readlink   = generic_readlink,
-   .follow_link= befs_follow_link,
-   .put_link   = kfree_put_link,
+static const struct address_space_operations befs_symlink_aops = {
+   .readpage   = befs_symlink_readpage,
 };
 
 /* 
@@ -398,7 +396,8 @@ static struct inode *befs_iget(struct super_block *sb, 
unsigned long ino)
inode->i_fop = _dir_operations;
} else if (S_ISLNK(inode->i_mode)) {
if (befs_ino->i_flags & BEFS_LONG_SYMLINK) {
-   inode->i_op = _symlink_inode_operations;
+   inode->i_op = _symlink_inode_operations;
+   inode->i_mapping->a_ops = _symlink_aops;
} else {
inode->i_link = befs_ino->i_data.symlink;
inode->i_op = _symlink_inode_operations;
@@ -463,31 +462,35 @@ befs_destroy_inodecache(void)
  * The data stream become link name. Unless the LONG_SYMLINK
  * flag is set.
  */
-static const char *
-befs_follow_link(struct dentry *dentry, void **cookie)
+static int befs_symlink_readpage(struct file *unused, struct page *page)
 {
-   struct super_block *sb = dentry->d_sb;
-   struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry));
+   struct inode *inode = page->mapping->host;
+   struct super_block *sb = inode->i_sb;
+   struct befs_inode_info *befs_ino = BEFS_I(inode);
befs_data_stream *data = _ino->i_data.ds;
befs_off_t len = data->size;
-   char *link;
+   char *link = kmap(page);
 
-   if (len == 0) {
+   if (len == 0 || len > PAGE_SIZE) {
befs_error(sb, "Long symlink with illegal length");
-   return ERR_PTR(-EIO);
+   goto fail;
}
befs_debug(sb, "Follow long symlink");
 
-   link = kmalloc(len, GFP_NOFS);
-   if (!link)
-   return ERR_PTR(-ENOMEM);
if (befs_read_lsymlink(sb, data, link, len) != len) {
-   kfree(link);
befs_error(sb, "Failed to read entire long symlink");
-   return ERR_PTR(-EIO);
+   goto fail;
}
link[len - 1] = '\0';
-   return *cookie = link;
+   SetPageUptodate(page);
+   kunmap(page);
+   unlock_page(page);
+   return 0;
+fail:
+   SetPageError(page);
+   kunmap(page);
+   unlock_page(page);
+   return -EIO;
 }
 
 /*
-- 
2.1.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: [lkp] [rcu] 52b265325b: WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:61 internal_create_group+0x252/0x300()

2015-12-08 Thread Josh Triplett
On Tue, Dec 08, 2015 at 09:18:16PM -0800, Paul E. McKenney wrote:
> On Wed, Dec 09, 2015 at 11:23:05AM +0800, kernel test robot wrote:
> > FYI, we noticed the below changes on
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
> > rcu/dev
> > commit 52b265325b7a7438cbcdd735fecdd9d7e255eb83 ("rcu: Remove TINY_RCU 
> > bloat from pointless boot parameters")
> > 
> > 
> > ++++
> > || dc15c60e39 | 52b265325b |
> > ++++
> > | boot_successes | 4  | 0  |
> > ++++
> 
> Should be fixed in commit 79cfea027387.

What did you change in that version?
--
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/


[PATCHSET v2] ->follow_link() without dropping from RCU mode

2015-12-08 Thread Al Viro
On Tue, Nov 17, 2015 at 10:57:52PM +, Al Viro wrote:

>   Right now we stay in RCU mode for fast symlink traversal.
> However, anything trickier drops out of RCU mode - back in 4.2
> the symlink-related pile had grown too large to add this on top
> of everything else.  Below is an attempt to do that now.
> 
> Those who prefer to use git for review can find that series in
> git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.symlinks

Compared to the previous iteration:
* rebased to 4.4-rc4.
* NFS (in case of pagecache hit, of course) also stays in RCU mode.
* renamed inode_nohigh() as suggested by dchinner, moved to
fs/inode.c - less header PITA that way.

What's there:
01/11: switch befs long symlinks to page_symlink_operations
02/11: logfs: don't duplicate page_symlink_inode_operations
03/11: udf: don't duplicate page_symlink_inode_operations
04/11: ufs: get rid of ->setattr() for symlinks
Simplifying things a bit by switching them to page_symlink_operations
where possible.

05/11: namei: page_getlink() and page_follow_link_light() are the same thing
Get rid of some code duplication

06/11: don't put symlink bodies in pagecache into highmem
Bugfix for a long-standing mess.  For pagecache-based symlinks we end
up with kmap() of the body for the duration of traversal.  Which could take
a long time if we walk into e.g. slow automount along the way.  It's DoSable,
actually.  Not hard to fix - there's no reason to use GFP_HIGHUSER_MOVABLE
for those guys; GFP_USER serves just as well.

07/11: replace ->follow_link() with new method that could stay
Meat of the series - we switch to a new method (->get_link()) that
differs from ->follow_link() in getting dentry and inode separately; it
can be called in RCU mode (with NULL dentry) and it should bail out with
ERR_PTR(-ECHILD) if it needs non-RCU.  All instances converted, most of them
by making them bail out immediately in RCU mode.  Some are trivialy
RCU-safe, though; those do not bail out at all.

08/11: teach page_get_link() to work in RCU mode
09/11: teach shmem_get_link() to work in RCU mode
10/11: teach proc_self_get_link()/proc_thread_self_get_link()
11/11: teach nfs_get_link() to work in RCU mode
Teaching more instances to stay in RCU mode if they can.  (8) and
(11) are similar to what Neil had done back in March, except for the lack of
kmap mess to deal with - that's one of the benefits of having (6) done...

Missing, probably worth adding: XFS, overlayfs.  Maybe gfs2 - if it's
at all possible (not sure if it is).  Maybe autofs4 as well.

Procfs magical symlinks definitely are *not* worth trying to handle
in RCU mode - ->d_revalidate() on them is such that it'll kick us out of
RCU mode before we even see that it's a symlink, let alone try to follow it.

Any help with review and testing would be welcome.  FWIW, it seems to survive
the beating here.
--
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: [lkp] [rcu] 52b265325b: WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:61 internal_create_group+0x252/0x300()

2015-12-08 Thread Paul E. McKenney
On Wed, Dec 09, 2015 at 11:23:05AM +0800, kernel test robot wrote:
> FYI, we noticed the below changes on
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/dev
> commit 52b265325b7a7438cbcdd735fecdd9d7e255eb83 ("rcu: Remove TINY_RCU bloat 
> from pointless boot parameters")
> 
> 
> ++++
> || dc15c60e39 | 52b265325b |
> ++++
> | boot_successes | 4  | 0  |
> ++++

Should be fixed in commit 79cfea027387.

Thanx, Paul

> [0.206357] Performance Events: unsupported p6 CPU model 60 no PMU driver, 
> software events only.
> [0.209250] devtmpfs: initialized
> [0.211425] [ cut here ]
> [0.212045] WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:61 
> internal_create_group+0x252/0x300()
> [0.213475] BUG: unable to handle kernel paging request at 65746f6e
> [0.214456] IP: [] strnlen+0x9/0x20
> [0.215065] *pdpt =  *pde =  
> [0.215908] Oops:  [#1] 
> [0.216546] CPU: 0 PID: 1 Comm: swapper Not tainted 
> 4.4.0-rc2-00051-g52b2653 #1
> [0.217536] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> Debian-1.8.2-1 04/01/2014
> [0.218777] task: d443e040 ti: d444 task.ti: d444
> [0.219519] EIP: 0060:[] EFLAGS: 00010097 CPU: 0
> [0.220372] EIP is at strnlen+0x9/0x20
> [0.220885] EAX: 65746f6e EBX: c1fbd0ea ECX: 65746f6e EDX: fffe
> [0.221803] ESI: 65746f6e EDI: c1fbd4c0 EBP: d4441da8 ESP: d4441da8
> [0.222632]  DS: 007b ES: 007b FS:  GS: 00e0 SS: 0068
> [0.223387] CR0: 80050033 CR2: 65746f6e CR3: 01fb CR4: 000406b0
> [0.224101] Stack:
> [0.224360]  d4441dc4 c13b47bf  c1d40f67 c1fbd0ea d4441ed0 
> c1d40f68 d4441e08
> [0.225368]  c13b60cd   c106   
> 0282 c1fbd0e0
> [0.226434]  03e0 c1fbd4c0 c1d40f68 ff0a0004  03e0 
>  
> [0.227446] Call Trace:
> [0.227740]  [] string+0x2f/0xd0
> [0.228472]  [] vsnprintf+0xfd/0x440
> [0.228984]  [] ? console_unlock+0x55f/0x690
> [0.229650]  [] vscnprintf+0x16/0x40
> [0.230188]  [] vprintk_emit+0x10a/0x540
> [0.230736]  [] vprintk+0x35/0x40
> [0.231232]  [] warn_slowpath_common+0x6a/0xb0
> [0.231836]  [] ? internal_create_group+0x252/0x300
> [0.232504]  [] ? internal_create_group+0x252/0x300
> [0.233183]  [] warn_slowpath_fmt+0x2e/0x30
> [0.233814]  [] internal_create_group+0x252/0x300
> [0.234462]  [] sysfs_create_group+0xc/0x10
> [0.235038]  [] ksysfs_init+0x28/0x78
> [0.235574]  [] ? nsproxy_cache_init+0x27/0x27
> [0.236323]  [] do_one_initcall+0x175/0x188
> [0.237052]  [] ? parse_args+0x2bf/0x520
> [0.237744]  [] kernel_init_freeable+0xd9/0x156
> [0.238377]  [] ? kernel_init_freeable+0xd9/0x156
> [0.239010]  [] kernel_init+0xb/0xe0
> [0.239534]  [] ? schedule_tail+0xc/0x50
> [0.240084]  [] ret_from_kernel_thread+0x20/0x34
> [0.240914]  [] ? rest_init+0x70/0x70
> [0.241453] Code: 00 00 85 c9 74 11 55 89 e5 57 89 c7 89 d0 f2 ae 75 01 4f 
> 89 f8 5f 5d c3 8d 76 00 8d bc 27 00 00 00 00 55 89 c1 89 e5 89 c8 eb 06 <80> 
> 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 5d c3 90 90 90 90 90
> [0.244735] EIP: [] strnlen+0x9/0x20 SS:ESP 0068:d4441da8
> [0.245497] CR2: 65746f6e
> [0.246020] ---[ end trace 62c0b504e1bd3c01 ]---
> [0.246566] Kernel panic - not syncing: Fatal exception
> 
> 
> 
> 
> 
> Thanks,
> Ying Huang

> #
> # Automatically generated file; DO NOT EDIT.
> # Linux/i386 4.4.0-rc2 Kernel Configuration
> #
> # CONFIG_64BIT is not set
> CONFIG_X86_32=y
> CONFIG_X86=y
> CONFIG_INSTRUCTION_DECODER=y
> CONFIG_PERF_EVENTS_INTEL_UNCORE=y
> CONFIG_OUTPUT_FORMAT="elf32-i386"
> CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
> CONFIG_LOCKDEP_SUPPORT=y
> CONFIG_STACKTRACE_SUPPORT=y
> CONFIG_HAVE_LATENCYTOP_SUPPORT=y
> CONFIG_MMU=y
> CONFIG_NEED_DMA_MAP_STATE=y
> CONFIG_NEED_SG_DMA_LENGTH=y
> CONFIG_GENERIC_ISA_DMA=y
> CONFIG_GENERIC_BUG=y
> CONFIG_GENERIC_HWEIGHT=y
> CONFIG_ARCH_MAY_HAVE_PC_FDC=y
> CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> CONFIG_ARCH_HAS_CPU_RELAX=y
> CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
> CONFIG_HAVE_SETUP_PER_CPU_AREA=y
> CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
> CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
> CONFIG_ARCH_HIBERNATION_POSSIBLE=y
> CONFIG_ARCH_SUSPEND_POSSIBLE=y
> CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
> CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
> CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
> CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
> CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-ecx -fcall-saved-edx"
> CONFIG_ARCH_SUPPORTS_UPROBES=y
> CONFIG_FIX_EARLYCON_MEM=y
> CONFIG_PGTABLE_LEVELS=3
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> CONFIG_IRQ_WORK=y
> 

[PATCHv2 0/2] regmap: cache: Add 64-bit support.

2015-12-08 Thread Xiubo Li
Changed in v2:
- Just add blank line to shut checkpatch up.

Xiubo Li (2):
  regmap: cache: To suppress the noise of checkpatch
  regmap: cache: Add 64-bit mode support

 drivers/base/regmap/regcache.c | 21 +
 1 file changed, 21 insertions(+)

-- 
1.8.3.1


--
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/2] null_blk: Remove null block from list in error path

2015-12-08 Thread Minfei Huang
Ping.

Any comment is appreciate.

Thanks
Minfei

On 11/27/15 at 09:26pm, Minfei Huang wrote:
> To make consistent of null block list, we should remove enqueued null
> block from the list before freeing it.
> 
> Signed-off-by: Minfei Huang 
> ---
>  drivers/block/null_blk.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index ec99568..729ecd7 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -738,7 +738,7 @@ static int null_add_dev(void)
>   rv = nvm_register(nullb->q, nullb->disk_name,
>   _lnvm_dev_ops);
>   if (rv)
> - goto out_cleanup_blk_queue;
> + goto out_cleanup_blk_list;
>   goto done;
>   }
>  
> @@ -765,6 +765,10 @@ done:
>  out_cleanup_lightnvm:
>   if (use_lightnvm)
>   nvm_unregister(nullb->disk_name);
> +out_cleanup_blk_list:
> + mutex_lock();
> + list_del_init(>list);
> + mutex_unlock();
>  out_cleanup_blk_queue:
>   blk_cleanup_queue(nullb->q);
>  out_cleanup_tags:
> -- 
> 1.8.3.1
> 
> --
> 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/
--
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] Staging: speakup: varhandlers: cleanup of function spk_get_punc_var

2015-12-08 Thread Sudip Mukherjee
On Mon, Dec 07, 2015 at 06:35:11PM +0530, Saurabh Sengar wrote:
> This patch does the following:
> * changed the complicated if statements to simple case statements
> * in case of E_DEFAULT, no need to return error as ERESTART,
> because this is the user asked for. Hence function should return success.
> * ret variable is 0 always, hence removed it.
> * removed one ternary operator, as it was always returning the status value 
> only,
> and hence removed the status variable too

That becomes 4 different changes. Please break them into separate
patches.

regards
sudip
--
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: [for-next][PATCH 3/7] ftracetest: Add instance create and delete test

2015-12-08 Thread Michael Ellerman
On Wed, 2015-11-25 at 11:08 -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" 
> 
> Create a test to test instance creation and deletion. Several tasks are
> created that create 3 directories and delete them. The tasks all create the
> same directories. This places a stress on the code that creates and deletes
> instances.
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance.tc 
> b/tools/testing/selftests/ftrace/test.d/instances/instance.tc
> new file mode 100644
> index ..773e276ff90b
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/instances/instance.tc
> @@ -0,0 +1,90 @@



> +instance_slam &
> +x=`jobs -l | tail -1`
> +p5=`echo $x | cut -d' ' -f2`
> +echo $p5
> +
> +ls -lR >/dev/null
> +sleep 1
> +
> +kill -1 $p1
> +kill -1 $p2
> +kill -1 $p3
> +kill -1 $p4
> +kill -1 $p5

Tells me:

./ftracetest: 72: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | 
job]... or
kill -l [exitstatus]

And the test hangs forever.

I suspect because my /bin/sh is dash?

# /bin/dash
# kill -1
/bin/dash: 1: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | 
job]... or
kill -l [exitstatus]


cheers

--
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/


[PATCHv2 2/2] regmap: cache: Add 64-bit mode support

2015-12-08 Thread Xiubo Li
Since the mmio has support the 64-bit has been supported for the
64-bit platform, so should the regcache core too.

Signed-off-by: Xiubo Li 
---
 drivers/base/regmap/regcache.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 3cb8c59..1c0210a 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -551,6 +551,14 @@ bool regcache_set_val(struct regmap *map, void *base, 
unsigned int idx,
cache[idx] = val;
break;
}
+#ifdef CONFIG_64BIT
+   case 8: {
+   u64 *cache = base;
+
+   cache[idx] = val;
+   break;
+   }
+#endif
default:
BUG();
}
@@ -584,6 +592,13 @@ unsigned int regcache_get_val(struct regmap *map, const 
void *base,
 
return cache[idx];
}
+#ifdef CONFIG_64BIT
+   case 8: {
+   const u64 *cache = base;
+
+   return cache[idx];
+   }
+#endif
default:
BUG();
}
-- 
1.8.3.1


--
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/


[PATCHv2 1/2] regmap: cache: To suppress the noise of checkpatch

2015-12-08 Thread Xiubo Li
There will be some warning like the following when checking new
patches near this code:
"WARNING: Missing a blank line after declarations"
This patch will suppress this warning.

Signed-off-by: Xiubo Li 
---
 drivers/base/regmap/regcache.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 4c07802..3cb8c59 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -535,16 +535,19 @@ bool regcache_set_val(struct regmap *map, void *base, 
unsigned int idx,
switch (map->cache_word_size) {
case 1: {
u8 *cache = base;
+
cache[idx] = val;
break;
}
case 2: {
u16 *cache = base;
+
cache[idx] = val;
break;
}
case 4: {
u32 *cache = base;
+
cache[idx] = val;
break;
}
@@ -568,14 +571,17 @@ unsigned int regcache_get_val(struct regmap *map, const 
void *base,
switch (map->cache_word_size) {
case 1: {
const u8 *cache = base;
+
return cache[idx];
}
case 2: {
const u16 *cache = base;
+
return cache[idx];
}
case 4: {
const u32 *cache = base;
+
return cache[idx];
}
default:
-- 
1.8.3.1


--
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/2] ARM: dts: exynos542x: add GSCL block parent clock management to pm domain

2015-12-08 Thread Krzysztof Kozlowski
On 08.12.2015 22:46, Marek Szyprowski wrote:
> Add support for restoring GScaler parent clocks configuration when GSCL
> power domain is turned on.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  arch/arm/boot/dts/exynos5420.dtsi | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
> b/arch/arm/boot/dts/exynos5420.dtsi
> index 48a0a55..912143e 100644
> --- a/arch/arm/boot/dts/exynos5420.dtsi
> +++ b/arch/arm/boot/dts/exynos5420.dtsi
> @@ -252,8 +252,10 @@
>   compatible = "samsung,exynos4210-pd";
>   reg = <0x10044000 0x20>;
>   #power-domain-cells = <0>;
> - clocks = < CLK_GSCL0>, < CLK_GSCL1>;
> - clock-names = "asb0", "asb1";
> + clocks = < CLK_FIN_PLL>, < 
> CLK_MOUT_SW_ACLK300_GSCL>,
> + < CLK_MOUT_USER_ACLK300_GSCL>, < CLK_GSCL0>,
> + < CLK_GSCL1>;
> + clock-names = "oscclk", "pclk0", "clk0", "asb0", "asb1";

The pclkN name is not used.

Best regards,
Krzysztof

--
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/2] clk: samsung: exynos5422: add missing parent GSCL block clocks

2015-12-08 Thread Krzysztof Kozlowski
On 08.12.2015 22:46, Marek Szyprowski wrote:
> This patch adds clocks, which are required for preserving parent clock
> configuration on GSCL power domain on/off.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/clk/samsung/clk-exynos5420.c   | 8 
>  include/dt-bindings/clock/exynos5420.h | 2 ++
>  2 files changed, 6 insertions(+), 4 deletions(-)

I suppose that, with ack from clock folks, this can go through samsung-soc?

Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof
--
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] PCI: dra7xx: mark dra7xx_pcie_msi irq as IRQF_NO_THREAD

2015-12-08 Thread Pratyush Anand
On Tue, Dec 8, 2015 at 2:53 PM, Lucas Stach  wrote:
> Hi Bjorn,
>
> Am Montag, den 07.12.2015, 21:33 -0600 schrieb Bjorn Helgaas:
>> [+cc Jingoo (exynos), Richard, Lucas (imx6), Pratyush (spear13xx)]
>>
>> On Fri, Dec 04, 2015 at 11:22:50PM +0200, Grygorii Strashko wrote:
>> > On 12/04/2015 08:46 PM, Bjorn Helgaas wrote:
>> > > Hi Grygorii,
> [...]
>> > >>
>> > >> +/*
>> > >> + * Mark dra7xx_pcie_msi IRQ as IRQF_NO_THREAD
>> > >> + * On -RT and if kernel is booting with "threadirqs" cmd line 
>> > >> parameter
>> > >> + * the dra7xx_pcie_msi_irq_handler() will be forced threaded 
>> > >> but,
>> > >> + * in the same time, it's IRQ dispatcher and calls 
>> > >> generic_handle_irq(),
>> > >> + * which, in turn, will be resolved to handle_simple_irq() 
>> > >> call.
>> > >> + * The handle_simple_irq() expected to be called with IRQ 
>> > >> disabled, as
>> > >> + * result kernle will display warning:
>> > >> + * "irq XXX handler YYY+0x0/0x14 enabled interrupts".
>> > >> + */
>> > >>  ret = devm_request_irq(>dev, pp->irq,
>> > >> -   dra7xx_pcie_msi_irq_handler, 
>> > >> IRQF_SHARED,
>> > >> +   dra7xx_pcie_msi_irq_handler,
>> > >> +   IRQF_SHARED | IRQF_NO_THREAD,
>> > >> "dra7-pcie-msi", pp);
>> > >
>> > > There's similar code in exynos_add_pcie_port(), imx6_add_pcie_port(),
>> > > and spear13xx_add_pcie_port().  Do they need similar changes?  If not,
>> > > why not?
>> > >
>> > > I see your discussion about DRA7 hardware design, but my impression is
>> > > that this problem affects anybody who calls dw_handle_msi_irq() from a
>> > > handler registered with IRQF_SHARED.
>> >
>> > Issue fixed by this patch is not related to IRQF_SHARED.
>> > It will happen on -RT or if kernel will boot with "threadirqs" cmd line 
>> > parameter
>> > - in both cases these PCI IRQ handlers will be forced to be threaded and,
>> > as result, generic_handle_irq() will produce above backtrace.
>> >
>> > Personally, I don't have strong opinion about "should similar change be 
>> > applied
>> > to other PCI drivers or not?" And I think, that owners of those driver 
>> > should
>> > make such decision.
>>
>> If the same issue affects several drivers, I'd like to see them all
>> handle it the same way.  Otherwise, somebody coming along later will
>> wonder why they're different, and there won't be a good answer.
>>
>> I cc'd the other maintainers to see what they think.
>>

I too agree with the change for SPEAr13xx as well.

~Pratyush
--
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] clk: samsung: exynos542x: fix MFC clock hierarchy parent

2015-12-08 Thread Krzysztof Kozlowski
On 08.12.2015 22:29, Marek Szyprowski wrote:
> Proper source for MFC block is mout_user_aclk333 (in datasheet named
> USER_MUX_ACLK_333), not the output of CLKDIV_ACLK_333 MUX.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/clk/samsung/clk-exynos5420.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Indeed:
Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof

--
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 07/12] x86/entry/64: Always run ptregs-using syscalls on the slow path

2015-12-08 Thread Brian Gerst
On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski  wrote:
> 64-bit syscalls currently have an optimization in which they are
> called with partial pt_regs.  A small handful require full pt_regs.
>
> In the 32-bit and compat cases, I cleaned this up by forcing full
> pt_regs for all syscalls.  The performance hit doesn't really matter.
>
> I want to clean up the 64-bit case as well, but I don't want to hurt
> fast path performance.  To do that, I want to force the syscalls
> that use pt_regs onto the slow path.  This will enable us to make
> slow path syscalls be real ABI-compliant C functions.
>
> Use the new syscall entry qualification machinery for this.
> stub_clone is now stub_clone/ptregs.
>
> The next patch will eliminate the stubs, and we'll just have
> sys_clone/ptregs.
>
> Signed-off-by: Andy Lutomirski 

Fails to boot, bisected to this patch:
[   32.675319] kernel BUG at kernel/auditsc.c:1504!
[   32.675325] invalid opcode:  [#65] SMP
[   32.675328] Modules linked in:
[   32.675333] CPU: 1 PID: 216 Comm: systemd-cgroups Tainted: G  D
4.3.0-rc4+ #7
[   32.675336] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[   32.675339] task: 88075340 ti: 88003652 task.ti:
88003652
[   32.675350] RIP: 0010:[]  []
__audit_syscall_entry+0xcd/0xf0
[   32.675353] RSP: 0018:880036523ef0  EFLAGS: 00010202
[   32.675355] RAX: 000c RBX: 8800797b3000 RCX: 7ffef8504e88
[   32.675357] RDX: 56172f37cfd0 RSI:  RDI: 000c
[   32.675359] RBP: 880036523f00 R08: 0001 R09: 88075340
[   32.675361] R10:  R11: 0001 R12: 
[   32.675363] R13: c03e R14: 0001 R15: 1000
[   32.675380] FS:  7f02b4ff48c0() GS:88007fc8()
knlGS:
[   32.675383] CS:  0010 DS:  ES:  CR0: 8005003b
[   32.675385] CR2: 7f93d47ea0e0 CR3: 36aa9000 CR4: 06e0
[   32.675391] Stack:
[   32.675396]  880036523f58  880036523f10
8100321b
[   32.675401]  880036523f48 81003ad0 56172f374040
7f93d45c9990
[   32.675404]  0001 0001 1000
000a
[   32.675405] Call Trace:
[   32.675414]  [] do_audit_syscall_entry+0x4b/0x70
[   32.675420]  [] syscall_trace_enter_phase2+0x110/0x1d0
[   32.675425]  [] tracesys+0x3a/0x96
[   32.675464] Code: 00 00 00 00 e8 a5 e0 fc ff c7 43 04 01 00 00 00
48 89 43 18 48 89 53 20 44 89 63 0c c7 83 94 02 00 00 00 00 00 00 5b
41 5c 5d c3 <0f> 0b 48 c7 43 50 00 00 00 00 48 c7 c2 60 b4 c5 81 48 89
de 4c
[   32.675469] RIP  [] __audit_syscall_entry+0xcd/0xf0
[   32.675471]  RSP 

--
Brian Gerst
--
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 1/5] PCI: designware: add memory barrier after enabling region

2015-12-08 Thread Pratyush Anand
On Tue, Dec 8, 2015 at 2:31 PM, Stanimir Varbanov
 wrote:
>
> On 12/03/2015 03:35 PM, Stanimir Varbanov wrote:
> > Add 'write memory' barrier after enable region in PCIE_ATU_CR2
> > register. The barrier is needed to ensure that the region enable
> > request has been reached it's destination at time when we
> > read/write to PCI configuration space.
> >
> > Without this barrier PCI device enumeration during kernel boot
> > is not reliable, and reading configuration space for particular
> > PCI device on the bus returns zero aka no device.
>
> Anand, Jingoo, what is your opinion?
>
> >
> > Signed-off-by: Stanimir Varbanov 
> > ---
> >  drivers/pci/host/pcie-designware.c |5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/pci/host/pcie-designware.c 
> > b/drivers/pci/host/pcie-designware.c
> > index 02a7452bdf23..ed4dc2e2553b 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -164,6 +164,11 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port 
> > *pp, int index,
> >   dw_pcie_writel_rc(pp, upper_32_bits(pci_addr), PCIE_ATU_UPPER_TARGET);
> >   dw_pcie_writel_rc(pp, type, PCIE_ATU_CR1);
> >   dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> > + /*
> > +  * ensure that the ATU enable has been happaned before accessing
> > +  * pci configuration/io spaces through dw_pcie_cfg_[read|write].
> > +  */
> > + wmb();
> >  }
> >


My understnading is that since writel() of dw_pcie_writel_rc() in
above code and readl(), writel() of dw_pcie_cfg_[read|write]() (which
will follow) goes through same device (ie PCIe host here). So, it is
guaranteed that 1st writel() will be executed before later
readl()/writel(). If that is true then we do not need any explicit
barrier here.

Arnd, Russel: whats your opinion here.

~Pratyush
--
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] chelsio: constify cmac_ops structures

2015-12-08 Thread David Miller
From: Julia Lawall 
Date: Tue,  8 Dec 2015 21:42:09 +0100

> The cmac_ops structures are never modified, so declare them as const.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall 

Applied, 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 v10.1 14/17] drm: bridge: analogix/dp: try force hpd after plug in lookup failed

2015-12-08 Thread Rob Herring
On Wed, Dec 09, 2015 at 10:10:39AM +0800, Yakir Yang wrote:
> Some edp screen do not have hpd signal, so we can't just return
> failed when hpd plug in detect failed.
> 
> This is an hardware property, so we need add a devicetree property
> "analogix,need-force-hpd" to indicate this sutiation.
> 
> Signed-off-by: Yakir Yang 
> Tested-by: Javier Martinez Canillas 

Acked-by: Rob Herring 

> ---
> Changes in v10.1:
> - Rename the "analogix,need-force-hpd" to common 'force-hpd' (Rob)
> 
> Changes in v9: None
> Changes in v8: None
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3:
> - Add "analogix,need-force-hpd" to indicate whether driver need foce
>   hpd when hpd detect failed.
> 
> Changes in v2: None
> 
>  .../bindings/display/bridge/analogix_dp.txt|  4 ++-
>  .../bindings/display/exynos/exynos_dp.txt  |  1 +
>  .../display/rockchip/analogix_dp-rockchip.txt  |  1 +
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 35 
> ++
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  2 ++
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  |  9 ++
>  6 files changed, 46 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt 
> b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> index 7659a7a..4f2ba8c 100644
> --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> @@ -22,6 +22,9 @@ Required properties for dp-controller:
>   from general PHY binding: Should be "dp".
>  
>  Optional properties for dp-controller:
> + -force-hpd:
> + Indicate driver need force hpd when hpd detect failed, this
> + is used for some eDP screen which don't have hpd signal.
>   -hpd-gpios:
>   Hotplug detect GPIO.
>   Indicates which GPIO should be used for hotplug detection
> @@ -31,7 +34,6 @@ Optional properties for dp-controller:
>   * Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
>   * 
> Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
>  
> -
>  [1]: Documentation/devicetree/bindings/media/video-interfaces.txt
>  
> ---
>  
> diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt 
> b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> index 9905081..8800164 100644
> --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> @@ -41,6 +41,7 @@ For the below properties, please refer to Analogix DP 
> binding document:
>   -phys (required)
>   -phy-names (required)
>   -hpd-gpios (optional)
> + -analogix,need-force-hpd (optional)
>   -video interfaces (optional)
>  
>  Deprecated properties for DisplayPort:
> diff --git 
> a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt 
> b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
> index dae86c4..187a708e 100644
> --- 
> a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
> +++ 
> b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
> @@ -32,6 +32,7 @@ For the below properties, please refer to Analogix DP 
> binding document:
>  - phys (required)
>  - phy-names (required)
>  - hpd-gpios (optional)
> +- force-hpd (optional)
>  
> ---
>  
>  Example:
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index a11504b..00aee44 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -59,15 +59,38 @@ static int analogix_dp_detect_hpd(struct 
> analogix_dp_device *dp)
>  {
>   int timeout_loop = 0;
>  
> - while (analogix_dp_get_plug_in_status(dp) != 0) {
> + while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) {
> + if (analogix_dp_get_plug_in_status(dp) == 0)
> + return 0;
> +
>   timeout_loop++;
> - if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
> - dev_err(dp->dev, "failed to get hpd plug status\n");
> - return -ETIMEDOUT;
> - }
>   usleep_range(10, 11);
>   }
>  
> + /*
> +  * Some edp screen do not have hpd signal, so we can't just
> +  * return failed when hpd plug in detect failed, DT property
> +  * "need-force-hpd" would indicate whether driver need this.
> +  */
> + if (!dp->force_hpd)
> + return -ETIMEDOUT;
> +
> + /*
> +  * The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH
> +  * will 

Re: [RFC PATCH 01/15] PM / devfreq: exynos: Add generic exynos bus frequency driver

2015-12-08 Thread Anand Moon
Hi Chanwoo,

On 9 December 2015 at 09:41, Chanwoo Choi  wrote:
> Hi Anand,
>
> On 2015년 11월 27일 09:34, Chanwoo Choi wrote:
>> Hi Anand,
>>
>> On 2015년 11월 27일 02:17, Anand Moon wrote:
>>> Hi Chanwoo,
>>>
>>> On 26 November 2015 at 21:42, Chanwoo Choi  wrote:
 On Thu, Nov 26, 2015 at 11:00 PM, MyungJoo Ham  
 wrote:
> On Thu, Nov 26, 2015 at 10:47 PM, Chanwoo Choi  
> wrote:
>> This patch adds the generic exynos bus frequency driver for AMBA AXI bus
>> of sub-blocks in exynos SoC with DEVFREQ framework. The Samsung Exynos 
>> SoC
>> have the common architecture for bus between DRAM and sub-blocks in SoC.
>> This driver can support the generic bus frequency driver for Exynos SoCs.
>>
>> In devicetree, Each bus block has a bus clock, regulator, operation-point
>> and devfreq-event devices which measure the utilization of each bus 
>> block.
>>
>> Signed-off-by: Chanwoo Choi 
>> ---
>>  drivers/devfreq/Kconfig |  15 ++
>>  drivers/devfreq/Makefile|   1 +
>>  drivers/devfreq/exynos/Makefile |   1 +
>>  drivers/devfreq/exynos/exynos-bus.c | 443 
>> 
>>  4 files changed, 460 insertions(+)
>>  create mode 100644 drivers/devfreq/exynos/exynos-bus.c
>>
>
> Are we finally getting a common Exynos bus driver with full DT support?
> (can this replace both Exynos4/5 drivers and support Exynos7 series?)

 Yes.
 This patch-set would support all Exynos SoCs for bus frequency driver.
 To make sure the support for Exynos7 series, I need to check the TRM
 document of Exynos7.  I think it is possible for support Exynos7.

 I'm going to test this driver on various Exynos-based board.

 Regards,
 Chanwoo Choi
>>>
>>> Please do consider Exynos 542x series as well.
>>
>> Sure. I'll to test it on Exynos5422-based Odroid-XU3.
>
> I send the v2 patchset but this patchset don't include
> the support of Odroid-XU3 because of only Exynos542x has the
> special addtional sequence to change the source clock
> of DRAM. So, I'm going to support the bus frequency on Exynos542x.
> After completing it, I'll send the separate patches.
>
> Thanks,
> Chanwoo Choi
>

Not an issue. Thanks for the update.

-Anand Moon
--
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] null_blk: Fix error path in module initialization

2015-12-08 Thread Minfei Huang
On 12/08/15 at 01:48pm, Jens Axboe wrote:
> On 12/08/2015 05:35 AM, Minfei Huang wrote:
> >Ping.
> >
> >Any comment is appreciate.
> 
> Applied, it is indeed pretty broken after the lightnvm update.
> I killed the use_lightnvm check before kmem_cache_destroy, that's
> not needed.

Agreed.

Thanks
Minfei
--
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 02/19] PM / devfreq: exynos: Add documentation for generic exynos bus frequency driver

2015-12-08 Thread Chanwoo Choi
This patch adds the documentation for generic exynos bus frequency
driver.

Signed-off-by: Chanwoo Choi 
---
 .../devicetree/bindings/devfreq/exynos-bus.txt | 94 ++
 1 file changed, 94 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/devfreq/exynos-bus.txt

diff --git a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt 
b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
new file mode 100644
index ..54a1f9c46c88
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
@@ -0,0 +1,94 @@
+* Generic Exynos Bus frequency device
+
+The Samsung Exynos SoC have many buses for data transfer between DRAM
+and sub-blocks in SoC. Almost Exynos SoC have the common architecture
+for buses. Generally, the each bus of Exynos SoC includes the source clock
+and power line and then is able to change the clock according to the usage
+of each buses on runtime. When gathering the usage of each buses on runtime,
+thie driver uses the PPMU (Platform Performance Monitoring Unit) which
+is able to measure the current load of sub-blocks.
+
+There are a little different composition among Exynos SoC because each Exynos
+SoC has the different sub-blocks. So, this difference should be specified
+in devicetree file instead of each device driver. In result, this driver
+is able to support the bus frequency for all Exynos SoCs.
+
+Required properties for bus device:
+- compatible: Should be "samsung,exynos-bus".
+- clock-names : the name of clock used by the bus, "bus".
+- clocks : phandles for clock specified in "clock-names" property.
+- #clock-cells: should be 1.
+- operating-points-v2: the OPP table including frequency/voltage information
+  to support DVFS (Dynamic Voltage/Frequency Scaling) feature.
+- vdd-supply: the regulator to provide the buses with the voltage.
+- devfreq-events: the devfreq-event device to monitor the curret utilization
+  of buses.
+
+Optional properties for bus device:
+- exynos,saturation-ratio: the percentage value which is used to calibrate
+   the performance count againt total cycle count.
+
+Example1:
+   Show the AXI buses of Exynos3250 SoC. Exynos3250 divides the buses to
+   power line (regulator). The MIF (Memory Interface) AXI bus is used to
+   transfer data between DRAM and CPU and uses the VDD_MIF regualtor.
+
+   - power line(VDD_MIF) --> bus for DMC (Dynamic Memory Controller) block
+
+   - MIF bus's frequency/voltage table
+   ---
+   |Lv| Freq   | Voltage |
+   ---
+   |L1| 5  |80   |
+   |L2| 10 |80   |
+   |L3| 134000 |80   |
+   |L4| 20 |80   |
+   |L5| 40 |875000   |
+   ---
+
+Example2 :
+   The bus of DMC (Dynamic Memory Controller) block in exynos3250.dtsi
+   are listed below:
+
+   bus_dmc: bus_dmc {
+   compatible = "samsung,exynos-bus";
+   clocks = <_dmc CLK_DIV_DMC>;
+   clock-names = "bus";
+   operating-points-v2 = <_dmc_opp_table>;
+   status = "disabled";
+   };
+
+   bus_dmc_opp_table: opp_table0 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <5000>;
+   opp-microvolt = <80>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <80>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <80>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <80>;
+   };
+   opp04 {
+   opp-hz = /bits/ 64 <4>;
+   opp-microvolt = <875000>;
+   };
+   };
+
+   Usage case to handle the frequency and voltage of bus on runtime
+   in exynos3250-rinato.dts are listed below:
+
+   _dmc {
+   devfreq-events = <_dmc0_3>, <_dmc1_3>;
+   vdd-supply = <_reg>;  /* VDD_MIF */
+   status = "okay";
+   };
-- 
1.9.1

--
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 10/19] PM / devfreq: exynos: Add the detailed correlation between sub-blocks and power line

2015-12-08 Thread Chanwoo Choi
This patch adds the detailed corrleation between sub-blocks and power line
for Exynos3250, Exynos4210 and Exynos4x12.

Signed-off-by: Chanwoo Choi 
---
 .../devicetree/bindings/devfreq/exynos-bus.txt | 51 ++
 1 file changed, 51 insertions(+)

diff --git a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt 
b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
index c4fdc70f8eac..ed639c4f6466 100644
--- a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
+++ b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
@@ -33,6 +33,57 @@ Optional properties for only parent bus device:
 - exynos,saturation-ratio: the percentage value which is used to calibrate
the performance count againt total cycle count.
 
+Detailed correlation between sub-blocks and power line according to Exynos SoC:
+- In case of Exynos3250, there are two power line as following:
+   VDD_MIF |--- DMC
+
+   VDD_INT |--- LEFTBUS (parent device)
+   |--- PERIL
+   |--- MFC
+   |--- G3D
+   |--- RIGHTBUS
+   |--- PERIR
+   |--- FSYS
+   |--- LCD0
+   |--- PERIR
+   |--- ISP
+   |--- CAM
+
+- In case of Exynos4210, there is one power line as following:
+   VDD_INT |--- DMC (parent device)
+   |--- LEFTBUS
+   |--- PERIL
+   |--- MFC(L)
+   |--- G3D
+   |--- TV
+   |--- LCD0
+   |--- RIGHTBUS
+   |--- PERIR
+   |--- MFC(R)
+   |--- CAM
+   |--- FSYS
+   |--- GPS
+   |--- LCD0
+   |--- LCD1
+
+- In case of Exynos4x12, there are two power line as following:
+   VDD_MIF |--- DMC
+
+   VDD_INT |--- LEFTBUS (parent device)
+   |--- PERIL
+   |--- MFC(L)
+   |--- G3D
+   |--- TV
+   |--- IMAGE
+   |--- RIGHTBUS
+   |--- PERIR
+   |--- MFC(R)
+   |--- CAM
+   |--- FSYS
+   |--- GPS
+   |--- LCD0
+   |--- ISP
+
 Example1:
Show the AXI buses of Exynos3250 SoC. Exynos3250 divides the buses to
power line (regulator). The MIF (Memory Interface) AXI bus is used to
-- 
1.9.1

--
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 17/19] ARM: dts: Add support of bus frequency using VDD_INT for exynos3250-rinato

2015-12-08 Thread Chanwoo Choi
This patch adds the bus device-tree node of INT (internal) block
to enable the bus frequency. The following sub-blocks share
the VDD_INT power source:
- LEFTBUS (parent device)
- RIGHTBUS
- PERIL
- LCD0
- FSYS
- MCUISP / ISP
- MFC

The LEFTBUS is parent device with devfreq ondemand governor
and the rest devices has the dependency on LEFTBUS bus.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos3250-rinato.dts | 41 +
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts 
b/arch/arm/boot/dts/exynos3250-rinato.dts
index 61477943015b..3a6ca68b68c3 100644
--- a/arch/arm/boot/dts/exynos3250-rinato.dts
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -681,6 +681,47 @@
status = "okay";
 };
 
+_leftbus {
+   devfreq-events = <_leftbus_3>, <_rightbus_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
+_rightbus {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_lcd0 {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_fsys {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_mcuisp {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_isp {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_peril {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_mfc {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
  {
clock-frequency = <2400>;
 };
-- 
1.9.1

--
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 08/19] PM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor

2015-12-08 Thread Chanwoo Choi
This patch adds the support of bus frequency feature for sub-blocks which share
the one power line. If each bus depends on the power line, each bus is not able
to change the voltage by oneself. To optimize the power-consumption on runtime,
some buses using the same power line should change the source clock and
regulator at the same time. So, this patch uses the passive governor to support
the bus frequency for all buses which sharing the one power line.

For example,

Exynos3250 include the two power line for AXI buses as following:
: VDD_MIF : MIF (Memory Interface) provide the DMC (Dynamic Memory Controller)
  with the power (regulator).
: VDD_INT : INT (Internal) provide the various sub-blocks with the power
  (regulator).

Each bus is included in as follwoing block. In the case of VDD_MIF, only DMC bus
use the power line. So, there is no any depencency between buese. But, in the
case of VDD_INT, various buses share the one power line of VDD_INT. We need to
make the depenency between buses. When using passive governor, there is no
problem to support the bus frequency as DVFS for all buses. One bus should be
operated as the parent bus device which gathering the current load of INT block
and then decides the new frequency with some governors except of passive
governor. After deciding the new frequency by the parent bus device, the rest
bus devices will change the each source clock according to new frequency of the
parent bus device.

- MIF (Memory Interface) block
: VDD_MIF |--- DMC

- INT (Internal) block
: VDD_INT |--- LEFTBUS (parent)
  |--- PERIL
  |--- MFC
  |--- G3D
  |--- RIGHTBUS
  |--- FSYS
  |--- LCD0
  |--- PERIR
  |--- ISP
  |--- CAM

Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/Kconfig |   1 +
 drivers/devfreq/exynos/exynos-bus.c | 170 
 2 files changed, 136 insertions(+), 35 deletions(-)

diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index d03f635a93e1..88f7cc4539b8 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -79,6 +79,7 @@ config ARM_EXYNOS_BUS_DEVFREQ
bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"
depends on ARCH_EXYNOS
select DEVFREQ_GOV_SIMPLE_ONDEMAND
+   select DEVFREQ_GOV_PASSIVE
select DEVFREQ_EVENT_EXYNOS_PPMU
select PM_DEVFREQ_EVENT
select PM_OPP
diff --git a/drivers/devfreq/exynos/exynos-bus.c 
b/drivers/devfreq/exynos/exynos-bus.c
index f1bc20839650..2efc2bba757e 100644
--- a/drivers/devfreq/exynos/exynos-bus.c
+++ b/drivers/devfreq/exynos/exynos-bus.c
@@ -91,7 +91,7 @@ static int exynos_bus_get_event(struct exynos_bus *bus,
 }
 
 /*
- * Must necessary function for devfreq governor
+ * Must necessary function for devfreq simple-ondemand governor
  */
 static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 
flags)
 {
@@ -205,57 +205,74 @@ static void exynos_bus_exit(struct device *dev)
dev_pm_opp_of_remove_table(dev);
 }
 
-static int exynos_bus_parse_of(struct device_node *np,
- struct exynos_bus *bus)
+/*
+ * Must necessary function for devfreq passive governor
+ */
+static int exynos_bus_passive_target(struct device *dev, unsigned long *freq,
+   u32 flags)
 {
-   struct device *dev = bus->dev;
-   unsigned long rate;
-   int i, ret, count, size;
+   struct exynos_bus *bus = dev_get_drvdata(dev);
+   struct dev_pm_opp *new_opp;
+   unsigned long old_freq, new_freq;
+   int ret = 0;
 
-   /* Get the clock to provide each bus with source clock */
-   bus->clk = devm_clk_get(dev, "bus");
-   if (IS_ERR(bus->clk)) {
-   dev_err(dev, "failed to get bus clock\n");
-   return PTR_ERR(bus->clk);
+   /* Get new opp-bus instance according to new bus clock */
+   rcu_read_lock();
+   new_opp = devfreq_recommended_opp(dev, freq, flags);
+   if (IS_ERR_OR_NULL(new_opp)) {
+   dev_err(dev, "failed to get recommed opp instance\n");
+   rcu_read_unlock();
+   return PTR_ERR(new_opp);
}
 
-   ret = clk_prepare_enable(bus->clk);
-   if (ret < 0) {
-   dev_err(dev, "failed to get enable clock\n");
-   return ret;
-   }
+   new_freq = dev_pm_opp_get_freq(new_opp);
+   old_freq = dev_pm_opp_get_freq(bus->curr_opp);
+   rcu_read_unlock();
 
-   /* Get the freq/voltage OPP table to scale the bus frequency */
-   rcu_read_lock();
-   ret = dev_pm_opp_of_add_table(dev);
+   if (old_freq == new_freq)
+   return 0;
+
+   /* Change the frequency according to new OPP level */
+   mutex_lock(>lock);
+
+   ret = clk_set_rate(bus->clk, new_freq);
if (ret < 0) {
-   dev_err(dev, "failed to get OPP table\n");
-   rcu_read_unlock();
-   return ret;
+ 

[Questions] perf c2c: What's the current status of perf c2c?

2015-12-08 Thread Yunlong Song
Hi, Don,
I am interested in the perf c2c tool, which is introduced in: 
http://lwn.net/Articles/588866/
However, I found that this tool has not been applied to the mainline tree of 
perf, Why? It was first
introduced in Feb. 2014. What's its current status now? Does it have a new 
version or a repository
somewhere else? And does it support Haswell?

-- 
Thanks,
Yunlong Song

--
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 04/19] ARM: dts: Add DMC bus frequency for exynos3250-rinato/monk

2015-12-08 Thread Chanwoo Choi
This patch adds the DMC (Dynamic Memory Controller) bus frequency node
which includes the devfreq-events and regulator properties. The bus
frequency support the DVFS (Dynamic Voltage Frequency Scaling) feature
with ondemand governor.

The devfreq-events (ppmu_dmc0*) can monitor the utilization of DMC bus
on runtime and the buck1_reg (VDD_MIF power line) supplies the power to
the DMC block.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos3250-monk.dts   | 6 ++
 arch/arm/boot/dts/exynos3250-rinato.dts | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250-monk.dts 
b/arch/arm/boot/dts/exynos3250-monk.dts
index 443a35085846..d982586a6533 100644
--- a/arch/arm/boot/dts/exynos3250-monk.dts
+++ b/arch/arm/boot/dts/exynos3250-monk.dts
@@ -498,6 +498,12 @@
};
 };
 
+_dmc {
+   devfreq-events = <_dmc0_3>, <_dmc1_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
  {
clock-frequency = <2400>;
 };
diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts 
b/arch/arm/boot/dts/exynos3250-rinato.dts
index 3e64d5dcdd60..61477943015b 100644
--- a/arch/arm/boot/dts/exynos3250-rinato.dts
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -675,6 +675,12 @@
};
 };
 
+_dmc {
+   devfreq-events = <_dmc0_3>, <_dmc1_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
  {
clock-frequency = <2400>;
 };
-- 
1.9.1

--
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 07/19] PM / devfreq: Show the related information according to governor type

2015-12-08 Thread Chanwoo Choi
This patch modifies the following sysfs entry of DEVFREQ framework
because the devfreq device using passive governor don't need the same
information of the devfreq device using rest governor.
- polling_interval: passive gov don't use the sampling rate.
- available_governors : passive gov don't be changed on runtime in this version.
- trans_stat  : passive governor don't support trans_stat in this 
version.

Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/devfreq.c | 31 +--
 drivers/devfreq/governor.h|  7 +++
 drivers/devfreq/governor_passive.c|  1 +
 drivers/devfreq/governor_performance.c|  1 +
 drivers/devfreq/governor_powersave.c  |  1 +
 drivers/devfreq/governor_simpleondemand.c |  1 +
 drivers/devfreq/governor_userspace.c  |  1 +
 include/linux/devfreq.h   |  2 ++
 8 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 78ea4cdaa82c..18ad956fec93 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -597,7 +597,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
goto err_init;
}
 
-   if (!strncmp(devfreq->governor_name, "passive", 7)) {
+   if (devfreq->governor->type == DEVFREQ_GOV_PASSIVE) {
struct devfreq *parent_devfreq =
((struct devfreq_passive_data *)data)->parent;
 
@@ -963,13 +963,23 @@ static ssize_t available_governors_show(struct device *d,
struct device_attribute *attr,
char *buf)
 {
-   struct devfreq_governor *tmp_governor;
+   struct devfreq *devfreq = to_devfreq(d);
ssize_t count = 0;
 
mutex_lock(_list_lock);
-   list_for_each_entry(tmp_governor, _governor_list, node)
+   if (devfreq->governor->type == DEVFREQ_GOV_PASSIVE) {
count += scnprintf([count], (PAGE_SIZE - count - 2),
-  "%s ", tmp_governor->name);
+  "%s ", devfreq->governor->name);
+   } else {
+   struct devfreq_governor *tmp_governor;
+
+   list_for_each_entry(tmp_governor, _governor_list, node) 
{
+   if (tmp_governor->type == DEVFREQ_GOV_PASSIVE)
+   continue;
+   count += scnprintf([count], (PAGE_SIZE - count - 2),
+  "%s ", tmp_governor->name);
+   }
+   }
mutex_unlock(_list_lock);
 
/* Truncate the trailing space */
@@ -1006,6 +1016,11 @@ static DEVICE_ATTR_RO(target_freq);
 static ssize_t polling_interval_show(struct device *dev,
 struct device_attribute *attr, char *buf)
 {
+   struct devfreq *df = to_devfreq(dev);
+
+   if (df->governor->type == DEVFREQ_GOV_PASSIVE)
+   return sprintf(buf, "Not Supported.\n");
+
return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms);
 }
 
@@ -1020,6 +1035,9 @@ static ssize_t polling_interval_store(struct device *dev,
if (!df->governor)
return -EINVAL;
 
+   if (df->governor->type == DEVFREQ_GOV_PASSIVE)
+   return -EINVAL;
+
ret = sscanf(buf, "%u", );
if (ret != 1)
return -EINVAL;
@@ -1137,11 +1155,12 @@ static ssize_t trans_stat_show(struct device *dev,
int i, j;
unsigned int max_state = devfreq->profile->max_state;
 
+   if (max_state == 0 || devfreq->governor->type == DEVFREQ_GOV_PASSIVE)
+   return sprintf(buf, "Not Supported.\n");
+
if (!devfreq->stop_polling &&
devfreq_update_status(devfreq, devfreq->previous_freq))
return 0;
-   if (max_state == 0)
-   return sprintf(buf, "Not Supported.\n");
 
len = sprintf(buf, " From  :   To\n");
len += sprintf(buf + len, "   :");
diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
index fad7d6321978..43513a58f5bf 100644
--- a/drivers/devfreq/governor.h
+++ b/drivers/devfreq/governor.h
@@ -18,6 +18,13 @@
 
 #define to_devfreq(DEV)container_of((DEV), struct devfreq, dev)
 
+/* Devfreq governor type */
+#define DEVFREQ_GOV_ONDEMAND   0x1
+#define DEVFREQ_GOV_PERFORMANCE0x2
+#define DEVFREQ_GOV_POWERSAVE  0x3
+#define DEVFREQ_GOV_USERSPACE  0x4
+#define DEVFREQ_GOV_PASSIVE0x4
+
 /* Devfreq events */
 #define DEVFREQ_GOV_START  0x1
 #define DEVFREQ_GOV_STOP   0x2
diff --git a/drivers/devfreq/governor_passive.c 
b/drivers/devfreq/governor_passive.c
index 7443ae4b92f9..adfdee9a9cd1 100644
--- a/drivers/devfreq/governor_passive.c
+++ b/drivers/devfreq/governor_passive.c
@@ -81,6 +81,7 

[PATCH v2 15/19] ARM: dts: Add bus nodes using VDD_MIF for Exynos4210

2015-12-08 Thread Chanwoo Choi
This patch adds the bus nodes for Exynos4210 SoC. Exynos4210 SoC has
one power line for all buses to translate data between DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- DMC/ACP clock for DMC (Dynamic Memory Controller)
- ACLK200 clock for LCD0
- ACLK100 clock for PERIL/PERIR/MFC(PCLK)
- ACLK160 clock for CAM/TV/LCD0/LCD1
- ACLK133 clock for FSYS/GPS
- GDL/GDR clock for LEFTBUS/RIGHTBUS
- SCLK_MFC clock for MFC

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4210.dtsi | 172 ++
 1 file changed, 172 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 3e5ba665d200..658c5a1fe03c 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -257,6 +257,178 @@
power-domains = <_lcd1>;
#iommu-cells = <0>;
};
+
+   bus_dmc: bus_dmc {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_DMC>;
+   clock-names = "bus";
+   operating-points-v2 = <_dmc_opp_table>;
+   status = "disabled";
+   };
+
+   bus_acp: bus_acp {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACP>;
+   clock-names = "bus";
+   operating-points-v2 = <_acp_opp_table>;
+   status = "disabled";
+   };
+
+   bus_peri: bus_peri {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK100>;
+   clock-names = "bus";
+   operating-points-v2 = <_peri_opp_table>;
+   status = "disabled";
+   };
+
+   bus_fsys: bus_fsys {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK133>;
+   clock-names = "bus";
+   operating-points-v2 = <_fsys_opp_table>;
+   status = "disabled";
+   };
+
+   bus_display: bus_display {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK160>;
+   clock-names = "bus";
+   operating-points-v2 = <_display_opp_table>;
+   status = "disabled";
+   };
+
+   bus_lcd0: bus_lcd0 {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK200>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_leftbus: bus_leftbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDL>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_rightbus: bus_rightbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDR>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_mfc: bus_mfc {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_SCLK_MFC>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_dmc_opp_table: opp_table1 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <1025000>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <26700>;
+   opp-microvolt = <105>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <4>;
+   opp-microvolt = <115>;
+   };
+   };
+
+   bus_acp_opp_table: opp_table2 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <1025000>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <16000>;
+   opp-microvolt = <105>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <115>;
+   };
+   };
+
+   bus_peri_opp_table: opp_table3 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <500>;
+   opp-microvolt = <1025000>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <105>;
+   };
+   };
+
+   bus_fsys_opp_table: opp_table4 {
+ 

[PATCH v2 14/19] ARM: dts: Add bus nodes using VDD_INT for Exynos4x12

2015-12-08 Thread Chanwoo Choi
This patch adds the bus noes using VDD_INT for Exynos4x12 SoC.
Exynos4x12 has the following AXI buses to translate data between
DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- ACLK100 clock for PERIL/PERIR/MFC(PCLK)
- ACLK160 clock for CAM/TV/LCD
: The minimum clock of ACLK160 should be over 160MHz.
  When drop the clock under 160MHz, show the broken image.
- ACLK133 clock for FSYS
- GDL clock for LEFTBUS
- GDR clock for RIGHTBUS
- SCLK_MFC clock for MFC

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4x12.dtsi | 112 ++
 1 file changed, 112 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4x12.dtsi 
b/arch/arm/boot/dts/exynos4x12.dtsi
index 3bcf0939755e..8bc4aee156b5 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -354,6 +354,118 @@
opp-microvolt = <95>;
};
};
+
+   bus_leftbus: bus_leftbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDL>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_rightbus: bus_rightbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDR>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_display: bus_display {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK160>;
+   clock-names = "bus";
+   operating-points-v2 = <_display_opp_table>;
+   status = "disabled";
+   };
+
+   bus_fsys: bus_fsys {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK133>;
+   clock-names = "bus";
+   operating-points-v2 = <_fsys_opp_table>;
+   status = "disabled";
+   };
+
+   bus_peri: bus_peri {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_ACLK100>;
+   clock-names = "bus";
+   operating-points-v2 = <_peri_opp_table>;
+   status = "disabled";
+   };
+
+   bus_mfc: bus_mfc {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_SCLK_MFC>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_leftbus_opp_table: opp_table3 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <925000>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <16000>;
+   opp-microvolt = <95>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <100>;
+   };
+   };
+
+   bus_display_opp_table: opp_table4 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <16000>;
+   opp-microvolt = <95>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <100>;
+   };
+   };
+
+   bus_fsys_opp_table: opp_table5 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <925000>;
+   };
+   };
+
+   bus_peri_opp_table: opp_table6 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <5000>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <925000>;
+   };
+   };
 };
 
  {
-- 
1.9.1

--
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 09/19] PM / devfreq: exynos: Update documentation for bus devices using passive governor

2015-12-08 Thread Chanwoo Choi
This patch updates the documentation for passive bus devices and adds the
detailed example of Exynos3250.

Signed-off-by: Chanwoo Choi 
---
 .../devicetree/bindings/devfreq/exynos-bus.txt | 244 -
 1 file changed, 241 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt 
b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
index 54a1f9c46c88..c4fdc70f8eac 100644
--- a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
+++ b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
@@ -13,18 +13,23 @@ SoC has the different sub-blocks. So, this difference 
should be specified
 in devicetree file instead of each device driver. In result, this driver
 is able to support the bus frequency for all Exynos SoCs.
 
-Required properties for bus device:
+Required properties for all bus devices:
 - compatible: Should be "samsung,exynos-bus".
 - clock-names : the name of clock used by the bus, "bus".
 - clocks : phandles for clock specified in "clock-names" property.
 - #clock-cells: should be 1.
 - operating-points-v2: the OPP table including frequency/voltage information
   to support DVFS (Dynamic Voltage/Frequency Scaling) feature.
+
+Required properties for only parent bus device:
 - vdd-supply: the regulator to provide the buses with the voltage.
 - devfreq-events: the devfreq-event device to monitor the curret utilization
   of buses.
 
-Optional properties for bus device:
+Required properties for only passive bus device:
+- devfreq: the parent bus device.
+
+Optional properties for only parent bus device:
 - exynos,saturation-ratio: the percentage value which is used to calibrate
the performance count againt total cycle count.
 
@@ -33,7 +38,20 @@ Example1:
power line (regulator). The MIF (Memory Interface) AXI bus is used to
transfer data between DRAM and CPU and uses the VDD_MIF regualtor.
 
-   - power line(VDD_MIF) --> bus for DMC (Dynamic Memory Controller) block
+   - MIF (Memory Interface) block
+   : VDD_MIF |--- DMC (Dynamic Memory Controller)
+
+   - INT (Internal) block
+   : VDD_INT |--- LEFTBUS (parent device)
+ |--- PERIL
+ |--- MFC
+ |--- G3D
+ |--- RIGHTBUS
+ |--- FSYS
+ |--- LCD0
+ |--- PERIR
+ |--- ISP
+ |--- CAM
 
- MIF bus's frequency/voltage table
---
@@ -46,6 +64,24 @@ Example1:
|L5| 40 |875000   |
---
 
+   - INT bus's frequency/voltage table
+   --
+   |Block|LEFTBUS|RIGHTBUS|MCUISP |ISP|PERIL  ||VDD_INT |
+   | name|   |LCD0|   |   |   |||
+   | |   |FSYS|   |   |   |||
+   | |   |MFC |   |   |   |||
+   --
+   |Mode |*parent|passive |passive|passive|passive|||
+   --
+   |Lv   |Frequency   ||Voltage |
+   --
+   |L1   |5  |5   |5  |5  |5  ||90  |
+   |L2   |8  |8   |8  |8  |8  ||90  |
+   |L3   |10 |10  |10 |10 |10 ||100 |
+   |L4   |134000 |134000  |20 |20 |   ||100 |
+   |L5   |20 |20  |40 |30 |   ||100 |
+   --
+
 Example2 :
The bus of DMC (Dynamic Memory Controller) block in exynos3250.dtsi
are listed below:
@@ -84,6 +120,167 @@ Example2 :
};
};
 
+   bus_leftbus: bus_leftbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDL>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_rightbus: bus_rightbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDR>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_lcd0: bus_lcd0 {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_160>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_fsys: bus_fsys {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_200>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";

Re: [RFC PATCH 01/15] PM / devfreq: exynos: Add generic exynos bus frequency driver

2015-12-08 Thread Chanwoo Choi
Hi Anand,

On 2015년 11월 27일 09:34, Chanwoo Choi wrote:
> Hi Anand,
> 
> On 2015년 11월 27일 02:17, Anand Moon wrote:
>> Hi Chanwoo,
>>
>> On 26 November 2015 at 21:42, Chanwoo Choi  wrote:
>>> On Thu, Nov 26, 2015 at 11:00 PM, MyungJoo Ham  
>>> wrote:
 On Thu, Nov 26, 2015 at 10:47 PM, Chanwoo Choi  
 wrote:
> This patch adds the generic exynos bus frequency driver for AMBA AXI bus
> of sub-blocks in exynos SoC with DEVFREQ framework. The Samsung Exynos SoC
> have the common architecture for bus between DRAM and sub-blocks in SoC.
> This driver can support the generic bus frequency driver for Exynos SoCs.
>
> In devicetree, Each bus block has a bus clock, regulator, operation-point
> and devfreq-event devices which measure the utilization of each bus block.
>
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/devfreq/Kconfig |  15 ++
>  drivers/devfreq/Makefile|   1 +
>  drivers/devfreq/exynos/Makefile |   1 +
>  drivers/devfreq/exynos/exynos-bus.c | 443 
> 
>  4 files changed, 460 insertions(+)
>  create mode 100644 drivers/devfreq/exynos/exynos-bus.c
>

 Are we finally getting a common Exynos bus driver with full DT support?
 (can this replace both Exynos4/5 drivers and support Exynos7 series?)
>>>
>>> Yes.
>>> This patch-set would support all Exynos SoCs for bus frequency driver.
>>> To make sure the support for Exynos7 series, I need to check the TRM
>>> document of Exynos7.  I think it is possible for support Exynos7.
>>>
>>> I'm going to test this driver on various Exynos-based board.
>>>
>>> Regards,
>>> Chanwoo Choi
>>
>> Please do consider Exynos 542x series as well.
> 
> Sure. I'll to test it on Exynos5422-based Odroid-XU3.

I send the v2 patchset but this patchset don't include
the support of Odroid-XU3 because of only Exynos542x has the 
special addtional sequence to change the source clock
of DRAM. So, I'm going to support the bus frequency on Exynos542x.
After completing it, I'll send the separate patches.

Thanks,
Chanwoo Choi

--
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 1/3] dt-binding: power: Add otg regulator binding

2015-12-08 Thread Rob Herring
On Tue, Dec 08, 2015 at 04:40:16PM -0800, Tim Bird wrote:
> Add a binding for the regulator which controls the OTG chargepath switch.
> The OTG switch gets its power from pm8941_5vs1, and that should be
> expressed as a usb-otg-in-supply property in the DT node for the
> charger driver.  The regulator name is "otg".
> 
> Signed-off-by: Tim Bird 
> ---
> Changes since v1
>  - switch supply name to have dashes instead of underscores
>  - remove superfluous DT explanations in the otg node description
> ---
>  .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 
> +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
> b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
> index 65b88fa..28b6da7 100644
> --- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
> +++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
> @@ -105,6 +105,22 @@ PROPERTIES
> regulation must be done externally to fully comply with
> the JEITA safety guidelines if this flag is set.
>  
> +- usb-otg-in-supply:
> +  Usage: optional
> +  Value type: 
> +  Description: Reference to the regulator supplying power to the USB_OTG_IN
> +   pin.
> +
> +child nodes:
> +- otg:
> +  Usage: optional
> +  Description: This node defines a regulator used to control the direction
> +   of VBUS voltage - specifically: whether to supply voltage
> +   to VBUS for host mode operation of the OTG port, or allow
> +   input voltage from external VBUS for charging.  In the
> +   hardware, the supply for this regulator comes from
> +   usb-otg-in-supply.

Doesn't this regulator need to have a name defined?

Disabling this regulator (along with other setup) will enable charging?

Rob
--
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 13/19] ARM: dts: Add bus nodes using VDD_MIF for Exynos4x12

2015-12-08 Thread Chanwoo Choi
This patch adds the bus noes using VDD_MIF for Exynos4x12 SoC.
Exynos4x12 has the following AXI buses to translate data
between DRAM and DMC/ACP/C2C.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4x12.dtsi | 72 +++
 1 file changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4x12.dtsi 
b/arch/arm/boot/dts/exynos4x12.dtsi
index b77dac61ffb5..3bcf0939755e 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -282,6 +282,78 @@
clocks = < CLK_SMMU_LITE1>, < CLK_FIMC_LITE1>;
#iommu-cells = <0>;
};
+
+   bus_dmc: bus_dmc {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_DMC>;
+   clock-names = "bus";
+   operating-points-v2 = <_dmc_opp_table>;
+   status = "disabled";
+   };
+
+   bus_acp: bus_acp {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACP>;
+   clock-names = "bus";
+   operating-points-v2 = <_acp_opp_table>;
+   status = "disabled";
+   };
+
+   bus_c2c: bus_c2c {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_C2C>;
+   clock-names = "bus";
+   operating-points-v2 = <_dmc_opp_table>;
+   status = "disabled";
+   };
+
+   bus_dmc_opp_table: opp_table1 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <90>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <16000>;
+   opp-microvolt = <90>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <95>;
+   };
+   opp04 {
+   opp-hz = /bits/ 64 <4>;
+   opp-microvolt = <105>;
+   };
+   };
+
+   bus_acp_opp_table: opp_table2 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <90>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <16000>;
+   opp-microvolt = <90>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <95>;
+   };
+   };
 };
 
  {
-- 
1.9.1

--
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 12/19] ARM: dts: Add bus nodes using VDD_INT for Exynos3250

2015-12-08 Thread Chanwoo Choi
This patch adds the bus nodes using VDD_INT for Exynos3250 SoC.
Exynos3250 has following AXI buses to translate data between
DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- ACLK400 clock for MCUISP
- ACLK266 clock for ISP
- ACLK200 clock for FSYS
- ACLK160 clock for LCD0
- ACLK100 clock for PERIL
- GDL clock for LEFTBUS
- GDR clock for RIGHTBUS
- SCLK_MFC clock for MFC

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos3250.dtsi | 160 ++
 1 file changed, 160 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250.dtsi 
b/arch/arm/boot/dts/exynos3250.dtsi
index 7214c5e42150..46dee1951ec1 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -721,6 +721,166 @@
opp-microvolt = <875000>;
};
};
+
+   bus_leftbus: bus_leftbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDL>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_rightbus: bus_rightbus {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_GDR>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_lcd0: bus_lcd0 {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_160>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_fsys: bus_fsys {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_200>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_mcuisp: bus_mcuisp {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_400_MCUISP>;
+   clock-names = "bus";
+   operating-points-v2 = <_mcuisp_opp_table>;
+   status = "disabled";
+   };
+
+   bus_isp: bus_isp {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_266>;
+   clock-names = "bus";
+   operating-points-v2 = <_isp_opp_table>;
+   status = "disabled";
+   };
+
+   bus_peril: bus_peril {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_DIV_ACLK_100>;
+   clock-names = "bus";
+   operating-points-v2 = <_peril_opp_table>;
+   status = "disabled";
+   };
+
+   bus_mfc: bus_mfc {
+   compatible = "samsung,exynos-bus";
+   clocks = < CLK_SCLK_MFC>;
+   clock-names = "bus";
+   operating-points-v2 = <_leftbus_opp_table>;
+   status = "disabled";
+   };
+
+   bus_leftbus_opp_table: opp_table2 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <5000>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <8000>;
+   opp-microvolt = <90>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <100>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <100>;
+   };
+   opp04 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <100>;
+   };
+   };
+
+   bus_mcuisp_opp_table: opp_table3 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <5000>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+

[PATCH v2 16/19] ARM: dts: Add PPMU node for exynos4412-odroidu3

2015-12-08 Thread Chanwoo Choi
This patch add dt node for PPMU_{DMC0|DMC1|LEFTBUS|RIGHTBUS} for
exynos4412-odroidu3 board. Each PPMU dt node includes one event of
'PPMU Count3'.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 40 +
 1 file changed, 40 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index edf0fc8db6ff..90800a6da14b 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -504,3 +504,43 @@
  {
status = "okay";
 };
+
+_dmc0 {
+   status = "okay";
+
+   events {
+   ppmu_dmc0_3: ppmu-event3-dmc0 {
+   event-name = "ppmu-event3-dmc0";
+   };
+   };
+};
+
+_dmc1 {
+   status = "okay";
+
+   events {
+   ppmu_dmc1_3: ppmu-event3-dmc1 {
+   event-name = "ppmu-event3-dmc1";
+   };
+   };
+};
+
+_leftbus {
+   status = "okay";
+
+   events {
+   ppmu_leftbus_3: ppmu-event3-leftbus {
+   event-name = "ppmu-event3-leftbus";
+   };
+   };
+};
+
+_rightbus {
+   status = "okay";
+
+   events {
+   ppmu_rightbus_3: ppmu-event3-rightbus {
+   event-name = "ppmu-event3-rightbus";
+   };
+   };
+};
-- 
1.9.1

--
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 05/19] PM / devfreq: Add new passive governor

2015-12-08 Thread Chanwoo Choi
This patch adds the new passive governor for DEVFREQ framework. The following
governors are already present and used for DVFS (Dynamic Voltage and Frequency
Scaling) drivers. The following governors are independently used for one device
driver which don't give the influence to other device drviers and also don't
receive the effect from other device drivers.
- ondemand / performance / powersave / userspace

The passive governor depends on operation of parent driver with specific
governos extremely and is not able to decide the new frequency by oneself.
According to the decided new frequency of parent driver with governor,
the passive governor uses it to decide the appropriate frequency for own
device driver. The passive governor must need the following information
from device tree:
- the source clock and OPP tables
- the instance of parent device

For exameple,
there are one more devfreq device drivers which need to change their source
clock according to their utilization on runtime. But, they share the same
power line (e.g., regulator). So, specific device driver is operated as parent
with ondemand governor and then the rest device driver with passive governor
is influenced by parent device.

Suggested-by: Myungjoo Ham 
Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/Kconfig|   9 
 drivers/devfreq/Makefile   |   1 +
 drivers/devfreq/devfreq.c  |  47 
 drivers/devfreq/governor_passive.c | 108 +
 include/linux/devfreq.h|  17 ++
 5 files changed, 182 insertions(+)
 create mode 100644 drivers/devfreq/governor_passive.c

diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 55ec774f794c..d03f635a93e1 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -64,6 +64,15 @@ config DEVFREQ_GOV_USERSPACE
  Otherwise, the governor does not change the frequnecy
  given at the initialization.
 
+config DEVFREQ_GOV_PASSIVE
+   tristate "Passive"
+   help
+ Sets the frequency by other governors (simple_ondemand, performance,
+ powersave, usersapce) of a parent devfreq device. This governor
+ always has the dependency on the chosen frequency from paired
+ governor. This governor does not change the frequency by oneself
+ through sysfs entry.
+
 comment "DEVFREQ Drivers"
 
 config ARM_EXYNOS_BUS_DEVFREQ
diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile
index 375ebbb4fcfb..f81c313b4b79 100644
--- a/drivers/devfreq/Makefile
+++ b/drivers/devfreq/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)   += 
governor_simpleondemand.o
 obj-$(CONFIG_DEVFREQ_GOV_PERFORMANCE)  += governor_performance.o
 obj-$(CONFIG_DEVFREQ_GOV_POWERSAVE)+= governor_powersave.o
 obj-$(CONFIG_DEVFREQ_GOV_USERSPACE)+= governor_userspace.o
+obj-$(CONFIG_DEVFREQ_GOV_PASSIVE)  += governor_passive.o
 
 # DEVFREQ Drivers
 obj-$(CONFIG_ARCH_EXYNOS)  += exynos/
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 984c5e9e7bdd..15e58779e4c0 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -190,6 +190,31 @@ static struct devfreq_governor 
*find_devfreq_governor(const char *name)
 
 /* Load monitoring helper functions for governors use */
 
+static int update_devfreq_passive(struct devfreq *devfreq, unsigned long freq)
+{
+   struct devfreq *passive;
+   unsigned long rate;
+   int ret;
+
+   list_for_each_entry(passive, >passive_dev_list, passive_node) {
+   if (!passive->governor)
+   continue;
+   rate = freq;
+
+   ret = passive->governor->get_target_freq(passive, );
+   if (ret)
+   return ret;
+
+   ret = passive->profile->target(passive->dev.parent, , 0);
+   if (ret)
+   return ret;
+
+   passive->previous_freq = rate;
+   }
+
+   return 0;
+}
+
 /**
  * update_devfreq() - Reevaluate the device and configure frequency.
  * @devfreq:   the devfreq instance.
@@ -233,10 +258,18 @@ int update_devfreq(struct devfreq *devfreq)
flags |= DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use LUB */
}
 
+   if (!list_empty(>passive_dev_list)
+   && devfreq->previous_freq > freq)
+   update_devfreq_passive(devfreq, freq);
+
err = devfreq->profile->target(devfreq->dev.parent, , flags);
if (err)
return err;
 
+   if (!list_empty(>passive_dev_list)
+   && devfreq->previous_freq < freq)
+   update_devfreq_passive(devfreq, freq);
+
if (devfreq->profile->freq_table)
if (devfreq_update_status(devfreq, freq))
dev_err(>dev,
@@ -442,6 +475,10 @@ static void _remove_devfreq(struct devfreq *devfreq)
return;
}
list_del(>node);
+   

[PATCH v2 19/19] ARM: dts: Add support of bus frequency for exynos4412-trats/odroidu3

2015-12-08 Thread Chanwoo Choi
THis patch adds the bus device tree nodes for both MIF (Memory) and INT
(Internal) block to enable the bus frequency.

The DMC bus is parent device in MIF block using VDD_MIF and the LEFTBUS
bus is parent device in INT block using VDD_INT.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 47 +
 arch/arm/boot/dts/exynos4412-trats2.dts | 47 +
 2 files changed, 94 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index 171dea1e3e4a..12d08242a179 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -544,3 +544,50 @@
};
};
 };
+
+_dmc {
+   devfreq-events = <_dmc0_3>, <_dmc1_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
+_acp {
+   devfreq = <_dmc>;
+   status = "okay";
+};
+
+_c2c {
+   devfreq = <_dmc>;
+   status = "okay";
+};
+
+_leftbus {
+   devfreq-events = <_leftbus_3>, <_rightbus_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
+_rightbus {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_display {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_fsys {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_peri {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_mfc {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts 
b/arch/arm/boot/dts/exynos4412-trats2.dts
index 40a474c4374b..aecd545803ad 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -1286,3 +1286,50 @@
vtmu-supply = <_reg>;
status = "okay";
 };
+
+_dmc {
+   devfreq-events = <_dmc0_3>, <_dmc1_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
+_acp {
+   devfreq = <_dmc>;
+   status = "okay";
+};
+
+_c2c {
+   devfreq = <_dmc>;
+   status = "okay";
+};
+
+_leftbus {
+   devfreq-events = <_leftbus_3>, <_rightbus_3>;
+   vdd-supply = <_reg>;
+   status = "okay";
+};
+
+_rightbus {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_display {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_fsys {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_peri {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
+
+_mfc {
+   devfreq = <_leftbus>;
+   status = "okay";
+};
-- 
1.9.1

--
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 18/19] ARM: dts: Expand the voltage range of buck1/3 regulator for exynos4412-odroidu3

2015-12-08 Thread Chanwoo Choi
This patch expands the voltage range of buck1/3 regulator due to as following:
- MIF (Memory Interface) bus frequency needs the 9uV ~ 105uV V.
- INT (Internal) bus frequency needs 9uV ~ 100uV.

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index 90800a6da14b..171dea1e3e4a 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -359,8 +359,8 @@
 
buck1_reg: BUCK1 {
regulator-name = "vdd_mif";
-   regulator-min-microvolt = <100>;
-   regulator-max-microvolt = <100>;
+   regulator-min-microvolt = <90>;
+   regulator-max-microvolt = <105>;
regulator-always-on;
regulator-boot-on;
};
@@ -375,7 +375,7 @@
 
buck3_reg: BUCK3 {
regulator-name = "vdd_int";
-   regulator-min-microvolt = <100>;
+   regulator-min-microvolt = <90>;
regulator-max-microvolt = <100>;
regulator-always-on;
regulator-boot-on;
-- 
1.9.1

--
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 03/19] ARM: dts: Add DMC bus node for Exynos3250

2015-12-08 Thread Chanwoo Choi
This patch adds the DMC (Dynamic Memory Controller) bus node for Exynos3250 SoC.
The DMC is an AMBA AXI-compliant slave to interface external JEDEC standard
SDRAM devices. The bus includes the OPP tables and the source clock for DMC
block.

Following list specifies the detailed relation between the clock and DMC block:
- The source clock of DMC block : div_dmc

Signed-off-by: Chanwoo Choi 
---
 arch/arm/boot/dts/exynos3250.dtsi | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250.dtsi 
b/arch/arm/boot/dts/exynos3250.dtsi
index 2f30d632f1cc..7214c5e42150 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -687,6 +687,40 @@
clock-names = "ppmu";
status = "disabled";
};
+
+   bus_dmc: bus_dmc {
+   compatible = "samsung,exynos-bus";
+   clocks = <_dmc CLK_DIV_DMC>;
+   clock-names = "bus";
+   operating-points-v2 = <_dmc_opp_table>;
+   status = "disabled";
+   };
+
+   bus_dmc_opp_table: opp_table1 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp00 {
+   opp-hz = /bits/ 64 <5000>;
+   opp-microvolt = <80>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <1>;
+   opp-microvolt = <80>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <13400>;
+   opp-microvolt = <80>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <2>;
+   opp-microvolt = <80>;
+   };
+   opp04 {
+   opp-hz = /bits/ 64 <4>;
+   opp-microvolt = <875000>;
+   };
+   };
};
 };
 
-- 
1.9.1

--
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 06/19] PM / devfreq: Add devfreq_get_devfreq_by_phandle()

2015-12-08 Thread Chanwoo Choi
This patch adds the new devfreq_get_devfreq_by_phandle() OF helper function
which can find the instance of devfreq device by using phandle ("devfreq").

Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/devfreq.c | 44 
 include/linux/devfreq.h   |  9 +
 2 files changed, 53 insertions(+)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 15e58779e4c0..78ea4cdaa82c 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "governor.h"
 
 static struct class *devfreq_class;
@@ -686,6 +687,49 @@ struct devfreq *devm_devfreq_add_device(struct device *dev,
 }
 EXPORT_SYMBOL(devm_devfreq_add_device);
 
+#ifdef CONFIG_OF
+/*
+ * devfreq_get_devfreq_by_phandle - Get the devfreq device from devicetree
+ * @dev - instance to the given device
+ * @index - index into list of devfreq
+ *
+ * return the instance of devfreq device
+ */
+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
+{
+   struct device_node *node;
+   struct devfreq *devfreq;
+
+   if (!dev)
+   return ERR_PTR(-EINVAL);
+
+   if (!dev->of_node)
+   return ERR_PTR(-EINVAL);
+
+   node = of_parse_phandle(dev->of_node, "devfreq", index);
+   if (!node)
+   return ERR_PTR(-ENODEV);
+
+   mutex_lock(_list_lock);
+   list_for_each_entry(devfreq, _list, node) {
+   if (devfreq->dev.parent
+   && devfreq->dev.parent->of_node == node) {
+   mutex_unlock(_list_lock);
+   return devfreq;
+   }
+   }
+   mutex_unlock(_list_lock);
+
+   return ERR_PTR(-EPROBE_DEFER);
+}
+#else
+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif /* CONFIG_OF */
+EXPORT_SYMBOL_GPL(devfreq_get_devfreq_by_phandle);
+
 /**
  * devm_devfreq_remove_device() - Resource-managed devfreq_remove_device()
  * @dev:   the device to add devfreq feature.
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index f7a6e6bd716e..d648041145ba 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -211,6 +211,9 @@ extern int devm_devfreq_register_opp_notifier(struct device 
*dev,
 extern void devm_devfreq_unregister_opp_notifier(struct device *dev,
struct devfreq *devfreq);
 
+extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
+   int index);
+
 /**
  * devfreq_update_stats() - update the last_status pointer in struct devfreq
  * @df:the devfreq instance whose status needs updating
@@ -324,6 +327,12 @@ static inline void 
devm_devfreq_unregister_opp_notifier(struct device *dev,
 {
 }
 
+static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device 
*dev,
+   int index)
+{
+   return ERR_PTR(-ENODEV);
+}
+
 static inline int devfreq_update_stats(struct devfreq *df)
 {
return -EINVAL;
-- 
1.9.1

--
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 11/19] PM / devfreq: exynos: Remove unused exynos4/5 busfreq driver

2015-12-08 Thread Chanwoo Choi
This patch removes the unused exynos4/5 busfreq driver. Instead,
generic exynos-bus frequency driver support the all Exynos SoCs.

Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/Kconfig  |   22 -
 drivers/devfreq/exynos/Makefile  |2 -
 drivers/devfreq/exynos/exynos4_bus.c | 1055 --
 drivers/devfreq/exynos/exynos4_bus.h |  110 
 drivers/devfreq/exynos/exynos5_bus.c |  431 --
 drivers/devfreq/exynos/exynos_ppmu.c |  119 
 drivers/devfreq/exynos/exynos_ppmu.h |   86 ---
 7 files changed, 1825 deletions(-)
 delete mode 100644 drivers/devfreq/exynos/exynos4_bus.c
 delete mode 100644 drivers/devfreq/exynos/exynos4_bus.h
 delete mode 100644 drivers/devfreq/exynos/exynos5_bus.c
 delete mode 100644 drivers/devfreq/exynos/exynos_ppmu.c
 delete mode 100644 drivers/devfreq/exynos/exynos_ppmu.h

diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 88f7cc4539b8..e82b1d8cd200 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -91,28 +91,6 @@ config ARM_EXYNOS_BUS_DEVFREQ
  and adjusts the operating frequencies and voltages with OPP support.
  This does not yet operate with optimal voltages.
 
-config ARM_EXYNOS4_BUS_DEVFREQ
-   bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
-   depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412) && 
!ARCH_MULTIPLATFORM
-   select DEVFREQ_GOV_SIMPLE_ONDEMAND
-   select PM_OPP
-   help
- This adds the DEVFREQ driver for Exynos4210 memory bus (vdd_int)
- and Exynos4212/4412 memory interface and bus (vdd_mif + vdd_int).
- It reads PPMU counters of memory controllers and adjusts
- the operating frequencies and voltages with OPP support.
- This does not yet operate with optimal voltages.
-
-config ARM_EXYNOS5_BUS_DEVFREQ
-   tristate "ARM Exynos5250 Bus DEVFREQ Driver"
-   depends on SOC_EXYNOS5250
-   select DEVFREQ_GOV_SIMPLE_ONDEMAND
-   select PM_OPP
-   help
- This adds the DEVFREQ driver for Exynos5250 bus interface (vdd_int).
- It reads PPMU counters of memory controllers and adjusts the
- operating frequencies and voltages with OPP support.
-
 config ARM_TEGRA_DEVFREQ
tristate "Tegra DEVFREQ Driver"
depends on ARCH_TEGRA_124_SOC
diff --git a/drivers/devfreq/exynos/Makefile b/drivers/devfreq/exynos/Makefile
index 4ec06d322996..bc695ad81c7d 100644
--- a/drivers/devfreq/exynos/Makefile
+++ b/drivers/devfreq/exynos/Makefile
@@ -1,4 +1,2 @@
 # Exynos DEVFREQ Drivers
 obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ)   += exynos-bus.o
-obj-$(CONFIG_ARM_EXYNOS4_BUS_DEVFREQ)  += exynos_ppmu.o exynos4_bus.o
-obj-$(CONFIG_ARM_EXYNOS5_BUS_DEVFREQ)  += exynos_ppmu.o exynos5_bus.o
diff --git a/drivers/devfreq/exynos/exynos4_bus.c 
b/drivers/devfreq/exynos/exynos4_bus.c
deleted file mode 100644
index da9509205169..
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ /dev/null
@@ -1,1055 +0,0 @@
-/* drivers/devfreq/exynos4210_memorybus.c
- *
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * http://www.samsung.com/
- * MyungJoo Ham 
- *
- * EXYNOS4 - Memory/Bus clock frequency scaling support in DEVFREQ framework
- * This version supports EXYNOS4210 only. This changes bus frequencies
- * and vddint voltages. Exynos4412/4212 should be able to be supported
- * with minor modifications.
- *
- * 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 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "exynos_ppmu.h"
-#include "exynos4_bus.h"
-
-#define MAX_SAFEVOLT   120 /* 1.2V */
-
-enum exynos4_busf_type {
-   TYPE_BUSF_EXYNOS4210,
-   TYPE_BUSF_EXYNOS4x12,
-};
-
-/* Assume that the bus is saturated if the utilization is 40% */
-#define BUS_SATURATION_RATIO   40
-
-enum busclk_level_idx {
-   LV_0 = 0,
-   LV_1,
-   LV_2,
-   LV_3,
-   LV_4,
-   _LV_END
-};
-
-enum exynos_ppmu_idx {
-   PPMU_DMC0,
-   PPMU_DMC1,
-   PPMU_END,
-};
-
-#define EX4210_LV_MAX  LV_2
-#define EX4x12_LV_MAX  LV_4
-#define EX4210_LV_NUM  (LV_2 + 1)
-#define EX4x12_LV_NUM  (LV_4 + 1)
-
-/**
- * struct busfreq_opp_info - opp information for bus
- * @rate:  Frequency in hertz
- * @volt:  Voltage in microvolts corresponding to this OPP
- */
-struct busfreq_opp_info {
-   unsigned long rate;
-   unsigned long volt;
-};
-
-struct busfreq_data {
-   enum exynos4_busf_type type;
-   struct device *dev;
-   struct devfreq *devfreq;
-   bool disabled;
-   struct regulator *vdd_int;
-   struct regulator *vdd_mif; /* Exynos4412/4212 only */
-   struct busfreq_opp_info curr_oppinfo;
-   struct busfreq_ppmu_data ppmu_data;
-
-   struct 

[PATCH v2 00/19] PM / devferq: Add generic exynos bus frequency driver and new passive governor

2015-12-08 Thread Chanwoo Choi
This patch-set includes the two features as following. The generic exynos bus
frequency driver is able to support almost Exynos SoCs for bus frequency
scaling. And the new passive governor is able to make the dependency on
between devices for frequency/voltage scaling. I had posted the patch-set[1]
with the similiar concept. This is is revised version for exynos bus frequency.
- Generic exynos bus frequency driver
- New passive governor of DEVFREQ framework

Depends on:
- This patch-set is based on devfreq.git[2].
[1] https://lkml.org/lkml/2015/1/7/872
   : [PATCHv3 0/8] devfreq: Add generic exynos memory-bus frequency driver
[2] https://git.kernel.org/cgit/linux/kernel/git/mzx/devfreq.git/ (branch: 
for-rafael)

Changes from v1:
(https://lkml.org/lkml/2015/11/26/260)
- Check whether the instance of regulator is NULL or not
  when executing regulator_disable() because of only parent
  devfreq device has the regulator instance. After fixing it,
  the wake-up from suspend state is well working. (patch1)
- Fix bug which checks 'bus-clk' instead of 'bus->regulator'
  after calling devm_clk_get() (on patch1)
- Update the documentation to remove the description about
  DEVFREQ-EVENT subsystem (on patch2)
- Add the full name of DMC (Dynamic Memory Controller) (on patch2)
- Modify the detailed correlation of buses for Exynos3250
  on documentation (patch2)
- Add the MFC bus node for Exynos3250 (on patch11, patch12)
- Fix the duplicate frequency of bus_display on Exynos4x12.dtsi
- Add the PPMU node for exynos4412-odroidu3
- Add the support of bus frequency for exynos4412-odroidu3

Detailed descirption for patch-set:
1. Add generic exynos bus frequency driver
: This patch-set adds the generic exynos bus frequency driver for AXI bus
of sub-blocks in exynos SoC. The Samsung Exynos SoC have the common
architecture for bus between DRAM and sub-blocks in SoC.

 There are the different buses according to Exynos SoC because Exynos SoC
has the differnt sub-blocks and bus speed. In spite of this difference
among Exynos SoCs, this driver is able to support almost Exynos SoC by adding
unique data of each bus in the devicetree file.

 In devicetree, each bus node has a bus clock, regulator, operation-point
and devfreq-event devices which measure the utilization of each bus block.

For example,
- The bus of DMC block in exynos3250.dtsi are listed below:

bus_dmc: bus_dmc {
compatible = "samsung,exynos-bus";
clocks = <_dmc CLK_DIV_DMC>;
clock-names = "bus";
operating-points-v2 = <_dmc_opp_table>;
status = "disabled";
};

bus_dmc_opp_table: opp_table0 {
compatible = "operating-points-v2";
opp-shared;

opp00 {
opp-hz = /bits/ 64 <5000>;
opp-microvolt = <80>;
};
opp01 {
opp-hz = /bits/ 64 <1>;
opp-microvolt = <80>;
};
opp02 {
opp-hz = /bits/ 64 <13400>;
opp-microvolt = <80>;
};
opp03 {
opp-hz = /bits/ 64 <2>;
opp-microvolt = <80>;
};
opp04 {
opp-hz = /bits/ 64 <4>;
opp-microvolt = <875000>;
};
};

- Usage case to handle the frequency and voltage of bus on runtime
  in exynos3250-rinato.dts are listed below:

_dmc {
devfreq-events = <_dmc0_3>, <_dmc1_3>;
vdd-supply = <_reg>;  /* VDD_MIF */
status = "okay";
};

2. Add new passive governor of DEVFREQ framework (patch5-patch7)
: This patch-set add the new passive governor for DEVFREQ framework.
The existing governors (ondemand, performance and so on) are used for DVFS
(Dynamic Voltage and Frequency Scaling) drivers. The existing governors
are independently used for specific device driver which don't give the
influence to other device drviers and also don't receive the effect from
other device drivers.

 The passive governor depends on operation of parent driver with existing
governors(ondemand, performance and so on) extremely and is not able to
decide the new frequency by oneself. According to the decided new frequency
of parent driver with governor, the passive governor uses it to decide
the appropriate frequency for own device driver. The passive governor
must need the following information from device tree:

For exameple,
 There are one more bus device drivers in Exynos3250 which need to
change their source clock according to their utilization on runtime.
But, they share the same power line (e.g., regulator). So, LEFTBUS bus
driver is operated as parent with ondemand governor and then the rest
device driver with passive governor.

 

[PATCH v2 01/19] PM / devfreq: exynos: Add generic exynos bus frequency driver

2015-12-08 Thread Chanwoo Choi
This patch adds the generic exynos bus frequency driver for AMBA AXI bus
of sub-blocks in exynos SoC with DEVFREQ framework. The Samsung Exynos SoC
have the common architecture for bus between DRAM and sub-blocks in SoC.
This driver can support the generic bus frequency driver for Exynos SoCs.

In devicetree, Each bus block has a bus clock, regulator, operation-point
and devfreq-event devices which measure the utilization of each bus block.

Signed-off-by: Chanwoo Choi 
---
 drivers/devfreq/Kconfig |  15 ++
 drivers/devfreq/Makefile|   1 +
 drivers/devfreq/exynos/Makefile |   1 +
 drivers/devfreq/exynos/exynos-bus.c | 449 
 4 files changed, 466 insertions(+)
 create mode 100644 drivers/devfreq/exynos/exynos-bus.c

diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 64281bb2f650..55ec774f794c 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -66,6 +66,21 @@ config DEVFREQ_GOV_USERSPACE
 
 comment "DEVFREQ Drivers"
 
+config ARM_EXYNOS_BUS_DEVFREQ
+   bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"
+   depends on ARCH_EXYNOS
+   select DEVFREQ_GOV_SIMPLE_ONDEMAND
+   select DEVFREQ_EVENT_EXYNOS_PPMU
+   select PM_DEVFREQ_EVENT
+   select PM_OPP
+   help
+ This adds the common DEVFREQ driver for Exynos Memory bus. Exynos
+ Memory bus has one more group of memory bus (e.g, MIF and INT block).
+ Each memory bus group could contain many memoby bus block. It reads
+ PPMU counters of memory controllers by using DEVFREQ-event device
+ and adjusts the operating frequencies and voltages with OPP support.
+ This does not yet operate with optimal voltages.
+
 config ARM_EXYNOS4_BUS_DEVFREQ
bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412) && 
!ARCH_MULTIPLATFORM
diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile
index 5134f9ee983d..375ebbb4fcfb 100644
--- a/drivers/devfreq/Makefile
+++ b/drivers/devfreq/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_DEVFREQ_GOV_POWERSAVE) += governor_powersave.o
 obj-$(CONFIG_DEVFREQ_GOV_USERSPACE)+= governor_userspace.o
 
 # DEVFREQ Drivers
+obj-$(CONFIG_ARCH_EXYNOS)  += exynos/
 obj-$(CONFIG_ARM_EXYNOS4_BUS_DEVFREQ)  += exynos/
 obj-$(CONFIG_ARM_EXYNOS5_BUS_DEVFREQ)  += exynos/
 obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o
diff --git a/drivers/devfreq/exynos/Makefile b/drivers/devfreq/exynos/Makefile
index 49bc9175f923..4ec06d322996 100644
--- a/drivers/devfreq/exynos/Makefile
+++ b/drivers/devfreq/exynos/Makefile
@@ -1,3 +1,4 @@
 # Exynos DEVFREQ Drivers
+obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ)   += exynos-bus.o
 obj-$(CONFIG_ARM_EXYNOS4_BUS_DEVFREQ)  += exynos_ppmu.o exynos4_bus.o
 obj-$(CONFIG_ARM_EXYNOS5_BUS_DEVFREQ)  += exynos_ppmu.o exynos5_bus.o
diff --git a/drivers/devfreq/exynos/exynos-bus.c 
b/drivers/devfreq/exynos/exynos-bus.c
new file mode 100644
index ..f1bc20839650
--- /dev/null
+++ b/drivers/devfreq/exynos/exynos-bus.c
@@ -0,0 +1,449 @@
+/*
+ * Generic Exynos Bus frequency driver with DEVFREQ Framework
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Author : Chanwoo Choi 
+ *
+ * This driver support Exynos Bus frequency feature by using
+ * DEVFREQ framework and is based on drivers/devfreq/exynos/exynos4_bus.c.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DEFAULT_SATURATION_RATIO   40
+
+struct exynos_bus {
+   struct device *dev;
+
+   struct devfreq *devfreq;
+   struct devfreq_event_dev **edev;
+   unsigned int edev_count;
+   struct mutex lock;
+
+   struct dev_pm_opp *curr_opp;
+
+   struct regulator *regulator;
+   struct clk *clk;
+   int ratio;
+};
+
+/*
+ * Control the devfreq-event device to get the current state of bus
+ */
+#define exynos_bus_ops_edev(ops)   \
+static int exynos_bus_##ops(struct exynos_bus *bus)\
+{  \
+   int i, ret; \
+   \
+   for (i = 0; i < bus->edev_count; i++) { \
+   if (!bus->edev[i])  \
+   continue;   \
+   ret = devfreq_event_##ops(bus->edev[i]);\
+   if (ret < 0)\
+   return ret; \
+   }   \
+   

Re: [PATCH 3/4] firmware: actually return NULL on failed request_firmware_nowait()

2015-12-08 Thread Ming Lei
On Wed, Dec 9, 2015 at 10:38 AM, Brian Norris
 wrote:
> The kerneldoc for request_firmware_nowait() says that it may call the
> provided cont() callback with @fw == NULL, if the firmware request
> fails. However, this is not the case when called with an empty string
> (""). This case is short-circuited by the 'name[0] == '\0'' check
> introduced in commit 471b095dfe0d ("firmware_class: make sure fw requests
> contain a name"), so _request_firmware() never gets to set the fw to
> NULL.
>
> Noticed while using the new 'trigger_async_request' testing hook:
>
> # printf '\x00' > 
> /sys/devices/virtual/misc/test_firmware/trigger_async_request
> [10553.726178] test_firmware: loading ''
> [10553.729859] test_firmware: loaded: 995209091
> # printf '\x00' > 
> /sys/devices/virtual/misc/test_firmware/trigger_async_request
> [10733.676184] test_firmware: loading ''
> [10733.679855] Unable to handle kernel NULL pointer dereference at 
> virtual address 0004
> [10733.687951] pgd = ec188000
> [10733.690655] [0004] *pgd=
> [10733.694240] Internal error: Oops: 5 [#1] SMP ARM
> [10733.698847] Modules linked in: btmrvl_sdio btmrvl bluetooth 
> sbs_battery nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables asix 
> usbnet mwifiex_sdio mwifiex cfg80211 jitterentropy_rng drbg joydev 
> snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async 
> ppp_generic slhc tun
> [10733.725670] CPU: 0 PID: 6600 Comm: bash Not tainted 
> 4.4.0-rc4-00351-g63d0877 #178
> [10733.733137] Hardware name: Rockchip (Device Tree)
> [10733.737831] task: ed24f6c0 ti: ee322000 task.ti: ee322000
> [10733.743222] PC is at do_raw_spin_lock+0x18/0x1a0
> [10733.747831] LR is at _raw_spin_lock+0x18/0x1c
> [10733.752180] pc : []lr : []psr: a00d0013
> [10733.752180] sp : ee323df8  ip : ee323e20  fp : ee323e1c
> [10733.763634] r10: 0051  r9 : b6f18000  r8 : ee323f80
> [10733.768847] r7 : c089cebc  r6 : 0001  r5 :   r4 : ec0e6000
> [10733.775360] r3 : dead4ead  r2 : c06bd140  r1 : eef913b4  r0 : 
> [10733.781874] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  
> Segment none
> [10733.788995] Control: 10c5387d  Table: 2c18806a  DAC: 0051
> [10733.794728] Process bash (pid: 6600, stack limit = 0xee322218)
> [10733.800549] Stack: (0xee323df8 to 0xee324000)
> [10733.804896] 3de0:  
>  ec0e6000 
> [10733.813059] 3e00: 0001 c089cebc ee323f80 b6f18000 ee323e2c 
> ee323e20 c054c204 c0065394
> [10733.821221] 3e20: ee323e44 ee323e30 c02fec60 c054c1f8 ec0e7ec0 
> ec3fcfc0 ee323e5c ee323e48
> [10733.829384] 3e40: c02fed08 c02fec48 c07dbf74 eeb05a00 ee323e8c 
> ee323e60 c0253828 c02fecac
> [10733.837547] 3e60: 0001 c0116950 ee323eac ee323e78 0001 
> ec3fce00 ed2d9700 ed2d970c
> [10733.845710] 3e80: ee323e9c ee323e90 c02e873c c02537d4 ee323eac 
> ee323ea0 c017bd40 c02e8720
> [10733.853873] 3ea0: ee323ee4 ee323eb0 c017b250 c017bd00  
>  f3e47a54 ec128b00
> [10733.862035] 3ec0: c017b10c ee323f80 0001 c000f504 ee322000 
>  ee323f4c ee323ee8
> [10733.870197] 3ee0: c011b71c c017b118 ee323fb0 c011bc90 becfa8d9 
> 0001 ec128b00 0001
> [10733.878359] 3f00: b6f18000 ee323f80 ee323f4c ee323f18 c011bc90 
> c0063950 ee323f3c ee323f28
> [10733.886522] 3f20: c0063950 c0549138 0001 ec128b00 0001 
> ec128b00 b6f18000 ee323f80
> [10733.894684] 3f40: ee323f7c ee323f50 c011bed8 c011b6ec c0135fb8 
> c0135f24 ec128b00 ec128b00
> [10733.902847] 3f60: 0001 b6f18000 c000f504 ee322000 ee323fa4 
> ee323f80 c011c664 c011be24
> [10733.911009] 3f80:   0001 b6f18000 b6e79be0 
> 0004  ee323fa8
> [10733.919172] 3fa0: c000f340 c011c618 0001 b6f18000 0001 
> b6f18000 0001 
> [10733.927334] 3fc0: 0001 b6f18000 b6e79be0 0004 0001 
> 0001 8068a3f1 b6e79c84
> [10733.935496] 3fe0:  becfa7dc b6de194d b6e20246 400d0030 
> 0001 7a4536e8 49bda390
> [10733.943664] [] (do_raw_spin_lock) from [] 
> (_raw_spin_lock+0x18/0x1c)
> [10733.951743] [] (_raw_spin_lock) from [] 
> (fw_free_buf+0x24/0x64)
> [10733.959388] [] (fw_free_buf) from [] 
> (release_firmware+0x68/0x74)
> [10733.967207] [] (release_firmware) from [] 
> (trigger_async_request_store+0x60/0x124)
> [10733.976501] [] (trigger_async_request_store) from 
> [] (dev_attr_store+0x28/0x34)
> [10733.985533] [] (dev_attr_store) from [] 
> (sysfs_kf_write+0x4c/0x58)
> [10733.993437] [] (sysfs_kf_write) from [] 
> (kernfs_fop_write+0x144/0x1a8)
> [10734.001689] [] (kernfs_fop_write) from [] 
> (__vfs_write+0x3c/0xe4)
>
> After this patch:
>
> # printf '\x00' > 
> /sys/devices/virtual/misc/test_firmware/trigger_async_request
> [   32.126322] test_firmware: loading ''
> [   32.129995] 

Re: [PATCH] net: ezchip: fix address space confusion in nps_enet.c

2015-12-08 Thread David Miller
From: Arnd Bergmann 
Date: Tue, 08 Dec 2015 16:28:59 +0100

> The nps_enet driver happily mixes virtual, physical and __iomem
> addresses, which are all different depending on the architecture
> and configuration.  That causes a warning when building the code
> on ARM with LPAE mode enabled:
> 
> drivers/net/ethernet/ezchip/nps_enet.c: In function 'nps_enet_send_frame':
> drivers/net/ethernet/ezchip/nps_enet.c:370:13: warning: cast to pointer from 
> integer of different size [-Wint-to-pointer-cast]
> 
> but will also fail to work for other reasons.
> 
> In this patch, I'm trying to change the code to use only normal
> kernel pointers, which I assume is what the author actually meant:
> 
> * For reading or writing a 32-bit word that may be unaligned when
>   an SKB contains unaligned data, I'm using get_unaligned/put_unaligned()
>   rather than memcpy_fromio/toio.
> 
> * For converting a u8 pointer to a u32 pointer, I use a cast rather
>   than the incorrect virt_to_phys.
> 
> * For copying a couple of bytes from one place to another while respecting
>   alignment, I use memcpy instead of memcpy_toio.
> 
> Signed-off-by: Arnd Bergmann 

Applied, thanks Arnd.
--
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] bus: uniphier-system-bus: add UniPhier System Bus driver

2015-12-08 Thread Masahiro Yamada
Hi Arnd,

2015-12-09 1:59 GMT+09:00 Arnd Bergmann :
>
> Just a little thought about one thing I found odd:
>
>> +static int uniphier_system_bus_check_overlap(
>> + struct uniphier_system_bus_priv tmp)
>> +{
>
> Did you intentionally pass this by value?

Yes, I did not want to disturb the original one.

It is copied to a temporary storage, and sorted by the base address,
and discarded after the overlap checking.

But, you are right.   It is possible (and simpler)
to check the region overlap without sorting.


> Maybe do it explicitly using a pointer
> and memcpy to a local variable, which has a similar effect. Alternatively
> just check each newly probed child node for conflicts with any of the
> previous children. That is slightly more expensive at O(n^2) instead of O(n)
> but n is always small here and you can avoid sorting first.

Good idea.  I simplified this function in v4.



-- 
Best Regards
Masahiro Yamada
--
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   >