Re: [PATCH RESEND] remove the queue unlock in scsi_requset_fn

2012-08-14 Thread James Bottomley
On Tue, 2012-08-14 at 18:48 +0900, Chanho Min wrote:
 We don't need to unlock the queue before put_device in scsi_request_fn()
 If we trigger the -remove() function, It occur a oops from the caller.
 So sdev reference count should not be dropped to zero here.
 Also It was added before scsi_device_dev_release() was moved
 to user context, so it is outdated.

None of this sounds to be correct.  The user context comment is
irrelevant because if we happen to be in user context, all the release
functions will occur in line.  I also don't see why the sdev reference
couldn't drop to zero here.

The reason I think we could remove the lock drop is because the queue
reference cannot drop to zero here because the block layer is holding a
reference to run the queue.  It's only the queue -release function that
would take the queue lock and therefore we're safe to hold it.

James


 Signed-off-by: Chanho Min chanho@lge.com
 Reviewed-by: Bart Van Assche bvanass...@acm.org
 ---
  drivers/scsi/scsi_lib.c |4 
  1 files changed, 0 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
 index ffd7773..cb2185a 100644
 --- a/drivers/scsi/scsi_lib.c
 +++ b/drivers/scsi/scsi_lib.c
 @@ -1626,11 +1626,7 @@ out_delay:
   if (sdev-device_busy == 0)
   blk_delay_queue(q, SCSI_QUEUE_DELAY);
  out:
 - /* must be careful here...if we trigger the -remove() function
 -  * we cannot be holding the q lock */
 - spin_unlock_irq(q-queue_lock);
   put_device(sdev-sdev_gendev);
 - spin_lock_irq(q-queue_lock);
  }
 
  u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)


--
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/5] mm: replace vma prio_tree with an interval tree

2012-08-14 Thread Hillf Danton
On Tue, Aug 7, 2012 at 3:25 PM, Michel Lespinasse wal...@google.com wrote:

 +#define ITSTRUCT   struct vm_area_struct
 +#define ITSTART(n) ((n)-vm_pgoff)
 +#define ITLAST(n)  ((n)-vm_pgoff + \
 +   (((n)-vm_end - (n)-vm_start)  PAGE_SHIFT) - 1)

[...]

 @@ -1547,7 +1545,6 @@ static int try_to_unmap_file(struct page *page, enum 
 ttu_flags flags)
 struct address_space *mapping = page-mapping;
 pgoff_t pgoff = page-index  (PAGE_CACHE_SHIFT - PAGE_SHIFT);
 struct vm_area_struct *vma;
 -   struct prio_tree_iter iter;
 int ret = SWAP_AGAIN;
 unsigned long cursor;
 unsigned long max_nl_cursor = 0;
 @@ -1555,7 +1552,7 @@ static int try_to_unmap_file(struct page *page, enum 
 ttu_flags flags)
 unsigned int mapcount;

 mutex_lock(mapping-i_mmap_mutex);
 -   vma_prio_tree_foreach(vma, iter, mapping-i_mmap, pgoff, pgoff) {
 +   vma_interval_tree_foreach(vma, mapping-i_mmap, pgoff, pgoff) {

Given the above defines for ITSTART and ITLAST, page index perhaps could not
be used directly in scanning interval tree for vma when ttum hugetlb page?
--
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: [alsa-devel] [PATCH 08/22] ASoC: codecs: Enable AB8500 CODEC for Device Tree

2012-08-14 Thread Takashi Iwai
At Thu,  9 Aug 2012 16:47:34 +0100,
Lee Jones wrote:
 @@ -2407,6 +2464,30 @@ static int ab8500_codec_probe(struct snd_soc_codec 
 *codec)
   /* Setup AB8500 according to board-settings */
   pdata = (struct ab8500_platform_data *)dev_get_platdata(dev-parent);
  
 + if (np) {
 + if (!pdata)
 + pdata = devm_kzalloc(dev,
 + sizeof(struct ab8500_platform_data),
 + GFP_KERNEL);
 +
 + if (!pdata-codec)

The NULL check of pdata must be before pdata-codec access.


Takashi

 + pdata-codec
 + = devm_kzalloc(dev,
 + sizeof(struct 
 ab8500_codec_platform_data),
 + GFP_KERNEL);
 +
 + if (!(pdata  pdata-codec))
 + return -ENOMEM;
 +
 + ab8500_codec_of_probe(dev, np, pdata-codec);
 +
 + } else {
 + if (!(pdata  pdata-codec)) {
 + dev_err(dev, No codec platform data or DT found\n);
 + return -EINVAL;
 + }
 + }
 +
   /* Inform SoC Core that we have our own I/O arrangements. */
   codec-control_data = (void *)true;
  
 -- 
 1.7.9.5
 
 ___
 Alsa-devel mailing list
 alsa-de...@alsa-project.org
 http://mailman.alsa-project.org/mailman/listinfo/alsa-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: [alsa-devel] [PATCH 03/22] ASoC: ab8500: Inform SoC Core that we have our own I/O arrangements

2012-08-14 Thread Takashi Iwai
At Thu,  9 Aug 2012 16:47:29 +0100,
Lee Jones wrote:
 
 If codec-control_data is not populated SoC Core assumes we want to
 use regmap, which fails catastrophically, as we don't have one:
 
 Unable to handle kernel NULL pointer dereference at virtual address 0080
 pgd = c0004000
 [0080] *pgd=
 Internal error: Oops: 17 [#1] PREEMPT SMP ARM
 Modules linked in:
 CPU: 1Not tainted  (3.5.0-rc6-00884-g0b2419e-dirty #130)
 PC is at regmap_read+0x10/0x5c
 LR is at hw_read+0x80/0x90
 pc : [c01a91b8]lr : [c0216804]psr: 6013
 
 CC: alsa-de...@alsa-project.org
 Signed-off-by: Lee Jones lee.jo...@linaro.org

This was already fixed in ASoC core on Linus tree...


Takashi

 ---
  sound/soc/codecs/ab8500-codec.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
 index 3c79592..23b4018 100644
 --- a/sound/soc/codecs/ab8500-codec.c
 +++ b/sound/soc/codecs/ab8500-codec.c
 @@ -2406,6 +2406,10 @@ static int ab8500_codec_probe(struct snd_soc_codec 
 *codec)
  
   /* Setup AB8500 according to board-settings */
   pdata = (struct ab8500_platform_data *)dev_get_platdata(dev-parent);
 +
 + /* Inform SoC Core that we have our own I/O arrangements. */
 + codec-control_data = (void *)true;
 +
   status = ab8500_audio_setup_mics(codec, pdata-codec-amics);
   if (status  0) {
   pr_err(%s: Failed to setup mics (%d)!\n, __func__, status);
 -- 
 1.7.9.5
 
 ___
 Alsa-devel mailing list
 alsa-de...@alsa-project.org
 http://mailman.alsa-project.org/mailman/listinfo/alsa-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/


[PATCH] cpuidle: Prevent null pointer dereference in cpuidle_coupled_cpu_notify

2012-08-14 Thread Jon Medhurst (Tixy)
When a kernel is built to support multiple hardware types it's possible
that CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is set but the hardware the
kernel is run on doesn't support cpuidle and therefore doesn't load a
driver for it. In this case, when the system is shut down,
cpuidle_coupled_cpu_notify() gets called with cpuidle_devices set to
NULL. There are quite possibly other circumstances where this
situation can also occur and we should check for it.

Signed-off-by: Jon Medhurst t...@linaro.org
---

Would a better fix be to delay registering the notifier until
cpuidle_coupled_register_device() is called? Though following through
with that logic would require unregistering the notifier when cpuidle
driver is unregistered and it still seems possible that there would
still be a window of opportunity for things to go wrong.


 drivers/cpuidle/coupled.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 2c9bf26..c78a5ff 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -681,7 +681,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block 
*nb,
mutex_lock(cpuidle_lock);
 
dev = per_cpu(cpuidle_devices, cpu);
-   if (!dev-coupled)
+   if (!dev || !dev-coupled)
goto out;
 
switch (action  ~CPU_TASKS_FROZEN) {
-- 
1.7.10.4




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


Re: [patch net-next 01/16] net: introduce upper device lists

2012-08-14 Thread Jiri Pirko
Mon, Aug 13, 2012 at 07:52:17PM CEST, f...@redhat.com wrote:
On Mon, 13 Aug 2012 17:27:00 +0200
Jiri Pirko j...@resnulli.us wrote:

 This lists are supposed to serve for storing pointers to all upper devices.
 Eventually it will replace dev-master pointer which is used for
 bonding, bridge, team but it cannot be used for vlan, macvlan where
 there might be multiple masters present.
 
 New upper device list resolves this limitation. Also, the information
 stored in lists is used for preventing looping setups like
 bond-somethingelse-samebond
 
 Signed-off-by: Jiri Pirko j...@resnulli.us
 ---
  include/linux/netdevice.h |   14 +++
  net/core/dev.c|  232 
 -
  2 files changed, 244 insertions(+), 2 deletions(-)
 
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
 index a9db4f3..e7a07f8 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
 @@ -1173,6 +1173,8 @@ struct net_device {
* which this device is member of.
*/
  
 +struct list_headupper_dev_list; /* List of upper devices */
 +
  /* Interface address info used in eth_type_trans() */
  unsigned char   *dev_addr;  /* hw address, (before bcast
 because most packets are
 @@ -2611,6 +2613,18 @@ extern intnetdev_max_backlog;
  extern int  netdev_tstamp_prequeue;
  extern int  weight_p;
  extern int  bpf_jit_enable;
 +
 +extern bool netdev_has_upper_dev(struct net_device *dev,
 + struct net_device *upper_dev);
 +extern bool netdev_has_any_upper_dev(struct net_device *dev);
 +extern struct net_device *netdev_unique_upper_dev_get(struct net_device 
 *dev);
 +extern struct net_device *netdev_unique_upper_dev_get_rcu(struct net_device 
 *dev);
 +extern int netdev_upper_dev_link(struct net_device *dev,
 + struct net_device *upper_dev);
 +extern int netdev_unique_upper_dev_link(struct net_device *dev,
 +struct net_device *upper_dev);
 +extern void netdev_upper_dev_unlink(struct net_device *dev,
 +struct net_device *upper_dev);
  extern int  netdev_set_master(struct net_device *dev, struct 
 net_device *master);
  extern int netdev_set_bond_master(struct net_device *dev,
struct net_device *master);
 diff --git a/net/core/dev.c b/net/core/dev.c
 index 1f06df8..68db1ac 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 @@ -4425,6 +4425,229 @@ static int __init dev_proc_init(void)
  #endif  /* CONFIG_PROC_FS */
  
  
 +struct netdev_upper {
 +struct net_device *dev;
 +bool unique;

unique is quite confusing here. I see that it is possible to have 
one unique and many non-unique linked in the list, so maybe rename
to 'main_dev', 'master' or 'principal'...


 +struct list_head list;
 +struct rcu_head rcu;
 +};
 +
 +static bool __netdev_has_upper_dev(struct net_device *dev,
 +   struct net_device *upper_dev,
 +   bool deep)
 +{
 +struct netdev_upper *upper;
 +
 +list_for_each_entry(upper, dev-upper_dev_list, list) {
 +if (upper-dev == upper_dev)
 +return true;
 +if (deep  __netdev_has_upper_dev(upper-dev, upper_dev, deep))
 +return true;
 +}
 +return false;
 +}
 +
 +static struct netdev_upper *__netdev_find_upper(struct net_device *dev,
 +struct net_device *upper_dev)
 +{
 +struct netdev_upper *upper;
 +
 +list_for_each_entry(upper, dev-upper_dev_list, list) {
 +if (upper-dev == upper_dev)
 +return upper;
 +}
 +return NULL;
 +}
 +
 +/**
 + * netdev_has_upper_dev - Check if device is linked to an upper device
 + * @dev: device
 + * @upper_dev: upper device to check
 + *
 + * Find out if a device is linked to specified upper device and return true
 + * in case it is. The caller must hold the RTNL semaphore.
 + */
 +bool netdev_has_upper_dev(struct net_device *dev,
 +  struct net_device *upper_dev)
 +{
 +ASSERT_RTNL();
 +
 +return __netdev_has_upper_dev(dev, upper_dev, false);
 +}
 +EXPORT_SYMBOL(netdev_has_upper_dev);
 +
 +/**
 + * netdev_has_any_upper_dev - Check if device is linked to some device
 + * @dev: device
 + *
 + * Find out if a device is linked to an upper device and return true in case
 + * it is. The caller must hold the RTNL semaphore.
 + */
 +bool netdev_has_any_upper_dev(struct net_device *dev)
 +{
 +ASSERT_RTNL();
 +
 +return !list_empty(dev-upper_dev_list);
 +}
 +EXPORT_SYMBOL(netdev_has_any_upper_dev);
 +
 +/**
 + * netdev_unique_upper_dev_get - Get unique upper device
 + * @dev: device
 + *
 + * Find a unique upper device and 

Re: [PATCH 2/4] fsl_pmc: Add API to enable device as wakeup event source

2012-08-14 Thread Tabi Timur-B04825
Zhao Chenhui wrote:
  +#ifdef CONFIG_FSL_PMC
  +extern int mpc85xx_pmc_set_wake(struct device *dev, bool enable);
  +extern void mpc85xx_pmc_set_lossless_ethernet(int enable);
 
 Don't use 'extern' for functions.
 
 Why? I think there is no difference.

It's unnecessary, and it makes the line longer.

-- 
Timur Tabi
Linux kernel developer at Freescale
--
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: mmotm 2012-08-13-16-55 uploaded

2012-08-14 Thread Glauber Costa
On 08/14/2012 02:53 PM, Michal Hocko wrote:
 On Mon 13-08-12 16:56:50, Andrew Morton wrote:
  The mm-of-the-moment snapshot 2012-08-13-16-55 has been uploaded to
  
 http://www.ozlabs.org/~akpm/mmotm/
 -mm git tree has been updated as well. You can find the tree at
 https://github.com/mstsxfx/memcg-devel.git since-3.5
 
 tagged as mmotm-2012-08-13-16-55
 

On top of this tree, people following the kmemcg development may also
want to checkout

   git://github.com/glommer/linux.git memcg-3.5/kmemcg-stack

A branch called memcg-3.5/kmemcg-slab is also available with the slab
changes ontop.

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: How to hack syscall-table, in kernel 2.6+ ?

2012-08-14 Thread Alan Cox
 I have already tried extracting the address of the sys_call_table
 from System.Map; however, I am still not able to replace the
 function-pointers with mine.

Correct.

 Trying to do gives me page-faults, apparently meaning that the
 syscall-table memory area is read-only.

Correct.

The kernel is specifically designed to stop such uses by rootkits and
trojans and other malware.

If you are trying to patch the system call table you are doing something
wrong. What are you actually trying to achieve ?
--
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/


Q: Seeing the microcode revision in /proc/cpuinfo

2012-08-14 Thread Ulrich Windl
Hi!

After several reboots due to memory errors after excellent power-saving of 
Linux on a HP DL380G7 with Intel Xeon 5650 processors (all in on memory bank), 
I found out the errate BD104 and BD123. The former should be fixed in a 
microcode revision 15H.

Now I wonder what microcode revision my CPUs currently have. /proc/cpuinfo 
doesn't show that, and the microcode update is a bit cryptic:

kernel: [   44.422912] microcode: CPU23 sig=0x206c2, pf=0x1, revision=0x14

Does that mean the revision is 0x14 BEFORE or AFTER the microcode update?

Wouldn't you agree that seeing the microcode revision in /proc/cpuinfo would be 
nice?

For those CPUs lacking the feature one could hard-wire the value none (which 
would be also kind of true)...

Regards,
Ulrich
(not subscribed, so please CC: you replies to me)


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


RE: [PATCH 3/5] net/mlx4_en: Call netif_carrier_off() after register_netdev()

2012-08-14 Thread Sathya.Perla
-Original Message-
From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] On
Behalf Of Ilya Shchepetkov

For carrier detection to work properly when binding the driver with a
cable unplugged, netif_carrier_off() should be called after
register_netdev(), not before.

Calling netif_carrier_off() before register_netdev() was causing the
network interface to miss a linkwatch pending event leading to an
inconsistent state if the link is not up when interface is initialized.

ndo_open() may be called as soon register_netdev() completes...
When netif_carrier_off() is called *after* register_netdev(), isn't there
a possibility of a ndo_open()-netif_carrier_on() call racing this call, causing
incorrect results?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] gpio fixes for v3.6-rc1

2012-08-14 Thread Linus Walleij
On Mon, Aug 13, 2012 at 4:36 PM, Arnd Bergmann a...@arndb.de wrote:
 On Friday 10 August 2012, Linus Walleij wrote:
 Daniel Mack (1):
   GPIO: gpio-pxa: fix devicetree functions


 Unfortunately, this one caused a build regression, see the fix below.
 I also wonder why pxa_irq_domain_ops isn't static.

 Arnd

 8
 GPIO: gpio-pxa: fix building without CONFIG_OF

 Patch 7212157267 GPIO: gpio-pxa: fix devicetree functions added an
 xlate function pointer to the irq_domain_ops, but this function
 is nor declared or defined anywhere when CONFIG_OF is disabled, causing
 the build error:

 drivers/gpio/gpio-pxa.c:532:11: error: 'irq_domain_xlate_twocell' undeclared 
 here (not in a function)

 Extending the DT-only code section to cover the irq_domain_ops
 and the pxa_gpio_dt_ids solves this problem and makes it clearer
 which code is actually used without DT.

 Signed-off-by: Arnd Bergmann a...@arndb.de

Thanks, applied this to my fixes branch.

Yours,
Linus Walleij
--
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] gpio: Fix debug message in of_get_named_gpio_flags()

2012-08-14 Thread Linus Walleij
On Thu, Aug 9, 2012 at 8:38 AM, Thierry Reding
thierry.red...@avionic-design.de wrote:

 This was probably missed in the conversion done in commit 3d0f7cf
 (gpio: Adjust of_xlate API to support multiple GPIO chips).

 Signed-off-by: Thierry Reding thierry.red...@avionic-design.de

Applied to my fixes branch, Grant: complain if it looks wrong.

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


Re: [GIT PULL] Update LZO compression

2012-08-14 Thread Johannes Stezenbach
On Tue, Aug 14, 2012 at 01:44:02AM +0200, Markus F.X.J. Oberhumer wrote:
 On 2012-07-16 20:30, Markus F.X.J. Oberhumer wrote:
 
  As stated in the README this version is significantly faster (typically more
  than 2 times faster!) than the current version, has been thoroughly tested 
  on
  x86_64/i386/powerpc platforms and is intended to get included into the
  official Linux 3.6 or 3.7 release.
 
  I encourage all compression users to test and benchmark this new version,
  and I also would ask some official LZO maintainer to convert the updated
  source files into a GIT commit and possibly push it to Linus or linux-next.

Sorry for not reporting earlier, but I didn't have time to do real
benchmarks, just a quick test on ARM926EJ-S using barebox,
and found in the new version decompression is slower:
http://lists.infradead.org/pipermail/barebox/2012-July/008268.html

BTW, do you have userspace code matching the old and new
lzo versions?  It would be easier to benchmark.

Unfortunately I cannot claim high confidence in my benchmark results
due to missing time to do it properly, it would be useful if
someone else could do some benchmarks on ARM before merging this.


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


Re: [PATCH v7 2/2] kvm: KVM_EOIFD, an eventfd for EOIs

2012-08-14 Thread Avi Kivity
On 08/12/2012 12:33 PM, Michael S. Tsirkin wrote:
 
 Michael, would the interface be more acceptable to you if we added
 separate ioctls to allocate and free some representation of an irq
 source ID, gsi pair?  For instance, an ioctl might return an idr entry
 for an irq source ID/gsi object which would then be passed as a
 parameter in struct kvm_irqfd and struct kvm_eoifd so that the object
 representing the source id/gsi isn't magically freed on it's own.  This
 would also allow us to deassign/close one end and reconfigure it later.
 Thanks,
 
 Alex
 
 It's acceptable to me either way. I was only pointing out that as
 designed, the interface looks simple at first but then you find out some
 subtle limitations which are implementation driven. This gives
 an overall feeling the abstraction is too low level.
 
 If we compare to the existing irqfd, isn't the difference
 simply that irqfd deasserts immediately ATM, while we
 want to delay this until later?
 
 If yes, then along the lines that you proposed, and combining with my
 idea of tracking deasserts, how do you like the following:
 
 /* Keep line asserted until guest has handled the interrupt. */
 #define KVM_IRQFD_FLAG_DEASSERT_ON_ACK (1  1)
 /* Notify after line is deasserted. */
 #define KVM_IRQFD_FLAG_DEASSERT_EVENTFD (2  1)
 
   struct kvm_irqfd {
   __u32 fd;
   __u32 gsi;
   __u32 flags;
   /* eventfd to notify when line is deasserted */
   __u32 deassert_eventfd;
   __u8  pad[16];
   };
 
 now the only limitation is that KVM_IRQFD_FLAG_DEASSERT_ON_ACK is only
 effective for level interrupts.
 
 Notes about lifetime of objects:
   - closing deassert_eventfd does nothing (we can keep
 reference to it from irqfd so no need for
   complex polling/flushing scheme)
   - closing irqfd or deasserting dis-associates
 deassert_eventfd automatically
   - source id is internal to irqfd and goes away with it
 
 it looks harder to misuse and fits what we want to do nicely,
 and needs less code to implement.
 
 Avi, what do you think?

I think given all the complexity in the separate ioctl approach that
this makes sense.  There are no lifetime issues or code to match the two
eventfds.  Alex, would this API simplify the code?

Yet another option was raised in the past, and that was exiling ioapic
and pic to userspace.  This moves the entire issue to userspace.  The
cost is a new interface that implements the APIC bus (betweem APIC and
IOAPIC) and the INTACK sequence (between APIC and PIC), and potential
for performance regressions due to the PIC, IOAPIC, and PIT being in
userspace.  We would still have to keep the IOAPIC/PIC in the kernel,
but no new features would be added.

However, this is a huge job.  We could discuss this to death too but I
have the feeling the end result will be to choose the shorter path --
adding irqackfd/deassertfd/whateverwecallitfd.


-- 
error compiling committee.c: too many arguments to function
--
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] preempt/hardirq.h: Clarify PREEMPT_ACTIVE bit location

2012-08-14 Thread Steven Rostedt
On Tue, 2012-08-14 at 12:18 +0200, Thomas Gleixner wrote:
 On Tue, 14 Aug 2012, Srivatsa S. Bhat wrote:
 
  
  By default, the PREEMPT_ACTIVE flag is bit 27, but different
  architectures can override that. Update the comment to reflect
  this fact.
 
 Is there any sensible reason why architectures need to override that?
 I can't find one.
 
 If there is none, then we should just remove all the overrides from
 the arch code instead. If there is a reason, then it should be
 documented.

IIRC, when I added the NMI bits to implement 'in_nmi()' I tried to make
this work across archs. But I found that bits in the preempt count have
been hard coded in assembly all over the place, and to clean it up
looked to be a nightmare.

It probably should be done, but I didn't have the time to do it then.
Perhaps we can revisit it.

In fact, looking at all the archs, I believe all archs override the
PREEMPT_ACTIVE bit, and not one of them uses the default (bit 27).

-- Steve


--
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 4/5] USB: Add EHCI bus glue for Loongson1x SoCs (UPDATED)

2012-08-14 Thread Florian Fainelli
Hello Kelvin,

On Wednesday 18 January 2012 14:41:16 Kelvin Cheung wrote:
 Use ehci_setup() in ehci_ls1x_reset().
 
 The Loongson1x SoCs have a built-in EHCI controller.
 This patch adds the necessary glue code to make the generic EHCI
 driver usable for them.
 
 Signed-off-by: Kelvin Cheung keguang.zh...@gmail.com
 ---

I do not see this driver doing anything fancy which would require an entirely 
new ehci implementation so consider using the generic ehci platform driver 
(drivers/usb/host/ehci-platforms.c) instead.

  drivers/usb/Kconfig  |1 +
  drivers/usb/host/ehci-hcd.c  |5 ++
  drivers/usb/host/ehci-ls1x.c |  159 
++
  3 files changed, 165 insertions(+), 0 deletions(-)
  create mode 100644 drivers/usb/host/ehci-ls1x.c
 
 diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
 index 85d5a01..78ac78b 100644
 --- a/drivers/usb/Kconfig
 +++ b/drivers/usb/Kconfig
 @@ -68,6 +68,7 @@ config USB_ARCH_HAS_EHCI
   default y if ARCH_MSM
   default y if MICROBLAZE
   default y if SPARC_LEON
 + default y if MACH_LOONGSON1

Do this in arch/mips/Kconfig instead.
--
Florian
--
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/1] boot: Put initcall_debug into its own Kconfig option DEBUG_INITCALL

2012-08-14 Thread Josh Triplett
On Tue, Aug 14, 2012 at 08:03:41AM -0400, Josh Boyer wrote:
 On Mon, Aug 13, 2012 at 9:18 PM, Josh Triplett j...@joshtriplett.org wrote:
  On Mon, Aug 13, 2012 at 03:39:54PM -0700, Randy Dunlap wrote:
  On 08/13/2012 03:08 PM, Thai Bui wrote:
  Hi all,
  
  I am as part of a capstone group at Portland State University is working
  to tinify the kernel as small as possible. The ultimate goal is to make
  the kernel small enough to use on micro-controller (or under  200k).
  This patch is one of them, it saves 176 bytes on a minimal configuration
  of the kernel (the bzImage file was reduced from 363264 bytes to 363264
  bytes applying this patch).
  
  Aside from the purpose of reducing the size of the kernel. We are also
  trying to clean up the kernel by making Kconfig options to compile out
  the stuffs that aren't used often.
 
  IMO the kernel already has too many kconfig options.
 
  Also, personally I would not merge a patch that saves so little memory,
  especially on what I consider a very useful option.
 
  I think Thai undersold his patch significantly; the *compressed* size
  went down by 176 bytes, and the uncompressed size went down more than
  that.  And that's the savings starting from a very minimal kernel, not
  starting from a defconfig kernel.
 
  In any case, do you object to the introduction of a Kconfig option at
  all, or to that option defaulting to off?  In particular, would you
  object if the option only showed up if EMBEDDED, and defaulted to y?  At
  that point, you could reasonably expect that most users and distros will
  have it enabled, so you'll be able to count on asking people to enable
  it and send you the output.  Would that suffice?
 
 Hiding it behind EMBEDDED might be a start.  From a distro perspective,
 we actually use this particular option quite often so keeping the
 ability to use it as you describe is important.

Fair enough.

  The patch itself seems incredibly straightforward and non-invasive to
  me; it just stubs out the global variable and lets GCC fold away all the
  code.
 
  At this point, the kernel is running out of major things to cut out to
  save space; getting from ~200k (the current smallest kernel possible) to
  much less than that will require a pile of patches that save anywhere
  from a few hundred bytes to a few kilobytes.  I certainly agree that
  those patches need to avoid introducing too much complexity.  However, I
  don't think it makes sense to object to a patch that saves space solely
  on the grounds that it doesn't save *more* space.  That would make it
  impossible to cut out small things, and small things add up.
 
 If you're really going to pursue that, I'd suggest hiding the removals
 behind a new option that most people won't set.

Most of the other options added via this project have used EXPERT or
EMBEDDED.  This one originally seemed enough like a debugging option to
warrant just using DEBUG_KERNEL and let it default to N, but it sounds
like this one needs to use EMBEDDED as well.

- Josh Triplett
--
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/1] [RFC] uartclk from serial_core exposed to sysfs

2012-08-14 Thread Marek Vasut
Dear Tomas Hlavacek,

 Support for read/modify of uartclk via sysfs added.
 It may prove useful with some no-name cards that
 has different oscillator speeds and no distinguishing
 PCI IDs to allow autodetection. It allows better integration
 with udev and/or init scripts.
 
 Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
 ---
  drivers/tty/serial/serial_core.c |   54
 ++ drivers/tty/tty_io.c | 
  17 
  include/linux/tty.h  |2 ++
  3 files changed, 73 insertions(+)
 
 diff --git a/drivers/tty/serial/serial_core.c
 b/drivers/tty/serial/serial_core.c index a21dc8e..059b438 100644
 --- a/drivers/tty/serial/serial_core.c
 +++ b/drivers/tty/serial/serial_core.c
 @@ -2293,6 +2293,46 @@ struct tty_driver *uart_console_device(struct
 console *co, int *index) return p-tty_driver;
  }
 
 +static ssize_t get_attr_uartclk(struct device *dev,
 + struct device_attribute *attr, char *buf)
 +{
 + int ret;
 +
 + struct uart_state *state = (struct uart_state *)(dev_get_drvdata(dev));

You don't need this cast here.

 + mutex_lock(state-port.mutex);
 + ret = snprintf(buf, PAGE_SIZE, %d\n, state-uart_port-uartclk);

Do you really need such a large buffer (PAGE_SIZE) ?

 + mutex_unlock(state-port.mutex);
 + return ret;
 +}
 +
 +static ssize_t set_attr_uartclk(struct device *dev,
 + struct device_attribute *attr, const char *buf, size_t count)
 +{
 + struct uart_state *state = (struct uart_state *)(dev_get_drvdata(dev));
 + unsigned int val;
 + int ret;
 +
 + ret = kstrtouint(buf, 10, val);
 + if (ret)
 + return ret;
 +
 + mutex_lock(state-port.mutex);
 +
 + /*
 +  * Check value: baud_base has to be more than 9600
 +  * and uartclock = baud_base * 16 .
 +  */
 + if (val = 153600)
 + state-uart_port-uartclk = val;

This magic value here would use some documentation.

 + mutex_unlock(state-port.mutex);
 +
 + return count;
 +}
 +
 +static DEVICE_ATTR(uartclk, S_IRUGO | S_IWUSR, get_attr_uartclk,
 + set_attr_uartclk);
 +
  /**
   *   uart_add_one_port - attach a driver-defined port structure
   *   @drv: pointer to the uart low level driver structure for this port
 @@ -2355,6 +2395,14 @@ int uart_add_one_port(struct uart_driver *drv,
 struct uart_port *uport) }
 
   /*
 +  * Expose uartclk in sysfs. Use driverdata of the tty device for
 +  * referencing the UART port.
 +  */
 + dev_set_drvdata(tty_dev, state);
 + if (device_create_file(tty_dev, dev_attr_uartclk)  0)
 + dev_err(tty_dev, Failed to add uartclk attr\n);
 +
 + /*
* Ensure UPF_DEAD is not set.
*/
   uport-flags = ~UPF_DEAD;
 @@ -2397,6 +2445,12 @@ int uart_remove_one_port(struct uart_driver *drv,
 struct uart_port *uport) mutex_unlock(port-mutex);
 
   /*
 +  * Remove uartclk file from sysfs.
 +  */
 + device_remove_file(tty_lookup_device(drv-tty_driver, uport-line),
 + dev_attr_uartclk);
 +
 + /*
* Remove the devices from the tty layer
*/
   tty_unregister_device(drv-tty_driver, uport-line);
 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
 index b425c79..8ea8622 100644
 --- a/drivers/tty/tty_io.c
 +++ b/drivers/tty/tty_io.c
 @@ -3049,6 +3049,23 @@ void tty_unregister_device(struct tty_driver
 *driver, unsigned index) }
  EXPORT_SYMBOL(tty_unregister_device);
 
 +/*
 + *   tty_lookup_device - lookup a tty device
 + *   @driver: the tty driver that describes the tty device
 + *   @index: the index in the tty driver for this tty device
 + *
 + *   This function returns a struct device pointer when device has
 + *   been found and NULL otherwise.
 + *
 + *   Locking: ??
 + */
 +struct device *tty_lookup_device(struct tty_driver *driver, unsigned
 index) +{
 + dev_t devt = MKDEV(driver-major, driver-minor_start) + index;
 + return class_find_device(tty_class, NULL, devt, dev_match_devt);
 +}
 +EXPORT_SYMBOL(tty_lookup_device);
 +
  struct tty_driver *__alloc_tty_driver(int lines, struct module *owner)
  {
   struct tty_driver *driver;
 diff --git a/include/linux/tty.h b/include/linux/tty.h
 index 9f47ab5..5d408a1 100644
 --- a/include/linux/tty.h
 +++ b/include/linux/tty.h
 @@ -410,6 +410,8 @@ extern int tty_register_driver(struct tty_driver
 *driver); extern int tty_unregister_driver(struct tty_driver *driver);
  extern struct device *tty_register_device(struct tty_driver *driver,
 unsigned index, struct device *dev);
 +extern struct device *tty_lookup_device(struct tty_driver *driver,
 + unsigned index);
  extern void tty_unregister_device(struct tty_driver *driver, unsigned
 index); extern int tty_read_raw_data(struct tty_struct *tty, unsigned char
 *bufp, int buflen);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the 

Re: [PATCH RFC] Fix /usr/bin/xargs: rm: Argument list too long during make distclean

2012-08-14 Thread David Cullen
On 8/13/2012 5:01 PM, H. Peter Anvin wrote:
 On 08/13/2012 01:56 PM, David Cullen wrote:

 That sounds like a bug in xargs...


 In my specific case, qemu-arm-static calls xargs (In fact, in my
 cross chroot, qemu-arm-static is used to run every user mode process).

 Do you mean that qemu-arm-static is exposing a latent defect in xargs?

 Does qemu-arm-static steal some of the command line space that would
 normally be available for xargs? If so, how would xargs figure out
 this was happening and handle the problem?

 
 I have no idea.  Perhaps strace can help you see what is happening, I
 don't know.  More likely it is qemu-arm-static that is broken and it is
 trying to enforce the old 128K limit that we used to have before 2.6.23.
  This could cause a mismatch between what sysconf(_SC_ARG_MAX) returns
 and what the actual limit is.
 
 Anyway, even more so the reason to reject this patch.


I submitted a bug report on xargs:

http://savannah.gnu.org/bugs/index.php?37093

I also submitted a bug report on QEMU:

https://bugs.launchpad.net/qemu/+bug/1036645


Re: [net PATCH v2 2/2] net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

2012-08-14 Thread Neil Horman
On Mon, Aug 13, 2012 at 07:43:27PM -0700, John Fastabend wrote:
 A socket fd passed in a SCM_RIGHTS datagram was not getting
 updated with the new tasks cgrp prioidx. This leaves IO on
 the socket tagged with the old tasks priority.
 
 To fix this add a check in the scm recvmsg path to update the
 sock cgrp prioidx with the new tasks value.
 
 Thanks to Al Viro for catching this.
 
 CC: Neil Horman nhor...@tuxdriver.com
 Reported-by: Al Viro v...@zeniv.linux.org.uk
 Signed-off-by: John Fastabend john.r.fastab...@intel.com
 ---
 
  net/core/scm.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/net/core/scm.c b/net/core/scm.c
 index 8f6ccfd..a14d9e2 100644
 --- a/net/core/scm.c
 +++ b/net/core/scm.c
 @@ -249,6 +249,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie 
 *scm)
   struct file **fp = scm-fp-fp;
   int __user *cmfptr;
   int err = 0, i;
 + __u32 prioidx = task_netprioidx(current);
  
   if (MSG_CMSG_COMPAT  msg-msg_flags) {
   scm_detach_fds_compat(msg, scm);
 @@ -265,6 +266,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie 
 *scm)
   for (i=0, cmfptr=(__force int __user *)CMSG_DATA(cm); ifdmax;
i++, cmfptr++)
   {
 + struct socket *sock;
   int new_fd;
   err = security_file_receive(fp[i]);
   if (err)
 @@ -281,6 +283,9 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie 
 *scm)
   }
   /* Bump the usage count and install the file. */
   get_file(fp[i]);
 + sock = sock_from_file(fp[i], err);
 + if (sock)
 + sock-sk-sk_cgrp_prioidx = prioidx;
nit: You can replace the prioidx variable above and this set with a call to
sock_update_netprioidx

Neil

--
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: [net PATCH v2 1/2] net: netprio: fix files lock and remove useless d_path bits

2012-08-14 Thread Neil Horman
On Mon, Aug 13, 2012 at 07:43:21PM -0700, John Fastabend wrote:
 Add lock to prevent a race with a file closing and also remove
 useless and ugly sscanf code. The extra code was never needed
 and the case it supposedly protected against is in fact handled
 correctly by sock_from_file as pointed out by Al Viro.
 
 CC: Neil Horman nhor...@tuxdriver.com
 Reported-by: Al Viro v...@zeniv.linux.org.uk
 Signed-off-by: John Fastabend john.r.fastab...@intel.com
 ---
 
  net/core/netprio_cgroup.c |   22 --
  1 files changed, 4 insertions(+), 18 deletions(-)
 
 diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
 index ed0c043..f65dba3 100644
 --- a/net/core/netprio_cgroup.c
 +++ b/net/core/netprio_cgroup.c
 @@ -277,12 +277,6 @@ out_free_devname:
  void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
  {
   struct task_struct *p;
 - char *tmp = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
 -
 - if (!tmp) {
 - pr_warn(Unable to attach cgrp due to alloc failure!\n);
 - return;
 - }
  
   cgroup_taskset_for_each(p, cgrp, tset) {
   unsigned int fd;
 @@ -296,32 +290,24 @@ void net_prio_attach(struct cgroup *cgrp, struct 
 cgroup_taskset *tset)
   continue;
   }
  
 - rcu_read_lock();
 + spin_lock(files-file_lock);
   fdt = files_fdtable(files);
   for (fd = 0; fd  fdt-max_fds; fd++) {
 - char *path;
   struct file *file;
   struct socket *sock;
 - unsigned long s;
 - int rv, err = 0;
 + int err;
  
   file = fcheck_files(files, fd);
   if (!file)
   continue;
  
 - path = d_path(file-f_path, tmp, PAGE_SIZE);
 - rv = sscanf(path, socket:[%lu], s);
 - if (rv = 0)
 - continue;
 -
   sock = sock_from_file(file, err);
 - if (!err)
 + if (sock)
   sock_update_netprioidx(sock-sk, p);
   }
 - rcu_read_unlock();
 + spin_unlock(files-file_lock);
   task_unlock(p);
   }
 - kfree(tmp);
  }
  
  static struct cftype ss_files[] = {
 
This looks ok to me, but I've already shown my inability to review code that
interfaces with VFS.  Al, what do you think?

Neil

 --
 To unsubscribe from this list: send the line unsubscribe netdev 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/


[PATCH 2/5] drivers/dma/amba-pl08x.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/dma/amba-pl08x.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 6fbeebb..d1cc579 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1892,6 +1892,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
pl08x-pd = dev_get_platdata(adev-dev);
if (!pl08x-pd) {
dev_err(adev-dev, no platform data supplied\n);
+   ret = -EINVAL;
goto out_no_platdata;
}
 
@@ -1943,6 +1944,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
dev_err(adev-dev, %s failed to allocate 
physical channel holders\n,
__func__);
+   ret = -ENOMEM;
goto out_no_phychans;
}
 

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


[PATCH 3/5] drivers/net/ethernet/freescale/fs_enet: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c |4 +++-
 drivers/net/ethernet/freescale/fs_enet/mii-fec.c |8 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c 
b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
index 0f2d1a7..1514533 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
@@ -174,8 +174,10 @@ static int __devinit fs_enet_mdio_probe(struct 
platform_device *ofdev)
 
new_bus-phy_mask = ~0;
new_bus-irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
-   if (!new_bus-irq)
+   if (!new_bus-irq) {
+   ret = -ENOMEM;
goto out_unmap_regs;
+   }
 
new_bus-parent = ofdev-dev;
dev_set_drvdata(ofdev-dev, new_bus);
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c 
b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
index 55bb867..cdf702a 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
@@ -137,8 +137,10 @@ static int __devinit fs_enet_mdio_probe(struct 
platform_device *ofdev)
snprintf(new_bus-id, MII_BUS_ID_SIZE, %x, res.start);
 
fec-fecp = ioremap(res.start, resource_size(res));
-   if (!fec-fecp)
+   if (!fec-fecp) {
+   ret = -ENOMEM;
goto out_fec;
+   }
 
if (get_bus_freq) {
clock = get_bus_freq(ofdev-dev.of_node);
@@ -172,8 +174,10 @@ static int __devinit fs_enet_mdio_probe(struct 
platform_device *ofdev)
 
new_bus-phy_mask = ~0;
new_bus-irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
-   if (!new_bus-irq)
+   if (!new_bus-irq) {
+   ret = -ENOMEM;
goto out_unmap_regs;
+   }
 
new_bus-parent = ofdev-dev;
dev_set_drvdata(ofdev-dev, new_bus);

--
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/5] fix error return code

2012-08-14 Thread Julia Lawall
These patches fix cases where the return code appears to be unintentially 0.

The complete semantic match that finds the problem is as follows:
(http://coccinelle.lip6.fr/)

// smpl
@r@
identifier f;
expression ret,e;
constant C;
@@

f(...) { +...
(
return -C;
|
ret = -C
... when != ret = e
return ret;
|
if (ret  0) { ... return ret; }
)
...+ }

@s@
identifier r.f,ret;
@@

f(...) { +... return ret; ...+ }

@@
identifier r.f,s.ret;
expression e,e1,e2,e3,e4,x;
@@

f(...) { +...
(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
...+ }
// /smpl

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


[PATCH 5/5] drivers/infiniband/hw/qib/qib_iba7322.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/infiniband/hw/qib/qib_iba7322.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c 
b/drivers/infiniband/hw/qib/qib_iba7322.c
index 0d7280a..3f6b21e 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -6346,8 +6346,10 @@ static int qib_init_7322_variables(struct qib_devdata 
*dd)
dd-piobcnt4k * dd-align4k;
dd-piovl15base = ioremap_nocache(vl15off,
  NUM_VL15_BUFS * dd-align4k);
-   if (!dd-piovl15base)
+   if (!dd-piovl15base) {
+   ret = -ENOMEM;
goto bail;
+   }
}
qib_7322_set_baseaddrs(dd); /* set chip access pointers now */
 

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


[PATCH 4/5] drivers/net/ethernet/mellanox/mlx4/mcg.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/net/ethernet/mellanox/mlx4/mcg.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c 
b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index 4ec3835..a018ea2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -432,8 +432,10 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
if ((be32_to_cpu(mgm-qp[i])  MGM_QPN_MASK) == qpn) {
/* Entry already exists, add to duplicates */
dqp = kmalloc(sizeof *dqp, GFP_KERNEL);
-   if (!dqp)
+   if (!dqp) {
+   err = -ENOMEM;
goto out_mailbox;
+   }
dqp-qpn = qpn;
list_add_tail(dqp-list, entry-duplicates);
found = true;

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


[PATCH 1/5] drivers/cdrom/gdrom.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret  0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = 
\(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/cdrom/gdrom.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 3ceaf00..f05863b 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -808,16 +808,20 @@ static int __devinit probe_gdrom(struct platform_device 
*devptr)
if (err)
goto probe_fail_cmdirq_register;
gd.gdrom_rq = blk_init_queue(gdrom_request, gdrom_lock);
-   if (!gd.gdrom_rq)
+   if (!gd.gdrom_rq) {
+   err = -ENOMEM;
goto probe_fail_requestq;
+   }
 
err = probe_gdrom_setupqueue();
if (err)
goto probe_fail_toc;
 
gd.toc = kzalloc(sizeof(struct gdromtoc), GFP_KERNEL);
-   if (!gd.toc)
+   if (!gd.toc) {
+   err = -ENOMEM;
goto probe_fail_toc;
+   }
add_disk(gd.disk);
return 0;
 

--
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: DT GPIO numbering?

2012-08-14 Thread Johannes Stezenbach
On Tue, Aug 14, 2012 at 12:00:23PM +0200, Linus Walleij wrote:
 On Fri, Aug 10, 2012 at 11:34 AM, Johannes Stezenbach j...@sig21.net wrote:
 
  Actually I think the kernel internal GPIO numbers shouldn't be in the
  sysfs API, instead userspace should use the names.
 
 This is true, but we cannot remove these numbers because they
 are now in Documentation/ABI/testing/sysfs-gpio
 
 And while the testing ABI is, well for testing, it would probably
 break a lot of stuff it we removed it.
 
 But we can sure add names. However these would still sit under
 /sys/class/gpio/gpioN/name
 
 Or do you suggest we simply duplicate all GPIOs which have
 names under /sys/class/gpio/named/name
 or something like that?

I'm still not sure.  One idea was to add /proc/gpios which maps
names to numbers, then userspace can look up the number and use that.
But the more I think about it /sys/class/gpio/export is just
a debug hack and shouldn't be used.  Board code should export
the available gpio according to pinctrl setup and schematics.
The only catch here is that board code then needs to know which gpio are
for userspace and which are used by in-kernel drivers.
E.g. a LED could be set by LED Triggers or by userspace
Blinkenlight app.


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


Re: Q: Seeing the microcode revision in /proc/cpuinfo

2012-08-14 Thread Borislav Petkov
On Tue, Aug 14, 2012 at 02:35:40PM +0200, Ulrich Windl wrote:
 Hi!
 
 After several reboots due to memory errors after excellent power-saving of 
 Linux on a HP DL380G7 with Intel Xeon 5650 processors (all in on memory 
 bank), I found out the errate BD104 and BD123. The former should be fixed 
 in a microcode revision 15H.
 
 Now I wonder what microcode revision my CPUs currently have. /proc/cpuinfo 
 doesn't show that, and the microcode update is a bit cryptic:
 
 kernel: [   44.422912] microcode: CPU23 sig=0x206c2, pf=0x1, revision=0x14
 
 Does that mean the revision is 0x14 BEFORE or AFTER the microcode update?
 
 Wouldn't you agree that seeing the microcode revision in /proc/cpuinfo would 
 be nice?

Well, you must be using an old-ish kernel because the microcode revision
infact *is* in /proc/cpuinfo:

processor   : 1
...
stepping: 0
microcode   : 0x528

This is on 3.6-rc1 and that functionality is upstream since 3.2.

HTH.

-- 
Regards/Gruss,
Boris.
--
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 5/5] drivers/infiniband/hw/qib/qib_iba7322.c: fix error return code

2012-08-14 Thread Marciniszyn, Mike
 Subject: [PATCH 5/5] drivers/infiniband/hw/qib/qib_iba7322.c: fix error
 return code
 
 From: Julia Lawall julia.law...@lip6.fr

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


Re: [patch net-next 01/16] net: introduce upper device lists

2012-08-14 Thread Flavio Leitner
On Tue, 14 Aug 2012 14:24:33 +0200
Jiri Pirko j...@resnulli.us wrote:

 Mon, Aug 13, 2012 at 07:52:17PM CEST, f...@redhat.com wrote:
 On Mon, 13 Aug 2012 17:27:00 +0200
 Jiri Pirko j...@resnulli.us wrote:
  +  /*
  +   * To prevent loops, check if dev is not upper device to upper_dev.
  +   */
  +  if (__netdev_has_upper_dev(upper_dev, dev, true))
  +  return -EBUSY;
  +
  +  if (__netdev_find_upper(dev, upper_dev))
  +  return -EEXIST;
 
 __netdev_has_upper_dev() can go all the way up finding the device and
 the __netdev_find_upper() just check the first level.
 
 
 I do not think this ordering is somewhat inportant.

it's not the order, see below:

 I think it would be better to use:
 __netdev_find_upper_dev(,,deep=true/false)
 __netdev_has_upper(,)

It's their names.  Currently, the function ..._find_... look at
one level only, while the function ..._has_... does one or more
levels.  I think it's better to swap 'has' and 'find' in their names:

__netdev_find_upper_dev(,,deep=true/false) -- find in all levels
__netdev_has_upper(,)  -- check only the one level.

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


Antw: Re: Q: Seeing the microcode revision in /proc/cpuinfo

2012-08-14 Thread Ulrich Windl
Hi Borislav,

probably my edge is not bleeding that much than yours ;-)

I don't see microcode in 3.0.34-0.7-default for an AMD Opteron, and not in  
2.6.32.59-0.3-default for the Intel Xeon. Both are kernels of SLES11 xon 
x86_64. The first one is the latest you can get for SLES11 SP2.

In openSUSE 12.1 (kernel 3.1.10) it's also still missing.

Anyway, it's nice to see that others also thought this feature is useful.

Thanks  best regards,
Ulrich

 Borislav Petkov b...@alien8.de schrieb am 14.08.2012 um 15:12 in Nachricht
20120814131211.ga25...@x1.osrc.amd.com:
 On Tue, Aug 14, 2012 at 02:35:40PM +0200, Ulrich Windl wrote:
  Hi!
  
  After several reboots due to memory errors after excellent power-saving of 
 Linux on a HP DL380G7 with Intel Xeon 5650 processors (all in on memory 
 bank), I found out the errate BD104 and BD123. The former should be fixed 
 in a microcode revision 15H.
  
  Now I wonder what microcode revision my CPUs currently have. /proc/cpuinfo 
 doesn't show that, and the microcode update is a bit cryptic:
  
  kernel: [   44.422912] microcode: CPU23 sig=0x206c2, pf=0x1, revision=0x14
  
  Does that mean the revision is 0x14 BEFORE or AFTER the microcode update?
  
  Wouldn't you agree that seeing the microcode revision in /proc/cpuinfo 
 would be nice?
 
 Well, you must be using an old-ish kernel because the microcode revision
 infact *is* in /proc/cpuinfo:
 
 processor   : 1
 ...
 stepping: 0
 microcode   : 0x528
 
 This is on 3.6-rc1 and that functionality is upstream since 3.2.
 
 HTH.
 
 -- 
 Regards/Gruss,
 Boris.
 

 
 

--
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] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Using devm_kzalloc simplifies the code and ensures that the use of
devm_request_irq is safe.  When kzalloc and kfree were used, the interrupt
could be triggered after the handler's data argument had been freed.

This also introduces some missing initializations of the return variable
ret, and uses devm_request_and_ioremap instead of the combination of
devm_request_mem_region and devm_ioremap.

The problem of a free after a devm_request_irq was found using the
following semantic match (http://coccinelle.lip6.fr/)

// smpl
@r exists@
expression e1,e2,x,a,b,c,d;
identifier free;
position p1,p2;
@@

  devm_request_irq@p1(e1,e2,...,x)
  ... when any
  when != e2 = a
  when != x = b
  if (...) {
... when != e2 = c
when != x = d
free@p2(...,x,...);
...
return ...;
  }
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
This is the same patch I sent before.  I had no trouble applying it after
cloning the staging/for_v3.7 branch.

 drivers/media/video/mx2_emmaprp.c |   31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/media/video/mx2_emmaprp.c 
b/drivers/media/video/mx2_emmaprp.c
index 2810015..dab380a 100644
--- a/drivers/media/video/mx2_emmaprp.c
+++ b/drivers/media/video/mx2_emmaprp.c
@@ -896,7 +896,7 @@ static int emmaprp_probe(struct platform_device *pdev)
int irq_emma;
int ret;

-   pcdev = kzalloc(sizeof *pcdev, GFP_KERNEL);
+   pcdev = devm_kzalloc(pdev-dev, sizeof(*pcdev), GFP_KERNEL);
if (!pcdev)
return -ENOMEM;

@@ -904,27 +904,24 @@ static int emmaprp_probe(struct platform_device *pdev)

pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, ipg);
if (IS_ERR(pcdev-clk_emma_ipg)) {
-   ret = PTR_ERR(pcdev-clk_emma_ipg);
-   goto free_dev;
+   return PTR_ERR(pcdev-clk_emma_ipg);
}

pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, ahb);
if (IS_ERR(pcdev-clk_emma_ipg)) {
-   ret = PTR_ERR(pcdev-clk_emma_ahb);
-   goto free_dev;
+   return PTR_ERR(pcdev-clk_emma_ahb);
}

irq_emma = platform_get_irq(pdev, 0);
res_emma = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (irq_emma  0 || res_emma == NULL) {
dev_err(pdev-dev, Missing platform resources data\n);
-   ret = -ENODEV;
-   goto free_dev;
+   return -ENODEV;
}

ret = v4l2_device_register(pdev-dev, pcdev-v4l2_dev);
if (ret)
-   goto free_dev;
+   return ret;

mutex_init(pcdev-dev_mutex);

@@ -946,21 +943,20 @@ static int emmaprp_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, pcdev);

-   if (devm_request_mem_region(pdev-dev, res_emma-start,
-   resource_size(res_emma), MEM2MEM_NAME) == NULL)
-   goto rel_vdev;
-
-   pcdev-base_emma = devm_ioremap(pdev-dev, res_emma-start,
-   resource_size(res_emma));
-   if (!pcdev-base_emma)
+   pcdev-base_emma = devm_request_and_ioremap(pdev-dev, res_emma);
+   if (!pcdev-base_emma) {
+   ret = -ENXIO;
goto rel_vdev;
+   }

pcdev-irq_emma = irq_emma;
pcdev-res_emma = res_emma;

if (devm_request_irq(pdev-dev, pcdev-irq_emma, emmaprp_irq,
-0, MEM2MEM_NAME, pcdev)  0)
+0, MEM2MEM_NAME, pcdev)  0) {
+   ret = -ENODEV;
goto rel_vdev;
+   }

pcdev-alloc_ctx = vb2_dma_contig_init_ctx(pdev-dev);
if (IS_ERR(pcdev-alloc_ctx)) {
@@ -993,8 +989,6 @@ rel_vdev:
video_device_release(vfd);
 unreg_dev:
v4l2_device_unregister(pcdev-v4l2_dev);
-free_dev:
-   kfree(pcdev);

return ret;
 }
@@ -1009,7 +1003,6 @@ static int emmaprp_remove(struct platform_device *pdev)
v4l2_m2m_release(pcdev-m2m_dev);
vb2_dma_contig_cleanup_ctx(pcdev-alloc_ctx);
v4l2_device_unregister(pcdev-v4l2_dev);
-   kfree(pcdev);

return 0;
 }

--
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] UDF: During mount free lvid_bh before rescanning with different blocksize

2012-08-14 Thread Jan Kara
On Sat 21-07-12 16:35:17, Ashish Sangwan wrote:
 If s_lvid_bh is not freed and set to NULL before re-scanning partition 
 with default block size, we might end up using wrong lvid in case
 s_lvid_bh is not updated in udf_load_logicalvolint during rescan.
 
 Signed-off-by: Ashish Sangwan ashish.sangw...@gmail.com
 Signed-off-by: Namjae Jeon linkinj...@gmail.com
  Yeah, I don't think this happens in practice but in theory it could. BTW,
did you check whether we don't need to free other information (like VAT
inode etc.) when rescanning the filesystem? I think we do but currently I'm
catching up after a long vacation and this doesn't have high priority.

Anyway, I've added your patch to my tree. Thanks.

Honza
 
 ---
  fs/udf/super.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/fs/udf/super.c b/fs/udf/super.c
 index ac8a348..4a95c56 100644
 --- a/fs/udf/super.c
 +++ b/fs/udf/super.c
 @@ -1961,6 +1961,8 @@ static int udf_fill_super(struct super_block *sb, void 
 *options, int silent)
   if (!silent)
   pr_notice(Rescanning with blocksize %d\n,
 UDF_DEFAULT_BLOCKSIZE);
 + brelse(sbi-s_lvid_bh);
 + sbi-s_lvid_bh = NULL;
   uopt.blocksize = UDF_DEFAULT_BLOCKSIZE;
   ret = udf_load_vrs(sb, uopt, silent, fileset);
   }
 -- 
 1.7.2.3
 
-- 
Jan Kara j...@suse.cz
SUSE Labs, CR
--
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 RFC] tick: Emphasize tck_broadcast_on_off could only be called for host cpu

2012-08-14 Thread Feng Tang
On Tue, 31 Jul 2012 15:57:21 +0800
Feng Tang feng.t...@intel.com wrote:

 With current tick_do_broadcast_on_off() and tick_broadcast_on_off(),
 it only cares host cpu, and doesn't really support to make the on/off
 for another target CPU as it seems to be. So remove the unneeded
 online check and add a WARN to notify user who doesn't know this
 new usage model.
 
 Next step should be to remove those cases that sends the BROADCAST
 ON/OFF/FORCE msg on one cpu for another CPU, if this patch is reviewed
 to be ok.
 
 Signed-off-by: Feng Tang feng.t...@intel.com
 Cc: Suresh Siddha suresh.b.sid...@intel.com
 Cc: Thomas Gleixner t...@linutronix.de
 ---
  kernel/time/tick-broadcast.c |   15 +--
  kernel/time/tick-common.c|6 +-
  kernel/time/tick-internal.h  |4 ++--
  3 files changed, 8 insertions(+), 17 deletions(-)
 
 diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
 index f113755..0433274 100644
 --- a/kernel/time/tick-broadcast.c
 +++ b/kernel/time/tick-broadcast.c
 @@ -204,7 +204,7 @@ static void tick_handle_periodic_broadcast(struct 
 clock_event_device *dev)
   * Powerstate information: The system enters/leaves a state, where
   * affected devices might stop
   */
 -static void tick_do_broadcast_on_off(unsigned long *reason)
 +void tick_broadcast_on_off(unsigned long *reason)
  {
   struct clock_event_device *bc, *dev;
   struct tick_device *td;
 @@ -266,19 +266,6 @@ out:
  }
  
  /*
 - * Powerstate information: The system enters/leaves a state, where
 - * affected devices might stop.
 - */
 -void tick_broadcast_on_off(unsigned long reason, int *oncpu)
 -{
 - if (!cpumask_test_cpu(*oncpu, cpu_online_mask))
 - printk(KERN_ERR tick-broadcast: ignoring broadcast for 
 -offline CPU #%d\n, *oncpu);
 - else
 - tick_do_broadcast_on_off(reason);
 -}
 -
 -/*
   * Set the periodic handler depending on broadcast on/off
   */
  void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
 diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
 index da6c9ec..950c635 100644
 --- a/kernel/time/tick-common.c
 +++ b/kernel/time/tick-common.c
 @@ -362,6 +362,8 @@ static void tick_resume(void)
  static int tick_notify(struct notifier_block *nb, unsigned long reason,
  void *dev)
  {
 + int *cpu = dev;
 +
   switch (reason) {
  
   case CLOCK_EVT_NOTIFY_ADD:
 @@ -370,7 +372,9 @@ static int tick_notify(struct notifier_block *nb, 
 unsigned long reason,
   case CLOCK_EVT_NOTIFY_BROADCAST_ON:
   case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
   case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
 - tick_broadcast_on_off(reason, dev);
 + WARN((*cpu != smp_processor_id()),
 + BROADCAST ON/OFF/FORCE should only be fired for host 
 CPU\n);
 + tick_broadcast_on_off(reason);
   break;
  
   case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
 diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
 index 4e265b9..40e4a8b 100644
 --- a/kernel/time/tick-internal.h
 +++ b/kernel/time/tick-internal.h
 @@ -90,7 +90,7 @@ static inline bool tick_broadcast_oneshot_available(void) { 
 return false; }
  extern int tick_device_uses_broadcast(struct clock_event_device *dev, int 
 cpu);
  extern int tick_check_broadcast_device(struct clock_event_device *dev);
  extern int tick_is_broadcast_device(struct clock_event_device *dev);
 -extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
 +extern void tick_broadcast_on_off(unsigned long *reason);
  extern void tick_shutdown_broadcast(unsigned int *cpup);
  extern void tick_suspend_broadcast(void);
  extern int tick_resume_broadcast(void);
 @@ -115,7 +115,7 @@ static inline int tick_device_uses_broadcast(struct 
 clock_event_device *dev,
   return 0;
  }
  static inline void tick_do_periodic_broadcast(struct clock_event_device *d) 
 { }
 -static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { 
 }
 +static inline void tick_broadcast_on_off(unsigned long *reason) { }
  static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
  static inline void tick_suspend_broadcast(void) { }
  static inline int tick_resume_broadcast(void) { return 0; }

Ping for comments.

Thanks,
Feng
--
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: Antw: Re: Q: Seeing the microcode revision in /proc/cpuinfo

2012-08-14 Thread Borislav Petkov
On Tue, Aug 14, 2012 at 03:20:53PM +0200, Ulrich Windl wrote:
 Hi Borislav,
 
 probably my edge is not bleeding that much than yours ;-)
 
 I don't see microcode in 3.0.34-0.7-default for an AMD Opteron, and not in  
 2.6.32.59-0.3-default for the Intel Xeon. Both are kernels of SLES11 xon 
 x86_64. The first one is the latest you can get for SLES11 SP2.
 
 In openSUSE 12.1 (kernel 3.1.10) it's also still missing.
 
 Anyway, it's nice to see that others also thought this feature is useful.

Yep,

those are all before 3.2.

Well, if you still want to find out the microcode revision on those
boxes, on both AMD and Intel you can do as root:

$ rdmsr 0x8b

You need the msr.ko kernel module loaded or built-in (CONFIG_X86_MSR
option enabled) for this and rdmsr is from the msr-tools package.

HTH.

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


Re: [PATCH 0/7] zram/zsmalloc promotion

2012-08-14 Thread Konrad Rzeszutek Wilk
On Tue, Aug 14, 2012 at 03:22:47PM +0900, Minchan Kim wrote:
 Hi Greg,
 
 On Mon, Aug 13, 2012 at 07:35:30PM -0700, Greg Kroah-Hartman wrote:
  On Wed, Aug 08, 2012 at 03:12:13PM +0900, Minchan Kim wrote:
   This patchset promotes zram/zsmalloc from staging.
   Both are very clean and zram is used by many embedded product
   for a long time.
   
   [1-3] are patches not merged into linux-next yet but needed
   it as base for [4-5] which promotes zsmalloc.
   Greg, if you merged [1-3] already, skip them.
  
  I've applied 1-3 and now 4, but that's it, I can't apply the rest
 
 Thanks!
 
  without getting acks from the -mm maintainers, sorry.  Please work with
 
 Nitin suggested zsmalloc could be in /lib or /zram out of /mm but I want
 to confirm it from akpm so let's wait his opinion.
 
 Anyway, another question. zram would be under driver/blocks.
 Do I need ACK from Jens for that?

Yes.
 
  them to get those acks, and then I will be glad to apply the rest (after
  you resend them of course...)
  
  thanks,
  
  greg k-h
  
  --
  To unsubscribe, send a message with 'unsubscribe linux-mm' in
  the body to majord...@kvack.org.  For more info on Linux MM,
  see: http://www.linux-mm.org/ .
  Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a
 
 -- 
 Kind regards,
 Minchan Kim
 
 --
 To unsubscribe, send a message with 'unsubscribe linux-mm' in
 the body to majord...@kvack.org.  For more info on Linux MM,
 see: http://www.linux-mm.org/ .
 Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a
--
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 net-next 01/16] net: introduce upper device lists

2012-08-14 Thread Jiri Pirko
Tue, Aug 14, 2012 at 03:14:00PM CEST, f...@redhat.com wrote:
On Tue, 14 Aug 2012 14:24:33 +0200
Jiri Pirko j...@resnulli.us wrote:

 Mon, Aug 13, 2012 at 07:52:17PM CEST, f...@redhat.com wrote:
 On Mon, 13 Aug 2012 17:27:00 +0200
 Jiri Pirko j...@resnulli.us wrote:
  + /*
  +  * To prevent loops, check if dev is not upper device to upper_dev.
  +  */
  + if (__netdev_has_upper_dev(upper_dev, dev, true))
  + return -EBUSY;
  +
  + if (__netdev_find_upper(dev, upper_dev))
  + return -EEXIST;
 
 __netdev_has_upper_dev() can go all the way up finding the device and
 the __netdev_find_upper() just check the first level.
 
 
 I do not think this ordering is somewhat inportant.

it's not the order, see below:

 I think it would be better to use:
 __netdev_find_upper_dev(,,deep=true/false)
 __netdev_has_upper(,)

It's their names.  Currently, the function ..._find_... look at
one level only, while the function ..._has_... does one or more
levels.  I think it's better to swap 'has' and 'find' in their names:

__netdev_find_upper_dev(,,deep=true/false) -- find in all levels
__netdev_has_upper(,)  -- check only the one level.

Oh, now I think I see your point. But realise this:

The main reason for __netdev_find_upper() is to find struct upper for
netdev_upper_dev_unlink(). Therefore the name is not
__netdev_find_upper_dev and there's no need to go deep here.

On the orher hand, __netdev_has_upper_dev() only says whether device is lower
to specified upper device. In this case I think the name is quite
convenient as well.



fbl
--
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: [Xen-devel] [PATCH] netvm: check for page == NULL when propogating the skb-pfmemalloc flag

2012-08-14 Thread Konrad Rzeszutek Wilk
On Tue, Aug 14, 2012 at 11:05:22AM +0100, Mel Gorman wrote:
 On Mon, Aug 13, 2012 at 11:41:44AM -0400, Konrad Rzeszutek Wilk wrote:
  On Wed, Aug 08, 2012 at 03:50:46PM -0700, David Miller wrote:
   From: Mel Gorman mgor...@suse.de
   Date: Tue, 7 Aug 2012 09:55:55 +0100
   
Commit [c48a11c7: netvm: propagate page-pfmemalloc to skb] is 
responsible
for the following bug triggered by a xen network driver
...
The problem is that the xenfront driver is passing a NULL page to
__skb_fill_page_desc() which was unexpected. This patch checks that
there is a page before dereferencing.

Reported-and-Tested-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Signed-off-by: Mel Gorman mgor...@suse.de
   
   That call to __skb_fill_page_desc() in xen-netfront.c looks completely 
   bogus.
   It's the only driver passing NULL here.
  
  It looks to be passing a valid page pointer (at least by looking
  at the code) so I am not sure how it got turned in a NULL.
  
 
 Are we looking at different code bases? I see this and I was assuming it
 was the source of the bug.
 
   __skb_fill_page_desc(skb, 0, NULL, 0, 0);

Yes! Well, that is embarrassing. I was looking at the first invocation of 
__skb_fill_page_desc (which is in xennet_alloc_rx_buffers) sigh

 
 -- 
 Mel Gorman
 SUSE Labs
--
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] m68k: select CONFIG_GENERIC_ATOMIC64 for all m68k CPU types

2012-08-14 Thread Greg Ungerer

On 08/14/2012 03:15 PM, Fengguang Wu wrote:

On Tue, Aug 14, 2012 at 02:45:33PM +1000, g...@snapgear.com wrote:

From: Greg Ungerer g...@uclinux.org

There is no specific atomic64 support code for any m68k CPUs, so we should
select CONFIG_GENERIC_ATOMC64 for all. Remove the existing per CPU selection
of this and select it for all m68k.

Signed-off-by: Greg Ungerer g...@uclinux.org


Signed-off-by: Fengguang Wu fengguang...@intel.com

Thanks for the complete solution!


I'll carry it in the m68knommu git tree, and push to Linus with my
next set of fixes.

Regards
Greg



Greg Ungerer  --  Principal EngineerEMAIL: g...@snapgear.com
SnapGear Group, McAfee  PHONE:   +61 7 3435 2888
8 Gardner Close,FAX: +61 7 3891 3630
Milton, QLD, 4064, AustraliaWEB: http://www.SnapGear.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 00/12] KVM: introduce readonly memslot

2012-08-14 Thread Avi Kivity
On 08/10/2012 09:14 PM, Marcelo Tosatti wrote:
 On Tue, Aug 07, 2012 at 05:47:15PM +0800, Xiao Guangrong wrote:
 Changelog:
 - introduce KVM_PFN_ERR_RO_FAULT instead of dummy page
 - introduce KVM_HVA_ERR_BAD and optimize error hva indicators
 
 The test case can be found at:
 http://lkml.indiana.edu/hypermail/linux/kernel/1207.2/00819/migrate-perf.tar.bz2
 
 In current code, if we map a readonly memory space from host to guest
 and the page is not currently mapped in the host, we will get a fault-pfn
 and async is not allowed, then the vm will crash.
 
 As Avi's suggestion, We introduce readonly memory region to map ROM/ROMD
 to the guest, read access is happy for readonly memslot, write access on
 readonly memslot will cause KVM_EXIT_MMIO exit.
 
 Memory slots whose QEMU mapping is write protected is supported
 today, as long as there are no write faults.
 
 What prevents the use of mmap(!MAP_WRITE) to handle read-only memslots
 again?

Userspace may want to modify the ROM (for example, when programming a
flash device).  It is also possible to map an hva range rw through one
slot and ro through another.


-- 
error compiling committee.c: too many arguments to function
--
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/8] procfs fdinfo providers updated

2012-08-14 Thread Cyrill Gorcunov
Hi guys,

in this series I tried to address concerns on code duplication
at seq_fdinfo_open and proc_fd_link, thus fdinfo_open_helper()
is used in both routines. Also series updated to be appliable
on top of v3.6-rc1.

Please review, comments are highly appreciated.

Cyrill
--
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 8/8] fdinfo: Show sigmask for signalfd fd

2012-08-14 Thread Cyrill Gorcunov
Signed-off-by: Pavel Emelyanov xe...@parallels.com
Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
---
 fs/proc/array.c |2 -
 fs/signalfd.c   |   63 
 include/linux/proc_fs.h |3 ++
 3 files changed, 67 insertions(+), 1 deletion(-)

Index: linux-2.6.git/fs/proc/array.c
===
--- linux-2.6.git.orig/fs/proc/array.c
+++ linux-2.6.git/fs/proc/array.c
@@ -220,7 +220,7 @@ static inline void task_state(struct seq
seq_putc(m, '\n');
 }
 
-static void render_sigset_t(struct seq_file *m, const char *header,
+void render_sigset_t(struct seq_file *m, const char *header,
sigset_t *set)
 {
int i;
Index: linux-2.6.git/fs/signalfd.c
===
--- linux-2.6.git.orig/fs/signalfd.c
+++ linux-2.6.git/fs/signalfd.c
@@ -29,6 +29,7 @@
 #include linux/anon_inodes.h
 #include linux/signalfd.h
 #include linux/syscalls.h
+#include linux/proc_fs.h
 
 void signalfd_cleanup(struct sighand_struct *sighand)
 {
@@ -46,6 +47,7 @@ void signalfd_cleanup(struct sighand_str
 }
 
 struct signalfd_ctx {
+   seqcount_t cnt;
sigset_t sigmask;
 };
 
@@ -259,6 +261,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sig
return -ENOMEM;
 
ctx-sigmask = sigmask;
+   seqcount_init(ctx-cnt);
 
/*
 * When we call this, the initialization must be complete, since
@@ -279,7 +282,9 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sig
return -EINVAL;
}
spin_lock_irq(current-sighand-siglock);
+   write_seqcount_begin(ctx-cnt);
ctx-sigmask = sigmask;
+   write_seqcount_end(ctx-cnt);
spin_unlock_irq(current-sighand-siglock);
 
wake_up(current-sighand-signalfd_wqh);
@@ -294,3 +299,61 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigs
 {
return sys_signalfd4(ufd, user_mask, sizemask, 0);
 }
+
+#if defined(CONFIG_PROC_FS)  defined(CONFIG_CHECKPOINT_RESTORE)
+
+static void *seq_start(struct seq_file *m, loff_t *pos)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+   return *pos == 0 ? extra-f_file : NULL;
+}
+
+static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
+{
+   ++*pos;
+   return NULL;
+}
+
+static int seq_show(struct seq_file *m, void *v)
+{
+   struct signalfd_ctx *ctx = ((struct file *)v)-private_data;
+   sigset_t sigmask;
+   unsigned seq;
+
+   do {
+   seq = read_seqcount_begin(ctx-cnt);
+   sigmask = ctx-sigmask;
+   } while (read_seqcount_retry(ctx-cnt, seq));
+
+   signotset(sigmask);
+   render_sigset_t(m, sigmask:\t, sigmask);
+   return 0;
+}
+
+static void seq_stop(struct seq_file *p, void *v) { }
+
+static const struct seq_operations signalfd_fdinfo_ops = {
+   .start  = seq_start,
+   .next   = seq_next,
+   .stop   = seq_stop,
+   .show   = seq_show,
+};
+
+static int is_signalfd_file(struct file *file)
+{
+   return file-f_op == signalfd_fops;
+}
+
+static struct proc_fdinfo_driver signalfd_fdinfo = {
+   .name   = signalfd,
+   .ops= signalfd_fdinfo_ops,
+   .probe  = is_signalfd_file,
+};
+
+static int __init signalfd_init(void)
+{
+   return proc_register_fdinfo_driver(signalfd_fdinfo);
+}
+fs_initcall(signalfd_init);
+
+#endif /* CONFIG_PROC_FS  CONFIG_CHECKPOINT_RESTORE */
Index: linux-2.6.git/include/linux/proc_fs.h
===
--- linux-2.6.git.orig/include/linux/proc_fs.h
+++ linux-2.6.git/include/linux/proc_fs.h
@@ -316,4 +316,7 @@ static inline struct net *PDE_NET(struct
return pde-parent-data;
 }
 
+#include asm/signal.h
+
+void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);
 #endif /* _LINUX_PROC_FS_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 6/8] fs, exportfs: Add export_encode_inode_fh helper

2012-08-14 Thread Cyrill Gorcunov
To provide fsnotify object inodes being watched without
binding to alphabetical path we need to encode them with
exportfs help. This patch adds a helper which operates
with plain inodes directly.

This feature is CONFIG_CHECKPOINT_RESTORE only.

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/exportfs/expfs.c  |   21 +
 include/linux/exportfs.h |4 
 2 files changed, 25 insertions(+)

Index: linux-2.6.git/fs/exportfs/expfs.c
===
--- linux-2.6.git.orig/fs/exportfs/expfs.c
+++ linux-2.6.git/fs/exportfs/expfs.c
@@ -302,6 +302,27 @@ out:
return error;
 }
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+int export_encode_inode_fh(struct inode *inode, struct fid *fid, int *max_len)
+{
+   int len = *max_len;
+   int type = FILEID_INO32_GEN;
+
+   if (len  2) {
+   *max_len = 2;
+   return 255;
+   }
+
+   len = 2;
+   fid-i32.ino = inode-i_ino;
+   fid-i32.gen = inode-i_generation;
+   *max_len = len;
+
+   return type;
+}
+EXPORT_SYMBOL_GPL(export_encode_inode_fh);
+#endif
+
 /**
  * export_encode_fh - default export_operations-encode_fh function
  * @inode:   the object to encode
Index: linux-2.6.git/include/linux/exportfs.h
===
--- linux-2.6.git.orig/include/linux/exportfs.h
+++ linux-2.6.git/include/linux/exportfs.h
@@ -177,6 +177,10 @@ struct export_operations {
int (*commit_metadata)(struct inode *inode);
 };
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+extern int export_encode_inode_fh(struct inode *inode, struct fid *fid, int 
*max_len);
+#endif
+
 extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
int *max_len, int connectable);
 extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,

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


[patch 7/8] fs, notify: Add procfs fdinfo helper v3

2012-08-14 Thread Cyrill Gorcunov
This allow us to print out fsnotify details such as
watchee inode, device, mask and file handle.

For example for inotify objects the output is

 | pos: 0
 | flags:   0200
 | inotify wd:3 ino: 9e7e sdev:   800013 mask:  800afce 
ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle: 
7e9e640d1b6d
 | inotify wd:2 ino: a111 sdev:   800013 mask:  800afce 
ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle: 
11a120542153
 | inotify wd:1 ino:6b149 sdev:   800013 mask:  800afce 
ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle: 
49b1060023552153

For fanotify it is like

 | pos: 0
 | flags:   02
 | fanotify ino:68f71 sdev:   800013 mask:1 ignored_mask: 
4000 fhandle-bytes:8 fhandle-type:1 f_handle: 
718f0600b9f42053
 | fanotify mnt_id:   13 mask:1 ignored_mask: 4000

This feature is CONFIG_CHECKPOINT_RESTORE only. To minimize
impact on general fsnotify code the new functionality is gathered
in fs/notify/fdinfo.c file mostly.

v2:
 - append missing colons to terms
v3:
 - continue from pervious position in list on -next

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/notify/Makefile |2 
 fs/notify/fanotify/fanotify_user.c |   17 ++
 fs/notify/fdinfo.c |  216 +
 fs/notify/fdinfo.h |   19 +++
 fs/notify/inotify/inotify_user.c   |   32 +
 5 files changed, 284 insertions(+), 2 deletions(-)

Index: linux-2.6.git/fs/notify/Makefile
===
--- linux-2.6.git.orig/fs/notify/Makefile
+++ linux-2.6.git/fs/notify/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o 
inode_mark.o \
-  mark.o vfsmount_mark.o
+  mark.o vfsmount_mark.o fdinfo.o
 
 obj-y  += dnotify/
 obj-y  += inotify/
Index: linux-2.6.git/fs/notify/fanotify/fanotify_user.c
===
--- linux-2.6.git.orig/fs/notify/fanotify/fanotify_user.c
+++ linux-2.6.git/fs/notify/fanotify/fanotify_user.c
@@ -17,6 +17,7 @@
 #include asm/ioctls.h
 
 #include ../../mount.h
+#include ../fdinfo.h
 
 #define FANOTIFY_DEFAULT_MAX_EVENTS16384
 #define FANOTIFY_DEFAULT_MAX_MARKS 8192
@@ -873,6 +874,20 @@ asmlinkage long SyS_fanotify_mark(long f
 SYSCALL_ALIAS(sys_fanotify_mark, SyS_fanotify_mark);
 #endif
 
+#if defined(CONFIG_PROC_FS)  defined(CONFIG_CHECKPOINT_RESTORE)
+int is_file_fanotify(struct file *file)
+{
+   return file-f_op == fanotify_fops;
+}
+
+static int __init fanotify_register_fdinfo_driver(void)
+{
+   return proc_register_fdinfo_driver(fanotify_fdinfo);
+}
+#else
+void fanotify_register_fdinfo_driver(void) { }
+#endif /* CONFIG_PROC_FS  CONFIG_CHECKPOINT_RESTORE */
+
 /*
  * fanotify_user_setup - Our initialization function.  Note that we cannot 
return
  * error because we have compiled-in VFS hooks.  So an (unlikely) failure here
@@ -883,7 +898,7 @@ static int __init fanotify_user_setup(vo
fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, SLAB_PANIC);
fanotify_response_event_cache = KMEM_CACHE(fanotify_response_event,
   SLAB_PANIC);
-
+   fanotify_register_fdinfo_driver();
return 0;
 }
 device_initcall(fanotify_user_setup);
Index: linux-2.6.git/fs/notify/fdinfo.c
===
--- /dev/null
+++ linux-2.6.git/fs/notify/fdinfo.c
@@ -0,0 +1,216 @@
+#include linux/file.h
+#include linux/fs.h
+#include linux/fsnotify_backend.h
+#include linux/idr.h
+#include linux/init.h
+#include linux/inotify.h
+#include linux/kernel.h
+#include linux/namei.h
+#include linux/sched.h
+#include linux/types.h
+#include linux/seq_file.h
+#include linux/exportfs.h
+#include linux/proc_fs.h
+
+#include inotify/inotify.h
+#include ../fs/mount.h
+
+struct inode_file_handle {
+   struct file_handle  h;
+   struct fid  fid;
+} __packed;
+
+#if defined(CONFIG_PROC_FS)  defined(CONFIG_CHECKPOINT_RESTORE)
+
+#if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY)
+
+#ifdef CONFIG_EXPORTFS
+static int inotify_encode_target(struct inode *inode, struct inode_file_handle 
*fhandle)
+{
+   int ret, size;
+
+   size = sizeof(fhandle-fid)  2;
+   ret = export_encode_inode_fh(inode, fhandle-fid, size);
+   BUG_ON(ret != FILEID_INO32_GEN);
+
+   fhandle-h.handle_type = FILEID_INO32_GEN;
+   fhandle-h.handle_bytes = size * 

[patch 5/8] fs, epoll: Add procfs fdinfo helper v2

2012-08-14 Thread Cyrill Gorcunov
This allow us to print out eventpoll target file descriptor,
events and data, the /proc/pid/fdinfo/fd consists of

 | pos: 0
 | flags:   02
 | tfd:5 events:   1d data: 

This feature is CONFIG_CHECKPOINT_RESTORE only.

v2:
 - don't walk over all rb nodes on seq-next,
   try to continue from pervious position

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
CC: Matthew Helsley matt.hels...@gmail.com
---
 fs/eventpoll.c |   67 +
 1 file changed, 67 insertions(+)

Index: linux-2.6.git/fs/eventpoll.c
===
--- linux-2.6.git.orig/fs/eventpoll.c
+++ linux-2.6.git/fs/eventpoll.c
@@ -38,6 +38,8 @@
 #include asm/io.h
 #include asm/mman.h
 #include linux/atomic.h
+#include linux/proc_fs.h
+#include linux/seq_file.h
 
 /*
  * LOCKING:
@@ -1897,6 +1899,69 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd,
return error;
 }
 
+#if defined(CONFIG_PROC_FS)  defined(CONFIG_CHECKPOINT_RESTORE)
+
+static void *seq_start(struct seq_file *m, loff_t *pos)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+   struct eventpoll *ep = extra-f_file-private_data;
+   struct rb_node *rbp;
+   loff_t num = *pos;
+
+   mutex_lock(ep-mtx);
+   for (rbp = rb_first(ep-rbr); rbp; rbp = rb_next(rbp)) {
+   if (num-- == 0)
+   return rbp;
+   }
+
+   return NULL;
+}
+
+static void seq_stop(struct seq_file *m, void *v)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+   struct eventpoll *ep = extra-f_file-private_data;
+   mutex_unlock(ep-mtx);
+}
+
+static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
+{
+   struct rb_node *rbp = p;
+   ++*pos;
+   return (void *)rb_next(rbp);
+}
+
+static int seq_show(struct seq_file *m, void *v)
+{
+   struct rb_node *rbp = v;
+   struct epitem *epi = rb_entry(rbp, struct epitem, rbn);
+
+   return seq_printf(m, tfd: %8d events: %8x data: %16llx\n,
+ epi-ffd.fd, epi-event.events,
+ (long long)epi-event.data);
+}
+
+static const struct seq_operations ep_fdinfo_ops = {
+   .start  = seq_start,
+   .next   = seq_next,
+   .stop   = seq_stop,
+   .show   = seq_show,
+};
+
+static struct proc_fdinfo_driver ep_fdinfo = {
+   .name   = eventpoll,
+   .ops= ep_fdinfo_ops,
+   .probe  = is_file_epoll,
+};
+
+static int __init ep_register_fdinfo_driver(void)
+{
+   return proc_register_fdinfo_driver(ep_fdinfo);
+}
+#else
+static void ep_register_fdinfo_driver(void) { }
+#endif /* CONFIG_PROC_FS  CONFIG_CHECKPOINT_RESTORE */
+
 static int __init eventpoll_init(void)
 {
struct sysinfo si;
@@ -1929,6 +1994,8 @@ static int __init eventpoll_init(void)
pwq_cache = kmem_cache_create(eventpoll_pwq,
sizeof(struct eppoll_entry), 0, SLAB_PANIC, NULL);
 
+   ep_register_fdinfo_driver();
+
return 0;
 }
 fs_initcall(eventpoll_init);

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


[patch 1/8] procfs: Move /proc/pid/fd[info] handling code to fd.[ch]

2012-08-14 Thread Cyrill Gorcunov
This patch prepares the ground for further extension of
/proc/pid/fd[info] handling code by moving fdinfo handling
code into fs/proc/fd.c.

I think such move makes both fs/proc/base.c and fs/proc/fd.c
easier to read.

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/proc/Makefile   |2 
 fs/proc/base.c |  388 -
 fs/proc/fd.c   |  351 +++
 fs/proc/fd.h   |   14 +
 fs/proc/internal.h |   48 ++
 5 files changed, 416 insertions(+), 387 deletions(-)

Index: linux-2.6.git/fs/proc/Makefile
===
--- linux-2.6.git.orig/fs/proc/Makefile
+++ linux-2.6.git/fs/proc/Makefile
@@ -8,7 +8,7 @@ proc-y  := nommu.o task_nommu.o
 proc-$(CONFIG_MMU) := mmu.o task_mmu.o
 
 proc-y   += inode.o root.o base.o generic.o array.o \
-   proc_tty.o
+   proc_tty.o fd.o
 proc-y += cmdline.o
 proc-y += consoles.o
 proc-y += cpuinfo.o
Index: linux-2.6.git/fs/proc/base.c
===
--- linux-2.6.git.orig/fs/proc/base.c
+++ linux-2.6.git/fs/proc/base.c
@@ -90,6 +90,7 @@
 #endif
 #include trace/events/oom.h
 #include internal.h
+#include fd.h
 
 /* NOTE:
  * Implementing inode permission operations in /proc is almost
@@ -136,8 +137,6 @@ struct pid_entry {
NULL, proc_single_file_operations, \
{ .proc_show = show } )
 
-static int proc_fd_permission(struct inode *inode, int mask);
-
 /*
  * Count the number of hardlinks for the pid_entry table, excluding the .
  * and .. links.
@@ -1492,7 +1491,7 @@ out:
return error;
 }
 
-static const struct inode_operations proc_pid_link_inode_operations = {
+const struct inode_operations proc_pid_link_inode_operations = {
.readlink   = proc_pid_readlink,
.follow_link= proc_pid_follow_link,
.setattr= proc_setattr,
@@ -1501,21 +1500,6 @@ static const struct inode_operations pro
 
 /* building an inode */
 
-static int task_dumpable(struct task_struct *task)
-{
-   int dumpable = 0;
-   struct mm_struct *mm;
-
-   task_lock(task);
-   mm = task-mm;
-   if (mm)
-   dumpable = get_dumpable(mm);
-   task_unlock(task);
-   if(dumpable == 1)
-   return 1;
-   return 0;
-}
-
 struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct 
*task)
 {
struct inode * inode;
@@ -1641,15 +1625,6 @@ int pid_revalidate(struct dentry *dentry
return 0;
 }
 
-static int pid_delete_dentry(const struct dentry * dentry)
-{
-   /* Is the task we represent dead?
-* If so, then don't put the dentry on the lru list,
-* kill it immediately.
-*/
-   return !proc_pid(dentry-d_inode)-tasks[PIDTYPE_PID].first;
-}
-
 const struct dentry_operations pid_dentry_operations =
 {
.d_revalidate   = pid_revalidate,
@@ -1712,289 +1687,6 @@ end_instantiate:
return filldir(dirent, name, len, filp-f_pos, ino, type);
 }
 
-static unsigned name_to_int(struct dentry *dentry)
-{
-   const char *name = dentry-d_name.name;
-   int len = dentry-d_name.len;
-   unsigned n = 0;
-
-   if (len  1  *name == '0')
-   goto out;
-   while (len--  0) {
-   unsigned c = *name++ - '0';
-   if (c  9)
-   goto out;
-   if (n = (~0U-9)/10)
-   goto out;
-   n *= 10;
-   n += c;
-   }
-   return n;
-out:
-   return ~0U;
-}
-
-#define PROC_FDINFO_MAX 64
-
-static int proc_fd_info(struct inode *inode, struct path *path, char *info)
-{
-   struct task_struct *task = get_proc_task(inode);
-   struct files_struct *files = NULL;
-   struct file *file;
-   int fd = proc_fd(inode);
-
-   if (task) {
-   files = get_files_struct(task);
-   put_task_struct(task);
-   }
-   if (files) {
-   /*
-* We are not taking a ref to the file structure, so we must
-* hold -file_lock.
-*/
-   spin_lock(files-file_lock);
-   file = fcheck_files(files, fd);
-   if (file) {
-   unsigned int f_flags;
-   struct fdtable *fdt;
-
-   fdt = files_fdtable(files);
-   f_flags = file-f_flags  ~O_CLOEXEC;
-   if (close_on_exec(fd, fdt))
-   f_flags |= O_CLOEXEC;
-
-   if (path) {
-   *path = file-f_path;
-   

[patch 3/8] procfs: Add ability to plug in auxiliary fdinfo providers

2012-08-14 Thread Cyrill Gorcunov
This patch brings ability to plug in auxiliary fdinfo providers.
For example in further patches eventfd, evenpoll and fsnotify
will print out information associated with files.

This feature is CONFIG_CHECKPOINT_RESTORE guarded to eliminate
overhead for those who don't need it at all (this
unfortunately makes patch bigger than I wanted).

The basic usage rule is the following

 - fdinfo provider should register own show method
   via proc_register_fdinfo_driver call, where show
   methods are rather well known seq-file operations

 - once the kernel opens /proc/$pid/fdinfo/$fd file
   it calls for -probe() method in registered fdinfo
   drivers, and if probe success, then seq-file show
   operations will be called to provide out additional
   infomation

Initially we considered to inject some show metod to
file_operations but since there really a number of
file_operations declared inside kernel (and in real the
further patches cover onle eventfd/epoll/inotify) the
waste of memory space will be inacceptable I think.

Pavel, I've left seq_next memthod as it was simply because
we can't leave seq_next() after calling extra-driver-ops-start
without increasing pos, thus we need to call for show manually
once.

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/proc/fd.c|  198 ++--
 include/linux/proc_fs.h |   26 ++
 2 files changed, 216 insertions(+), 8 deletions(-)

Index: linux-2.6.git/fs/proc/fd.c
===
--- linux-2.6.git.orig/fs/proc/fd.c
+++ linux-2.6.git/fs/proc/fd.c
@@ -8,18 +8,14 @@
 #include linux/security.h
 #include linux/file.h
 #include linux/seq_file.h
+#include linux/spinlock.h
 
 #include linux/proc_fs.h
 
 #include internal.h
 #include fd.h
 
-struct proc_fdinfo {
-   loff_t  f_pos;
-   int f_flags;
-};
-
-static int fdinfo_open_helper(struct inode *inode, int *f_flags, struct path 
*path)
+static int fdinfo_open_helper(struct inode *inode, int *f_flags, struct file 
**f_file, struct path *path)
 {
struct files_struct *files = NULL;
struct task_struct *task;
@@ -49,6 +45,10 @@ static int fdinfo_open_helper(struct ino
*path = fd_file-f_path;
path_get(fd_file-f_path);
}
+   if (f_file) {
+   *f_file = fd_file;
+   get_file(fd_file);
+   }
ret = 0;
}
spin_unlock(files-file_lock);
@@ -58,6 +58,186 @@ static int fdinfo_open_helper(struct ino
return ret;
 }
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+
+static LIST_HEAD(fdinfo_drivers);
+static DECLARE_RWSEM(fdinfo_drivers_sem);
+
+int proc_register_fdinfo_driver(struct proc_fdinfo_driver *s)
+{
+   struct proc_fdinfo_driver *i;
+   int ret = 0;
+
+   if (!s-ops || !s-probe)
+   return -EINVAL;
+
+   down_write(fdinfo_drivers_sem);
+   list_for_each_entry(i, fdinfo_drivers, list) {
+   if (i == s) {
+   WARN_ONCE(Trying reassign fdinfo driver `%s'\n,
+ i-name);
+   ret = -EINVAL;
+   break;
+   }
+   }
+   if (!ret)
+   list_add(s-list, fdinfo_drivers);
+   up_write(fdinfo_drivers_sem);
+
+   return ret;
+}
+
+void proc_unregister_fdinfo_driver(struct proc_fdinfo_driver *s)
+{
+   struct proc_fdinfo_driver *i, *tmp;
+
+   down_write(fdinfo_drivers_sem);
+   list_for_each_entry_safe(i, tmp, fdinfo_drivers, list) {
+   if (i == s) {
+   list_del(i-list);
+   break;
+   }
+   }
+   up_write(fdinfo_drivers_sem);
+}
+
+static int prep_fdinfo_driver(struct proc_fdinfo_extra *extra)
+{
+   struct proc_fdinfo_driver *s;
+
+   down_read(fdinfo_drivers_sem);
+   list_for_each_entry(s, fdinfo_drivers, list) {
+   if (s-probe(extra-f_file)) {
+   extra-driver = s;
+   break;
+   }
+   }
+   up_read(fdinfo_drivers_sem);
+
+   return 0;
+}
+
+static void *seq_start(struct seq_file *m, loff_t *pos)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+
+   down_read(fdinfo_drivers_sem);
+   extra-pos = *pos;
+
+   return *pos == 0 ? extra :
+   (extra-driver ? extra-driver-ops-start(m, pos) : NULL);
+}
+
+static void seq_stop(struct seq_file *m, void *v)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+
+   if (extra-driver  extra-pos  0)
+   extra-driver-ops-stop(m, v);
+   

[patch 4/8] fs, eventfd: Add procfs fdinfo helper

2012-08-14 Thread Cyrill Gorcunov
This allow us to print out raw counter value.
The /proc/pid/fdinfo/fd output is

 | pos: 0
 | flags:   04002
 | eventfd-count:   5a

This feature is CONFIG_CHECKPOINT_RESTORE only.

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/eventfd.c |   55 +++
 1 file changed, 55 insertions(+)

Index: linux-2.6.git/fs/eventfd.c
===
--- linux-2.6.git.orig/fs/eventfd.c
+++ linux-2.6.git/fs/eventfd.c
@@ -19,6 +19,8 @@
 #include linux/export.h
 #include linux/kref.h
 #include linux/eventfd.h
+#include linux/proc_fs.h
+#include linux/seq_file.h
 
 struct eventfd_ctx {
struct kref kref;
@@ -433,3 +435,56 @@ SYSCALL_DEFINE1(eventfd, unsigned int, c
return sys_eventfd2(count, 0);
 }
 
+#if defined(CONFIG_PROC_FS)  defined(CONFIG_CHECKPOINT_RESTORE)
+
+static void *seq_start(struct seq_file *m, loff_t *pos)
+{
+   struct proc_fdinfo_extra *extra = m-private;
+   return *pos == 0 ? extra-f_file : NULL;
+}
+
+static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
+{
+   ++*pos;
+   return NULL;
+}
+
+static int seq_show(struct seq_file *m, void *v)
+{
+   struct eventfd_ctx *ctx = ((struct file *)v)-private_data;
+
+   spin_lock_irq(ctx-wqh.lock);
+   seq_printf(m, eventfd-count: %16llx\n,
+  (unsigned long long)ctx-count);
+   spin_unlock_irq(ctx-wqh.lock);
+
+   return 0;
+}
+
+static void seq_stop(struct seq_file *p, void *v) { }
+
+static const struct seq_operations eventfd_fdinfo_ops = {
+   .start  = seq_start,
+   .next   = seq_next,
+   .stop   = seq_stop,
+   .show   = seq_show,
+};
+
+static int is_eventfd_file(struct file *file)
+{
+   return file-f_op == eventfd_fops;
+}
+
+static struct proc_fdinfo_driver eventfd_fdinfo = {
+   .name   = eventfd,
+   .ops= eventfd_fdinfo_ops,
+   .probe  = is_eventfd_file,
+};
+
+static int __init eventfd_init(void)
+{
+   return proc_register_fdinfo_driver(eventfd_fdinfo);
+}
+fs_initcall(eventfd_init);
+
+#endif /* CONFIG_PROC_FS  CONFIG_CHECKPOINT_RESTORE */

--
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] MIPS: fix module.c build for 32 bit

2012-08-14 Thread David Howells
Rusty Russell ru...@rustcorp.com.au wrote:

 Yep, thanks.  And might as well sent them straight to Linus; since
 linux-next didn't catch this, there's little point baking them there if
 we have some acks.
 
 If he misses it, I'll grab them.

It might have to wait for the next merge window.

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


[patch 2/8] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file

2012-08-14 Thread Cyrill Gorcunov
This patch converts /proc/pid/fdinfo/ handling routines to seq-file which
is needed to extend seq operations and plug in auxiliary fdinfo provides
from subsystems like eventfd/eventpoll/fsnotify.

Note the proc_fd_link no longer call for proc_fd_info, simply because
proc_fd_info is converted to seq_fdinfo_open (which is seq-file open()
prototype), moreover in further patches I need to provide two seq_fdinfo_open
variants -- one with CONFIG_CHECKPOINT_RESTORE and one without this
symbol. All in one -- this will look more messy then.

Also, to eliminate code duplication (and Pavel's concerns) the 
fdinfo_open_helper
function introduced which is used in both seq_fdinfo_open and proc_fd_link.

Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
CC: Al Viro v...@zeniv.linux.org.uk
CC: Alexey Dobriyan adobri...@gmail.com
CC: Andrew Morton a...@linux-foundation.org
CC: Pavel Emelyanov xe...@parallels.com
CC: James Bottomley jbottom...@parallels.com
---
 fs/proc/fd.c |  123 +++
 1 file changed, 75 insertions(+), 48 deletions(-)

Index: linux-2.6.git/fs/proc/fd.c
===
--- linux-2.6.git.orig/fs/proc/fd.c
+++ linux-2.6.git/fs/proc/fd.c
@@ -6,61 +6,104 @@
 #include linux/namei.h
 #include linux/pid.h
 #include linux/security.h
+#include linux/file.h
+#include linux/seq_file.h
 
 #include linux/proc_fs.h
 
 #include internal.h
 #include fd.h
 
-#define PROC_FDINFO_MAX 64
+struct proc_fdinfo {
+   loff_t  f_pos;
+   int f_flags;
+};
 
-static int proc_fd_info(struct inode *inode, struct path *path, char *info)
+static int fdinfo_open_helper(struct inode *inode, int *f_flags, struct path 
*path)
 {
-   struct task_struct *task = get_proc_task(inode);
struct files_struct *files = NULL;
-   int fd = proc_fd(inode);
-   struct file *file;
+   struct task_struct *task;
+   int ret = -ENOENT;
 
+   task = get_proc_task(inode);
if (task) {
files = get_files_struct(task);
put_task_struct(task);
}
+
if (files) {
-   /*
-* We are not taking a ref to the file structure, so we must
-* hold -file_lock.
-*/
-   spin_lock(files-file_lock);
-   file = fcheck_files(files, fd);
-   if (file) {
-   unsigned int f_flags;
-   struct fdtable *fdt;
-
-   fdt = files_fdtable(files);
-   f_flags = file-f_flags  ~O_CLOEXEC;
-   if (close_on_exec(fd, fdt))
-   f_flags |= O_CLOEXEC;
+   int fd = proc_fd(inode);
+   struct file *fd_file;
 
+   spin_lock(files-file_lock);
+   fd_file = fcheck_files(files, fd);
+   if (fd_file) {
+   if (f_flags) {
+   struct fdtable *fdt = files_fdtable(files);
+
+   *f_flags = fd_file-f_flags  ~O_CLOEXEC;
+   if (close_on_exec(fd, fdt))
+   *f_flags |= O_CLOEXEC;
+   }
if (path) {
-   *path = file-f_path;
-   path_get(file-f_path);
+   *path = fd_file-f_path;
+   path_get(fd_file-f_path);
}
-   if (info)
-   snprintf(info, PROC_FDINFO_MAX,
-pos:\t%lli\n
-flags:\t0%o\n,
-(long long) file-f_pos,
-f_flags);
-   spin_unlock(files-file_lock);
-   put_files_struct(files);
-   return 0;
+   ret = 0;
}
spin_unlock(files-file_lock);
put_files_struct(files);
}
-   return -ENOENT;
+
+   return ret;
 }
 
+static int seq_show(struct seq_file *m, void *v)
+{
+   struct proc_fdinfo *fdinfo = m-private;
+   seq_printf(m, pos:\t%lli\nflags:\t0%o\n,
+  (long long)fdinfo-f_pos,
+  fdinfo-f_flags);
+   return 0;
+}
+
+static int seq_fdinfo_open(struct inode *inode, struct file *file)
+{
+   struct proc_fdinfo *fdinfo = NULL;
+   int ret = -ENOENT;
+
+   fdinfo = kzalloc(sizeof(*fdinfo), GFP_KERNEL);
+   if (!fdinfo)
+   return -ENOMEM;
+
+   ret = fdinfo_open_helper(inode, fdinfo-f_flags, NULL);
+   if (!ret) {
+   ret = single_open(file, seq_show, fdinfo);
+   if (!ret)
+   fdinfo = NULL;
+   }
+
+   kfree(fdinfo);
+   return ret;
+}
+
+static int 

[PATCH 0/4] cputime: Virtual cputime accounting small cleanups and consolidation v2

2012-08-14 Thread Frederic Weisbecker
Hi,

No fundamental change in this release but a rebase to solve conflicts
against latest tip:/sched/core commits.

Thanks.

Frederic Weisbecker (4):
  cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING
  sched: Move cputime code to its own file
  cputime: Consolidate vtime handling on context switch
  s390: Remove leftover account_tick_vtime() header

 arch/Kconfig   |3 +
 arch/ia64/Kconfig  |   12 +-
 arch/ia64/include/asm/switch_to.h  |8 -
 arch/ia64/kernel/time.c|4 +-
 arch/powerpc/include/asm/time.h|6 -
 arch/powerpc/kernel/process.c  |3 -
 arch/powerpc/kernel/time.c |6 +
 arch/powerpc/platforms/Kconfig.cputype |   16 +-
 arch/s390/Kconfig  |5 +-
 arch/s390/include/asm/switch_to.h  |4 -
 arch/s390/kernel/vtime.c   |4 +-
 include/linux/kernel_stat.h|6 +
 init/Kconfig   |   13 +
 kernel/sched/Makefile  |2 +-
 kernel/sched/core.c|  558 +---
 kernel/sched/cputime.c |  503 
 kernel/sched/sched.h   |   63 
 17 files changed, 606 insertions(+), 610 deletions(-)
 create mode 100644 kernel/sched/cputime.c

-- 
1.7.5.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 1/4] cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING

2012-08-14 Thread Frederic Weisbecker
S390, ia64 and powerpc all define their own version
of CONFIG_VIRT_CPU_ACCOUNTING. Generalize the config
and its description to a single place to avoid
duplication.

Signed-off-by: Frederic Weisbecker fweis...@gmail.com
Cc: Tony Luck tony.l...@intel.com
Cc: Fenghua Yu fenghua...@intel.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
---
 arch/Kconfig   |3 +++
 arch/ia64/Kconfig  |   12 +---
 arch/powerpc/platforms/Kconfig.cputype |   16 +---
 arch/s390/Kconfig  |5 ++---
 init/Kconfig   |   13 +
 5 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 72f2fa1..f78de57 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -281,4 +281,7 @@ config SECCOMP_FILTER
 
  See Documentation/prctl/seccomp_filter.txt for details.
 
+config HAVE_VIRT_CPU_ACCOUNTING
+   bool
+
 source kernel/gcov/Kconfig
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 310cf57..3c720ef 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -25,6 +25,7 @@ config IA64
select HAVE_GENERIC_HARDIRQS
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
+   select HAVE_VIRT_CPU_ACCOUNTING
select ARCH_DISCARD_MEMBLOCK
select GENERIC_IRQ_PROBE
select GENERIC_PENDING_IRQ if SMP
@@ -340,17 +341,6 @@ config FORCE_MAX_ZONEORDER
default 17 if HUGETLB_PAGE
default 11
 
-config VIRT_CPU_ACCOUNTING
-   bool Deterministic task and CPU time accounting
-   default n
-   help
- Select this option to enable more accurate task and CPU time
- accounting.  This is done by reading a CPU counter on each
- kernel entry and exit and on transitions within the kernel
- between system, softirq and hardirq state, so there is a
- small performance impact.
- If in doubt, say N here.
-
 config SMP
bool Symmetric multi-processing support
select USE_GENERIC_SMP_HELPERS
diff --git a/arch/powerpc/platforms/Kconfig.cputype 
b/arch/powerpc/platforms/Kconfig.cputype
index 30fd01d..72afd28 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -1,6 +1,7 @@
 config PPC64
bool 64-bit kernel
default n
+   select HAVE_VIRT_CPU_ACCOUNTING
help
  This option selects whether a 32-bit or a 64-bit kernel
  will be built.
@@ -337,21 +338,6 @@ config PPC_MM_SLICES
default y if (!PPC_FSL_BOOK3E  PPC64  HUGETLB_PAGE) || 
(PPC_STD_MMU_64  PPC_64K_PAGES)
default n
 
-config VIRT_CPU_ACCOUNTING
-   bool Deterministic task and CPU time accounting
-   depends on PPC64
-   default y
-   help
- Select this option to enable more accurate task and CPU time
- accounting.  This is done by reading a CPU counter on each
- kernel entry and exit and on transitions within the kernel
- between system, softirq and hardirq state, so there is a
- small performance impact.  This also enables accounting of
- stolen time on logically-partitioned systems running on
- IBM POWER5-based machines.
-
- If in doubt, say Y here.
-
 config PPC_HAVE_PMU_SUPPORT
bool
 
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 76de6b6..49ebfb6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -49,9 +49,6 @@ config GENERIC_LOCKBREAK
 config PGSTE
def_bool y if KVM
 
-config VIRT_CPU_ACCOUNTING
-   def_bool y
-
 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y
 
@@ -89,6 +86,8 @@ config S390
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_CMPXCHG_LOCAL
+   select HAVE_VIRT_CPU_ACCOUNTING
+   select VIRT_CPU_ACCOUNTING
select ARCH_DISCARD_MEMBLOCK
select BUILDTIME_EXTABLE_SORT
select ARCH_INLINE_SPIN_TRYLOCK
diff --git a/init/Kconfig b/init/Kconfig
index af6c7f8..894b073 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -267,6 +267,19 @@ config POSIX_MQUEUE_SYSCTL
depends on SYSCTL
default y
 
+config VIRT_CPU_ACCOUNTING
+   bool Deterministic task and CPU time accounting
+   depends on HAVE_VIRT_CPU_ACCOUNTING
+   default y if PPC64
+   help
+ Select this option to enable more accurate task and CPU time
+ accounting.  This is done by reading a CPU counter on each
+ kernel entry and exit and on transitions within the kernel
+ between system, softirq and hardirq state, so there is a
+ small performance impact.  This also enables accounting of
+ stolen time on logically-partitioned systems running on
+ 

[PATCH 3/4] cputime: Consolidate vtime handling on context switch

2012-08-14 Thread Frederic Weisbecker
The archs that implement virtual cputime accounting all
flush the cputime of a task when it gets descheduled
and sometimes set up some ground initialization for the
next task to account its cputime.

These archs all put their own hooks in their context
switch callbacks and handle the off-case themselves.

Consolidate this by creating a new account_switch_vtime()
callback called in generic code right after a context switch
and that these archs must implement to flush the prev task
cputime and initialize the next task cputime related state.

Signed-off-by: Frederic Weisbecker fweis...@gmail.com
Cc: Tony Luck tony.l...@intel.com
Cc: Fenghua Yu fenghua...@intel.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
---
 arch/ia64/include/asm/switch_to.h |8 
 arch/ia64/kernel/time.c   |4 ++--
 arch/powerpc/include/asm/time.h   |6 --
 arch/powerpc/kernel/process.c |3 ---
 arch/powerpc/kernel/time.c|6 ++
 arch/s390/include/asm/switch_to.h |2 --
 arch/s390/kernel/vtime.c  |4 ++--
 include/linux/kernel_stat.h   |6 ++
 kernel/sched/core.c   |1 +
 9 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/arch/ia64/include/asm/switch_to.h 
b/arch/ia64/include/asm/switch_to.h
index cb2412f..d38c7ea 100644
--- a/arch/ia64/include/asm/switch_to.h
+++ b/arch/ia64/include/asm/switch_to.h
@@ -30,13 +30,6 @@ extern struct task_struct *ia64_switch_to (void *next_task);
 extern void ia64_save_extra (struct task_struct *task);
 extern void ia64_load_extra (struct task_struct *task);
 
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void ia64_account_on_switch (struct task_struct *prev, struct 
task_struct *next);
-# define IA64_ACCOUNT_ON_SWITCH(p,n) ia64_account_on_switch(p,n)
-#else
-# define IA64_ACCOUNT_ON_SWITCH(p,n)
-#endif
-
 #ifdef CONFIG_PERFMON
   DECLARE_PER_CPU(unsigned long, pfm_syst_info);
 # define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info)  0x1)
@@ -49,7 +42,6 @@ extern void ia64_account_on_switch (struct task_struct *prev, 
struct task_struct
 || PERFMON_IS_SYSWIDE())
 
 #define __switch_to(prev,next,last) do {   
 \
-   IA64_ACCOUNT_ON_SWITCH(prev, next); 
 \
if (IA64_HAS_EXTRA_STATE(prev)) 
 \
ia64_save_extra(prev);  
 \
if (IA64_HAS_EXTRA_STATE(next)) 
 \
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index ecc904b..6247197 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -88,10 +88,10 @@ extern cputime_t cycle_to_cputime(u64 cyc);
  * accumulated times to the current process, and to prepare accounting on
  * the next process.
  */
-void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
+void account_switch_vtime(struct task_struct *prev)
 {
struct thread_info *pi = task_thread_info(prev);
-   struct thread_info *ni = task_thread_info(next);
+   struct thread_info *ni = task_thread_info(current);
cputime_t delta_stime, delta_utime;
__u64 now;
 
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 3b4b4a8..c1f2676 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -197,12 +197,6 @@ struct cpu_usage {
 
 DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
 
-#if defined(CONFIG_VIRT_CPU_ACCOUNTING)
-#define account_process_vtime(tsk) account_process_tick(tsk, 0)
-#else
-#define account_process_vtime(tsk) do { } while (0)
-#endif
-
 extern void secondary_cpu_time_init(void);
 
 DECLARE_PER_CPU(u64, decrementers_next_tb);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 710f400..d73fa99 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -514,9 +514,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
 
local_irq_save(flags);
 
-   account_system_vtime(current);
-   account_process_vtime(current);
-
/*
 * We can't take a PMU exception inside _switch() since there is a
 * window where the kernel stack SLB and the kernel stack are out
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index be171ee..49da7f0 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -366,6 +366,12 @@ void account_process_tick(struct task_struct *tsk, int 
user_tick)
account_user_time(tsk, utime, utimescaled);
 }
 
+void 

[PATCH 2/4] sched: Move cputime code to its own file

2012-08-14 Thread Frederic Weisbecker
Extract cputime code from the giant sched/core.c and
put it in its own file. This make it easier to deal with
this particular area and de-bloat a bit more core.c

Signed-off-by: Frederic Weisbecker fweis...@gmail.com
Cc: Tony Luck tony.l...@intel.com
Cc: Fenghua Yu fenghua...@intel.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
---
 kernel/sched/Makefile  |2 +-
 kernel/sched/core.c|  557 +---
 kernel/sched/cputime.c |  503 +++
 kernel/sched/sched.h   |   63 ++
 4 files changed, 569 insertions(+), 556 deletions(-)
 create mode 100644 kernel/sched/cputime.c

diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 173ea52..f06d249 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -11,7 +11,7 @@ ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
 CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer
 endif
 
-obj-y += core.o clock.o idle_task.o fair.o rt.o stop_task.o
+obj-y += core.o clock.o cputime.o idle_task.o fair.o rt.o stop_task.o
 obj-$(CONFIG_SMP) += cpupri.o
 obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
 obj-$(CONFIG_SCHEDSTATS) += stats.o
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4376c9f..ae3bcaa 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -740,126 +740,6 @@ void deactivate_task(struct rq *rq, struct task_struct 
*p, int flags)
dequeue_task(rq, p, flags);
 }
 
-#ifdef CONFIG_IRQ_TIME_ACCOUNTING
-
-/*
- * There are no locks covering percpu hardirq/softirq time.
- * They are only modified in account_system_vtime, on corresponding CPU
- * with interrupts disabled. So, writes are safe.
- * They are read and saved off onto struct rq in update_rq_clock().
- * This may result in other CPU reading this CPU's irq time and can
- * race with irq/account_system_vtime on this CPU. We would either get old
- * or new value with a side effect of accounting a slice of irq time to wrong
- * task when irq is in progress while we read rq-clock. That is a worthy
- * compromise in place of having locks on each irq in account_system_time.
- */
-static DEFINE_PER_CPU(u64, cpu_hardirq_time);
-static DEFINE_PER_CPU(u64, cpu_softirq_time);
-
-static DEFINE_PER_CPU(u64, irq_start_time);
-static int sched_clock_irqtime;
-
-void enable_sched_clock_irqtime(void)
-{
-   sched_clock_irqtime = 1;
-}
-
-void disable_sched_clock_irqtime(void)
-{
-   sched_clock_irqtime = 0;
-}
-
-#ifndef CONFIG_64BIT
-static DEFINE_PER_CPU(seqcount_t, irq_time_seq);
-
-static inline void irq_time_write_begin(void)
-{
-   __this_cpu_inc(irq_time_seq.sequence);
-   smp_wmb();
-}
-
-static inline void irq_time_write_end(void)
-{
-   smp_wmb();
-   __this_cpu_inc(irq_time_seq.sequence);
-}
-
-static inline u64 irq_time_read(int cpu)
-{
-   u64 irq_time;
-   unsigned seq;
-
-   do {
-   seq = read_seqcount_begin(per_cpu(irq_time_seq, cpu));
-   irq_time = per_cpu(cpu_softirq_time, cpu) +
-  per_cpu(cpu_hardirq_time, cpu);
-   } while (read_seqcount_retry(per_cpu(irq_time_seq, cpu), seq));
-
-   return irq_time;
-}
-#else /* CONFIG_64BIT */
-static inline void irq_time_write_begin(void)
-{
-}
-
-static inline void irq_time_write_end(void)
-{
-}
-
-static inline u64 irq_time_read(int cpu)
-{
-   return per_cpu(cpu_softirq_time, cpu) + per_cpu(cpu_hardirq_time, cpu);
-}
-#endif /* CONFIG_64BIT */
-
-/*
- * Called before incrementing preempt_count on {soft,}irq_enter
- * and before decrementing preempt_count on {soft,}irq_exit.
- */
-void account_system_vtime(struct task_struct *curr)
-{
-   unsigned long flags;
-   s64 delta;
-   int cpu;
-
-   if (!sched_clock_irqtime)
-   return;
-
-   local_irq_save(flags);
-
-   cpu = smp_processor_id();
-   delta = sched_clock_cpu(cpu) - __this_cpu_read(irq_start_time);
-   __this_cpu_add(irq_start_time, delta);
-
-   irq_time_write_begin();
-   /*
-* We do not account for softirq time from ksoftirqd here.
-* We want to continue accounting softirq time to ksoftirqd thread
-* in that case, so as not to confuse scheduler with a special task
-* that do not consume any time, but still wants to run.
-*/
-   if (hardirq_count())
-   __this_cpu_add(cpu_hardirq_time, delta);
-   else if (in_serving_softirq()  curr != this_cpu_ksoftirqd())
-   __this_cpu_add(cpu_softirq_time, delta);
-
-   irq_time_write_end();
-   local_irq_restore(flags);
-}
-EXPORT_SYMBOL_GPL(account_system_vtime);
-
-#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
-
-#ifdef CONFIG_PARAVIRT
-static inline u64 steal_ticks(u64 steal)
-{
-   

[PATCH 4/4] s390: Remove leftover account_tick_vtime() header

2012-08-14 Thread Frederic Weisbecker
The function doesn't seem to exist anymore.

Signed-off-by: Frederic Weisbecker fweis...@gmail.com
Cc: Tony Luck tony.l...@intel.com
Cc: Fenghua Yu fenghua...@intel.com
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Peter Zijlstra pet...@infradead.org
---
 arch/s390/include/asm/switch_to.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/switch_to.h 
b/arch/s390/include/asm/switch_to.h
index e7f9b3d..314cc94 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -89,8 +89,6 @@ static inline void restore_access_regs(unsigned int *acrs)
prev = __switch_to(prev,next);  \
 } while (0)
 
-extern void account_tick_vtime(struct task_struct *);
-
 #define finish_arch_switch(prev) do {   \
set_fs(current-thread.mm_segment);  \
 } while (0)
-- 
1.7.5.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: [RFC 2/2] cma: support MIGRATE_DISCARD

2012-08-14 Thread Michal Nazarewicz
Minchan Kim minc...@kernel.org writes:
 This patch introudes MIGRATE_DISCARD mode in migration.
 It drop clean cache pages instead of migration so that
 migration latency could be reduced. Of course, it could
 evict code pages but latency of big contiguous memory
 is more important than some background application's slow down
 in mobile embedded enviroment.

 Signed-off-by: Minchan Kim minc...@kernel.org

This looks good to me.

 ---
  include/linux/migrate_mode.h |   11 +++---
  mm/migrate.c |   50 
 +-
  mm/page_alloc.c  |2 +-
  3 files changed, 49 insertions(+), 14 deletions(-)

 diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
 index ebf3d89..04ca19c 100644
 --- a/include/linux/migrate_mode.h
 +++ b/include/linux/migrate_mode.h
 @@ -6,11 +6,16 @@
   *   on most operations but not -writepage as the potential stall time
   *   is too significant
   * MIGRATE_SYNC will block when migrating pages
 + * MIGRTATE_DISCARD will discard clean cache page instead of migration
 + *
 + * MIGRATE_ASYNC, MIGRATE_SYNC_LIGHT, MIGRATE_SYNC shouldn't be used
 + * together as OR flag.
   */
  enum migrate_mode {
 - MIGRATE_ASYNC,
 - MIGRATE_SYNC_LIGHT,
 - MIGRATE_SYNC,
 + MIGRATE_ASYNC = 1  0,
 + MIGRATE_SYNC_LIGHT = 1  1,
 + MIGRATE_SYNC = 1  2,
 + MIGRATE_DISCARD = 1  3,
  };

Since CMA is the only user of MIGRATE_DISCARD it may be worth it to
guard it inside an #ifdef, eg:

#ifdef CONFIG_CMA
MIGRATE_DISCARD = 1  3,
#define is_migrate_discard(mode) (((mode)  MIGRATE_DISCARD) == MIGRATE_DISCARD)
#endif

  
  #endif   /* MIGRATE_MODE_H_INCLUDED */
 diff --git a/mm/migrate.c b/mm/migrate.c
 index 77ed2d7..8119a59 100644
 --- a/mm/migrate.c
 +++ b/mm/migrate.c
 @@ -685,9 +685,12 @@ static int __unmap_and_move(struct page *page, struct 
 page *newpage,
   int remap_swapcache = 1;
   struct mem_cgroup *mem;
   struct anon_vma *anon_vma = NULL;
 + enum ttu_flags ttu_flags;
 + bool discard_mode = false;
 + bool file = false;
  
   if (!trylock_page(page)) {
 - if (!force || mode == MIGRATE_ASYNC)
 + if (!force || mode  MIGRATE_ASYNC)

+   if (!force || (mode  MIGRATE_ASYNC))

   goto out;
  
   /*


-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo--

pgpLT4dHqBYb9.pgp
Description: PGP signature


Re: [patch 1/8] procfs: Move /proc/pid/fd[info] handling code to fd.[ch]

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This patch prepares the ground for further extension of
 /proc/pid/fd[info] handling code by moving fdinfo handling
 code into fs/proc/fd.c.
 
 I think such move makes both fs/proc/base.c and fs/proc/fd.c
 easier to read.
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

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


Re: [patch 2/8] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This patch converts /proc/pid/fdinfo/ handling routines to seq-file which
 is needed to extend seq operations and plug in auxiliary fdinfo provides
 from subsystems like eventfd/eventpoll/fsnotify.
 
 Note the proc_fd_link no longer call for proc_fd_info, simply because
 proc_fd_info is converted to seq_fdinfo_open (which is seq-file open()
 prototype), moreover in further patches I need to provide two seq_fdinfo_open
 variants -- one with CONFIG_CHECKPOINT_RESTORE and one without this
 symbol. All in one -- this will look more messy then.
 
 Also, to eliminate code duplication (and Pavel's concerns) the 
 fdinfo_open_helper
 function introduced which is used in both seq_fdinfo_open and proc_fd_link.
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


Re: [patch 3/8] procfs: Add ability to plug in auxiliary fdinfo providers

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This patch brings ability to plug in auxiliary fdinfo providers.
 For example in further patches eventfd, evenpoll and fsnotify
 will print out information associated with files.
 
 This feature is CONFIG_CHECKPOINT_RESTORE guarded to eliminate
 overhead for those who don't need it at all (this
 unfortunately makes patch bigger than I wanted).
 
 The basic usage rule is the following
 
  - fdinfo provider should register own show method
via proc_register_fdinfo_driver call, where show
methods are rather well known seq-file operations
 
  - once the kernel opens /proc/$pid/fdinfo/$fd file
it calls for -probe() method in registered fdinfo
drivers, and if probe success, then seq-file show
operations will be called to provide out additional
infomation
 
 Initially we considered to inject some show metod to
 file_operations but since there really a number of
 file_operations declared inside kernel (and in real the
 further patches cover onle eventfd/epoll/inotify) the
 waste of memory space will be inacceptable I think.
 
 Pavel, I've left seq_next memthod as it was simply because
 we can't leave seq_next() after calling extra-driver-ops-start
 without increasing pos, thus we need to call for show manually
 once.
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


[PATCH v2 00/14] MFD/ASoC/Input: twl4030-audio submodule DT support

2012-08-14 Thread Peter Ujfalusi
Hello,

Changes since v1:
- Get the MCLK frequencey from twl-core driver (via new API)
- hs_extmute_disable_level parameter has been removed
- empty of_find_node_by_name() in of.h for !CONFIG_OF builds

Mark: the extmute GPIO handling (when it is used) remained in the codec driver
for now. I can think more on how to add support for this type of mute control.
If you can point me to other codec needing this it would help on designing
something which is common enough for other users.
As for now I have a separate series to add GPIO controlled output amps (hp/spk).
I will send that to review soon.

Introl mail from v1:

The following series adds DT support for the twl4030 audio submodule which
provides audio codec and vibra functionality.

The MFD core driver is probed via DT, it will create the needed child devices
based on the provided information in the DT blob.
Child drivers (vibra, ASoC codec) will parse the core's node if needed to get
the needed parameters for their configuration.

In the ASoC codec driver the hs_extmute callback (which was used to toggle a
GPIO line) has been removed. The codec driver will receive the GPIO number
(if it is needed on the platform).

If the series is OK (and no objections from the maintainers), it would be good
if this can go via audio. Changed files are well contained within the
twl4030-audio stack so I do not expect merge issues later.

The series has been tested on BeagleBoard (with the McBSP DT series, and with
the upcoming DT audio support for BeagleBoard).

Regards,
Peter
---
Peter Ujfalusi (14):
  MFD: twl4030-audio: Clean up MODULE_* and platform_driver part
  MFD: twl4030-audio: Convert to use devm_kzalloc
  MFD: twl4030-audio: Rearange and clean-up the probe function
  MFD: twl-core: Add API to query the HFCLK rate
  MFD: twl4030-audio: Get audio MCLK via twl-core API instead of pdata
  dt: Add empty of_find_node_by_name() function
  MFD: twl4030-audio: Add DT support
  Input: twl4030-vibra: Support for DT booted kernel
  ASoC: twl4030: Move hs_extmute GPIO handling to driver
  ARM: OMAP/ASoC: Zoom2: Let the codec to handle the hs_extmute GPIO
  ASoC/MFD: twl4030: Remove set_hs_extmute callback from platform data
  ASoC: twl4030: Convert to use devm_kzalloc
  ASoC: twl4030: Add pointer to pdata within the private data
  ASoC: twl4030: Support for DT booted kernel

 .../devicetree/bindings/mfd/twl4030-audio.txt  |   46 +
 arch/arm/mach-omap2/board-zoom-peripherals.c   |9 +--
 arch/arm/mach-omap2/include/mach/board-zoom.h  |2 -
 drivers/input/misc/twl4030-vibra.c |   20 -
 drivers/mfd/twl-core.c |   32 ++
 drivers/mfd/twl4030-audio.c|  107 +---
 include/linux/i2c/twl.h|3 +-
 include/linux/of.h |6 +
 sound/soc/codecs/twl4030.c |  103 +++
 sound/soc/omap/zoom2.c |4 -
 10 files changed, 261 insertions(+), 71 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl4030-audio.txt

-- 
1.7.8.6

--
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/14] MFD: twl4030-audio: Clean up MODULE_* and platform_driver part

2012-08-14 Thread Peter Ujfalusi
Place the MODULE_* lines in the same block and add MODULE_DESCRIPTION.
Rearange the platform_driver structure at the same time.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/mfd/twl4030-audio.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index 838ce4e..ac04b4f 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -250,18 +250,18 @@ static int __devexit twl4030_audio_remove(struct 
platform_device *pdev)
return 0;
 }
 
-MODULE_ALIAS(platform:twl4030-audio);
-
 static struct platform_driver twl4030_audio_driver = {
-   .probe  = twl4030_audio_probe,
-   .remove = __devexit_p(twl4030_audio_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = twl4030-audio,
},
+   .probe  = twl4030_audio_probe,
+   .remove = __devexit_p(twl4030_audio_remove),
 };
 
 module_platform_driver(twl4030_audio_driver);
 
 MODULE_AUTHOR(Peter Ujfalusi peter.ujfal...@ti.com);
+MODULE_DESCRIPTION(TWL4030 audio block MFD driver);
 MODULE_LICENSE(GPL);
+MODULE_ALIAS(platform:twl4030-audio);
-- 
1.7.8.6

--
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 4/8] fs, eventfd: Add procfs fdinfo helper

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This allow us to print out raw counter value.
 The /proc/pid/fdinfo/fd output is
 
  | pos:   0
  | flags: 04002
  | eventfd-count:   5a
 
 This feature is CONFIG_CHECKPOINT_RESTORE only.
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


[PATCH v2 02/14] MFD: twl4030-audio: Convert to use devm_kzalloc

2012-08-14 Thread Peter Ujfalusi
Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/mfd/twl4030-audio.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index ac04b4f..efa2d42 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -188,7 +188,8 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
val, TWL4030_REG_APLL_CTL);
 
-   audio = kzalloc(sizeof(struct twl4030_audio), GFP_KERNEL);
+   audio = devm_kzalloc(pdev-dev, sizeof(struct twl4030_audio),
+GFP_KERNEL);
if (!audio)
return -ENOMEM;
 
@@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
ret = -ENODEV;
}
 
-   if (!ret)
-   return 0;
+   if (ret) {
+   platform_set_drvdata(pdev, NULL);
+   twl4030_audio_dev = NULL;
+   }
 
-   platform_set_drvdata(pdev, NULL);
-   kfree(audio);
-   twl4030_audio_dev = NULL;
return ret;
 }
 
 static int __devexit twl4030_audio_remove(struct platform_device *pdev)
 {
-   struct twl4030_audio *audio = platform_get_drvdata(pdev);
-
mfd_remove_devices(pdev-dev);
platform_set_drvdata(pdev, NULL);
-   kfree(audio);
twl4030_audio_dev = NULL;
 
return 0;
-- 
1.7.8.6

--
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/14] MFD: twl-core: Add API to query the HFCLK rate

2012-08-14 Thread Peter Ujfalusi
CFG_BOOT register's HFCLK_FREQ field hold information about the used HFCLK
frequency.
Add possibility for users to get the configured rate based on this
register.
This register was configured during boot, without it the chip would not
operate correctly, so we can trust on this information.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/mfd/twl-core.c  |   32 
 include/linux/i2c/twl.h |1 +
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 1c32afe..f162b68 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -552,6 +552,38 @@ int twl_get_version(void)
 }
 EXPORT_SYMBOL_GPL(twl_get_version);
 
+/**
+ * twl_get_hfclk_rate - API to get TWL external HFCLK clock rate.
+ *
+ * Api to get the TWL HFCLK rate based on BOOT_CFG register.
+ */
+int twl_get_hfclk_rate(void)
+{
+   u8 ctrl;
+   int rate;
+
+   twl_i2c_read_u8(TWL_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
+
+   switch (ctrl  0x3) {
+   case HFCLK_FREQ_19p2_MHZ:
+   rate = 1920;
+   break;
+   case HFCLK_FREQ_26_MHZ:
+   rate = 2600;
+   break;
+   case HFCLK_FREQ_38p4_MHZ:
+   rate = 3840;
+   break;
+   default:
+   pr_err(TWL4030: HFCLK is not configured\n);
+   rate = -EINVAL;
+   break;
+   }
+
+   return rate;
+}
+EXPORT_SYMBOL_GPL(twl_get_hfclk_rate);
+
 static struct device *
 add_numbered_child(unsigned chip, const char *name, int num,
void *pdata, unsigned pdata_len,
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 7ea898c..ac6488c 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -188,6 +188,7 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned 
num_bytes);
 
 int twl_get_type(void);
 int twl_get_version(void);
+int twl_get_hfclk_rate(void);
 
 int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
 int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
-- 
1.7.8.6

--
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/5] sgi-xp: Call netif_carrier_off() after register_netdev()

2012-08-14 Thread Robin Holt
On Tue, Aug 14, 2012 at 02:28:51PM +0400, Ilya Shchepetkov wrote:
 For carrier detection to work properly when binding the driver with a
 cable unplugged, netif_carrier_off() should be calle after
 register_netdev(), not before.
 
 Calling netif_carrier_off() before register_netdev() was causing the
 network interface to miss a linkwatch pending event leading to an
 inconsistent state if the link is not up when interface is initialized.
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Ilya Shchepetkov shchepet...@ispras.ru

Acked-by: Robin Holt h...@sgi.com

 ---
  drivers/misc/sgi-xp/xpnet.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
 index 3fac67a..9296c8d 100644
 --- a/drivers/misc/sgi-xp/xpnet.c
 +++ b/drivers/misc/sgi-xp/xpnet.c
 @@ -550,8 +550,6 @@ xpnet_init(void)
   return -ENOMEM;
   }
  
 - netif_carrier_off(xpnet_device);
 -
   xpnet_device-netdev_ops = xpnet_netdev_ops;
   xpnet_device-mtu = XPNET_DEF_MTU;
  
 @@ -584,6 +582,8 @@ xpnet_init(void)
   kfree(xpnet_broadcast_partitions);
   }
  
 + netif_carrier_off(xpnet_device);
 +
   return result;
  }
  
 -- 
 1.7.7
--
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/14] ARM: OMAP/ASoC: Zoom2: Let the codec to handle the hs_extmute GPIO

2012-08-14 Thread Peter Ujfalusi
Remove the use of set_hs_extmute callback and let the codec driver to
handle the extmute GPIO.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 arch/arm/mach-omap2/board-zoom-peripherals.c  |9 ++---
 arch/arm/mach-omap2/include/mach/board-zoom.h |2 --
 sound/soc/omap/zoom2.c|4 
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c 
b/arch/arm/mach-omap2/board-zoom-peripherals.c
index b797cb2..a7d3b04 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -34,6 +34,7 @@
 #include common-board-devices.h
 
 #define OMAP_ZOOM_WLAN_PMENA_GPIO  (101)
+#define ZOOM2_HEADSET_EXTMUTE_GPIO (153)
 #define OMAP_ZOOM_WLAN_IRQ_GPIO(162)
 
 #define LCD_PANEL_ENABLE_GPIO  (7 + OMAP_MAX_GPIO_LINES)
@@ -244,12 +245,6 @@ static int zoom_twl_gpio_setup(struct device *dev,
return ret;
 }
 
-/* EXTMUTE callback function */
-static void zoom2_set_hs_extmute(int mute)
-{
-   gpio_set_value(ZOOM2_HEADSET_EXTMUTE_GPIO, mute);
-}
-
 static struct twl4030_gpio_platform_data zoom_gpio_data = {
.gpio_base  = OMAP_MAX_GPIO_LINES,
.irq_base   = TWL4030_GPIO_IRQ_BASE,
@@ -279,7 +274,7 @@ static int __init omap_i2c_init(void)
 
codec_data-ramp_delay_value = 3;   /* 161 ms */
codec_data-hs_extmute = 1;
-   codec_data-set_hs_extmute = zoom2_set_hs_extmute;
+   codec_data-hs_extmute_gpio = ZOOM2_HEADSET_EXTMUTE_GPIO;
}
omap_pmic_init(1, 2400, twl5030, INT_34XX_SYS_NIRQ, zoom_twldata);
omap_register_i2c_bus(2, 400, NULL, 0);
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h 
b/arch/arm/mach-omap2/include/mach/board-zoom.h
index 775fdc3..2e94869 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
@@ -8,5 +8,3 @@
 extern int __init zoom_debugboard_init(void);
 extern void __init zoom_peripherals_init(void);
 extern void __init zoom_display_init(void);
-
-#define ZOOM2_HEADSET_EXTMUTE_GPIO 153
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 920e0d9..df97a41 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -191,9 +191,6 @@ static int __init zoom2_soc_init(void)
BUG_ON(gpio_request(ZOOM2_HEADSET_MUX_GPIO, hs_mux)  0);
gpio_direction_output(ZOOM2_HEADSET_MUX_GPIO, 0);
 
-   BUG_ON(gpio_request(ZOOM2_HEADSET_EXTMUTE_GPIO, ext_mute)  0);
-   gpio_direction_output(ZOOM2_HEADSET_EXTMUTE_GPIO, 0);
-
return 0;
 
 err1:
@@ -207,7 +204,6 @@ module_init(zoom2_soc_init);
 static void __exit zoom2_soc_exit(void)
 {
gpio_free(ZOOM2_HEADSET_MUX_GPIO);
-   gpio_free(ZOOM2_HEADSET_EXTMUTE_GPIO);
 
platform_device_unregister(zoom2_snd_device);
 }
-- 
1.7.8.6

--
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/14] ASoC/MFD: twl4030: Remove set_hs_extmute callback from platform data

2012-08-14 Thread Peter Ujfalusi
We no longer have users for the set_hs_extmute callback which has been
replaced by hs_extmute_gpio so the codec driver can handle the external
mute if it is needed by the board.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 include/linux/i2c/twl.h|2 --
 sound/soc/codecs/twl4030.c |6 --
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 2040309..a4885a6 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -667,8 +667,6 @@ struct twl4030_codec_data {
unsigned int check_defaults:1;
unsigned int reset_registers:1;
unsigned int hs_extmute:1;
-   void (*set_hs_extmute)(int mute); /* Deprecated, use hs_extmute_gpio and
-hs_extmute_disable_level */
int hs_extmute_gpio;
 };
 
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 5fc271a..27ccea4 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -767,9 +767,6 @@ static void headset_ramp(struct snd_soc_codec *codec, int 
ramp)
if (pdata  pdata-hs_extmute) {
if (gpio_is_valid(pdata-hs_extmute_gpio)) {
gpio_set_value(pdata-hs_extmute_gpio, 1);
-   } else if (pdata-set_hs_extmute) {
-   dev_warn(codec-dev, set_hs_extmute is deprecated\n);
-   pdata-set_hs_extmute(1);
} else {
hs_pop |= TWL4030_EXTMUTE;
twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
@@ -808,9 +805,6 @@ static void headset_ramp(struct snd_soc_codec *codec, int 
ramp)
if (pdata  pdata-hs_extmute) {
if (gpio_is_valid(pdata-hs_extmute_gpio)) {
gpio_set_value(pdata-hs_extmute_gpio, 0);
-   } else if (pdata-set_hs_extmute) {
-   dev_warn(codec-dev, set_hs_extmute is deprecated\n);
-   pdata-set_hs_extmute(0);
} else {
hs_pop = ~TWL4030_EXTMUTE;
twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
-- 
1.7.8.6

--
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 6/8] fs, exportfs: Add export_encode_inode_fh helper

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 To provide fsnotify object inodes being watched without
 binding to alphabetical path we need to encode them with
 exportfs help. This patch adds a helper which operates
 with plain inodes directly.
 
 This feature is CONFIG_CHECKPOINT_RESTORE only.
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


[PATCH v2 14/14] ASoC: twl4030: Support for DT booted kernel

2012-08-14 Thread Peter Ujfalusi
When the kernel has been booted with DT blob the platform data is NULL for
the driver.
We need to construct the pdata based on the DT information for runtime use.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 sound/soc/codecs/twl4030.c |   57 +--
 1 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 8b13d50..f13c91a 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -26,6 +26,8 @@
 #include linux/pm.h
 #include linux/i2c.h
 #include linux/platform_device.h
+#include linux/of.h
+#include linux/of_gpio.h
 #include linux/i2c/twl.h
 #include linux/slab.h
 #include linux/gpio.h
@@ -295,13 +297,59 @@ static inline void twl4030_reset_registers(struct 
snd_soc_codec *codec)
 
 }
 
-static void twl4030_init_chip(struct snd_soc_codec *codec)
+static void twl4030_setup_pdata_of(struct twl4030_codec_data *pdata,
+  struct device_node *node)
+{
+   int value;
+
+   of_property_read_u32(node, ti,digimic_delay,
+pdata-digimic_delay);
+   of_property_read_u32(node, ti,ramp_delay_value,
+pdata-ramp_delay_value);
+   of_property_read_u32(node, ti,offset_cncl_path,
+pdata-offset_cncl_path);
+   if (!of_property_read_u32(node, ti,hs_extmute, value))
+   pdata-hs_extmute = value;
+
+   pdata-hs_extmute_gpio = of_get_named_gpio(node,
+  ti,hs_extmute_gpio, 0);
+   if (gpio_is_valid(pdata-hs_extmute_gpio))
+   pdata-hs_extmute = 1;
+}
+
+static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec 
*codec)
 {
struct twl4030_codec_data *pdata = dev_get_platdata(codec-dev);
+   struct device_node *twl4030_codec_node = NULL;
+
+#ifdef CONFIG_OF
+   twl4030_codec_node = of_find_node_by_name(codec-dev-parent-of_node,
+ codec);
+#endif
+
+   if (!pdata  twl4030_codec_node) {
+   pdata = devm_kzalloc(codec-dev,
+sizeof(struct twl4030_codec_data),
+GFP_KERNEL);
+   if (!pdata) {
+   dev_err(codec-dev, Can not allocate memory\n);
+   return NULL;
+   }
+   twl4030_setup_pdata_of(pdata, twl4030_codec_node);
+   }
+
+   return pdata;
+}
+
+static void twl4030_init_chip(struct snd_soc_codec *codec)
+{
+   struct twl4030_codec_data *pdata;
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
u8 reg, byte;
int i = 0;
 
+   pdata = twl4030_get_pdata(codec);
+
if (pdata  pdata-hs_extmute 
gpio_is_valid(pdata-hs_extmute_gpio)) {
int ret;
@@ -2284,13 +2332,6 @@ static struct snd_soc_codec_driver soc_codec_dev_twl4030 
= {
 
 static int __devinit twl4030_codec_probe(struct platform_device *pdev)
 {
-   struct twl4030_codec_data *pdata = pdev-dev.platform_data;
-
-   if (!pdata) {
-   dev_err(pdev-dev, platform_data is missing\n);
-   return -EINVAL;
-   }
-
return snd_soc_register_codec(pdev-dev, soc_codec_dev_twl4030,
twl4030_dai, ARRAY_SIZE(twl4030_dai));
 }
-- 
1.7.8.6

--
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 7/8] fs, notify: Add procfs fdinfo helper v3

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This allow us to print out fsnotify details such as
 watchee inode, device, mask and file handle.
 
 For example for inotify objects the output is
 
  | pos: 0
  | flags:   0200
  | inotify wd:3 ino: 9e7e sdev:   800013 mask:  800afce 
 ignored_mask:0 fhandle-bytes:8 fhandle-type:1 
 f_handle: 7e9e640d1b6d
  | inotify wd:2 ino: a111 sdev:   800013 mask:  800afce 
 ignored_mask:0 fhandle-bytes:8 fhandle-type:1 
 f_handle: 11a120542153
  | inotify wd:1 ino:6b149 sdev:   800013 mask:  800afce 
 ignored_mask:0 fhandle-bytes:8 fhandle-type:1 
 f_handle: 49b1060023552153
 
 For fanotify it is like
 
  | pos: 0
  | flags:   02
  | fanotify ino:68f71 sdev:   800013 mask:1 ignored_mask: 
 4000 fhandle-bytes:8 fhandle-type:1 f_handle: 
 718f0600b9f42053
  | fanotify mnt_id:   13 mask:1 ignored_mask: 4000
 
 This feature is CONFIG_CHECKPOINT_RESTORE only. To minimize
 impact on general fsnotify code the new functionality is gathered
 in fs/notify/fdinfo.c file mostly.
 
 v2:
  - append missing colons to terms
 v3:
  - continue from pervious position in list on -next
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


Re: [PATCH V2] MIPS: Fix poweroff failure when HOTPLUG_CPU configured.

2012-08-14 Thread Huacai Chen
On Tue, Aug 14, 2012 at 7:48 PM, Ralf Baechle r...@linux-mips.org wrote:
 On Mon, Aug 13, 2012 at 08:52:24PM +0800, Huacai Chen wrote:

 When poweroff machine, kernel_power_off() call disable_nonboot_cpus().
 And if we have HOTPLUG_CPU configured, disable_nonboot_cpus() is not an
 empty function but attempt to actually disable the nonboot cpus. Since
 system state is SYSTEM_POWER_OFF, play_dead() won't be called and thus
 disable_nonboot_cpus() hangs. Therefore, we make this patch to avoid
 poweroff failure.

 diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
 index e9a5fd7..69b17a9 100644
 --- a/arch/mips/kernel/process.c
 +++ b/arch/mips/kernel/process.c
 @@ -72,9 +72,7 @@ void __noreturn cpu_idle(void)
   }
   }
  #ifdef CONFIG_HOTPLUG_CPU
 - if (!cpu_online(cpu)  !cpu_isset(cpu, cpu_callin_map) 
 - (system_state == SYSTEM_RUNNING ||
 -  system_state == SYSTEM_BOOTING))
 + if (!cpu_online(cpu)  !cpu_isset(cpu, cpu_callin_map))

 Looks good - but I'm wondering if the !cpu_isset(cpu, cpu_callin_map)
 can be removed as well?
For X86, IA64, ARM, SPARC64 and most other arch, !cpu_online(cpu) is
the only condition of play_dead(). I keep !cpu_isset(cpu,
cpu_callin_map) because this does't refuse poweroff and I don't know
why the old condition of play_dead() is so complex.


 Also, which -stable branches is this patch applicable?
3.3, 3.4 and 3.5 branch can use it, 3.2 and earlier kernels should do
some small changes.


   Ralf

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


Re: [RFC PATCH] mm: introduce N_LRU_MEMORY to distinguish between normal and movable memory

2012-08-14 Thread Christoph Lameter
On Tue, 14 Aug 2012, Hanjun Guo wrote:

 N_NORMAL_MEMORY means !LRU allocs possible.

Ok. I am fine with that change. However this is a significant change that
needs to be mentioned prominently in the changelog and there need to be
some comments explaining the meaning of these flags clearly in the source.

--
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/14] ASoC: twl4030: Add pointer to pdata within the private data

2012-08-14 Thread Peter Ujfalusi
Access the pdata via a pointer within the twl4030_priv structure.
In preparation for DeviceTree support.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 sound/soc/codecs/twl4030.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 413e698..8b13d50 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -153,8 +153,7 @@ struct twl4030_priv {
u8 predrivel_enabled, predriver_enabled;
u8 carkitl_enabled, carkitr_enabled;
 
-   /* Delay needed after enabling the digimic interface */
-   unsigned int digimic_delay;
+   struct twl4030_codec_data *pdata;
 };
 
 /*
@@ -348,7 +347,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
if (!pdata)
return;
 
-   twl4030-digimic_delay = pdata-digimic_delay;
+   twl4030-pdata = pdata;
 
reg = twl4030_read_reg_cache(codec, TWL4030_REG_HS_POPN_SET);
reg = ~TWL4030_RAMP_DELAY;
@@ -749,9 +748,9 @@ static int aif_event(struct snd_soc_dapm_widget *w,
 
 static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 {
-   struct twl4030_codec_data *pdata = codec-dev-platform_data;
unsigned char hs_gain, hs_pop;
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
+   struct twl4030_codec_data *pdata = twl4030-pdata;
/* Base values for ramp delay calculation: 2^19 - 2^26 */
unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304,
8388608, 16777216, 33554432, 67108864};
@@ -864,9 +863,10 @@ static int digimic_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
 {
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w-codec);
+   struct twl4030_codec_data *pdata = twl4030-pdata;
 
-   if (twl4030-digimic_delay)
-   twl4030_wait_ms(twl4030-digimic_delay);
+   if (pdata  pdata-digimic_delay)
+   twl4030_wait_ms(pdata-digimic_delay);
return 0;
 }
 
@@ -2248,8 +2248,8 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
 
 static int twl4030_soc_remove(struct snd_soc_codec *codec)
 {
-   struct twl4030_codec_data *pdata = dev_get_platdata(codec-dev);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
+   struct twl4030_codec_data *pdata = twl4030-pdata;
 
/* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec);
-- 
1.7.8.6

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


[GIT PULL] (xen) stable/for-linus-3.6-rc1-tag

2012-08-14 Thread Konrad Rzeszutek Wilk
Hey Linus,

Please pull this tag:

 git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git 
stable/for-linus-3.6-rc1-tag

which has just one tiny fix - way back in v3.5 we added a mechanism to populate
back pages that were released (they overlapped with MMIO regions), but 
neglected to
reserve the proper amount of virtual space for extend_brk to work properly. 
Coincidentally
some other commit aligned the _brk space to larger area so I didn't trigger 
this until
it was run on a machine with more than 2GB of MMIO space.

 arch/x86/xen/p2m.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

Konrad Rzeszutek Wilk (1):
  xen/p2m: Reserve 8MB of _brk space for P2M leafs when populating back.



pgpPnSwPRMBYj.pgp
Description: PGP signature


[PATCH v2 07/14] MFD: twl4030-audio: Add DT support

2012-08-14 Thread Peter Ujfalusi
Support for loading the twl4030 audio module via devicetree.
Sub devices for codec and vibra will be created as mfd devices once the
core MFD driver is loaded when the kernel is booted with a DT blob.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 .../devicetree/bindings/mfd/twl4030-audio.txt  |   46 
 drivers/mfd/twl4030-audio.c|   56 +---
 2 files changed, 95 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl4030-audio.txt

diff --git a/Documentation/devicetree/bindings/mfd/twl4030-audio.txt 
b/Documentation/devicetree/bindings/mfd/twl4030-audio.txt
new file mode 100644
index 000..414d2ae
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl4030-audio.txt
@@ -0,0 +1,46 @@
+Texas Instruments TWL family (twl4030) audio module
+
+The audio module inside the TWL family consist of an audio codec and a vibra
+driver.
+
+Required properties:
+- compatible : must be ti,twl4030-audio
+
+Optional properties, nodes:
+
+Audio functionality:
+- codec { }: Need to be present if the audio functionality is used. Within this
+section the following options can be used:
+- ti,digimic_delay: Delay need after enabling the digimic to reduce artifacts
+   from the start of the recorded sample (in ms)
+-ti,ramp_delay_value: HS ramp delay configuration to reduce pop noise
+-ti,hs_extmute: Use external mute for HS pop reduction
+-ti,hs_extmute_gpio: Use external GPIO to control the external mute
+-ti,offset_cncl_path: Offset cancellation path selection, refer to TRM for the
+ valid values.
+
+Vibra functionality
+- ti,enable-vibra: Need to be set to 1 if the vibra functionality is used. if
+  missing or it is 0, the vibra functionality is disabled.
+
+Example:
+i2c1 {
+   clock-frequency = 260;
+
+   twl: twl@48 {
+   reg = 0x48;
+   interrupts = 7; /* SYS_NIRQ cascaded to intc */
+   interrupt-parent = intc;
+
+   twl_audio: audio {
+   compatible = ti,twl4030-audio;
+
+   ti,enable-vibra = 1;
+
+   codec {
+   ti,ramp_delay_value = 3;
+   };
+
+   };
+   };
+};
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index a48bf3a..ed9c5d9 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -28,6 +28,8 @@
 #include linux/kernel.h
 #include linux/fs.h
 #include linux/platform_device.h
+#include linux/of.h
+#include linux/of_platform.h
 #include linux/i2c/twl.h
 #include linux/mfd/core.h
 #include linux/mfd/twl4030-audio.h
@@ -156,15 +158,44 @@ unsigned int twl4030_audio_get_mclk(void)
 }
 EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
 
+static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
+ struct device_node *node)
+{
+   if (pdata  pdata-codec)
+   return true;
+
+#ifdef CONFIG_OF
+   if (of_find_node_by_name(node, codec))
+   return true;
+#endif
+
+   return false;
+}
+
+static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
+ struct device_node *node)
+{
+   int vibra;
+
+   if (pdata  pdata-vibra)
+   return true;
+
+   if (!of_property_read_u32(node, ti,enable-vibra, vibra)  vibra)
+   return true;
+
+   return false;
+}
+
 static int __devinit twl4030_audio_probe(struct platform_device *pdev)
 {
struct twl4030_audio *audio;
struct twl4030_audio_data *pdata = pdev-dev.platform_data;
+   struct device_node *node = pdev-dev.of_node;
struct mfd_cell *cell = NULL;
int ret, childs = 0;
u8 val;
 
-   if (!pdata) {
+   if (!pdata  !node) {
dev_err(pdev-dev, Platform data is missing\n);
return -EINVAL;
}
@@ -202,18 +233,22 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
audio-resource[TWL4030_AUDIO_RES_APLL].reg = TWL4030_REG_APLL_CTL;
audio-resource[TWL4030_AUDIO_RES_APLL].mask = TWL4030_APLL_EN;
 
-   if (pdata-codec) {
+   if (twl4030_audio_has_codec(pdata, node)) {
cell = audio-cells[childs];
cell-name = twl4030-codec;
-   cell-platform_data = pdata-codec;
-   cell-pdata_size = sizeof(*pdata-codec);
+   if (pdata) {
+   cell-platform_data = pdata-codec;
+   cell-pdata_size = sizeof(*pdata-codec);
+   }
childs++;
}
-   if (pdata-vibra) {
+   if (twl4030_audio_has_vibra(pdata, node)) {
cell = audio-cells[childs];
cell-name = twl4030-vibra;
-   cell-platform_data = pdata-vibra;
-   cell-pdata_size = sizeof(*pdata-vibra);

[PATCH v2 08/14] Input: twl4030-vibra: Support for DT booted kernel

2012-08-14 Thread Peter Ujfalusi
Add support when the kernel has been booted with DT blob. In this case the
pdata is NULL, we need to reach up to the core node and check if the codec
part has been enabled to determine if we need to coexist with the codec or
not.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/input/misc/twl4030-vibra.c |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/twl4030-vibra.c 
b/drivers/input/misc/twl4030-vibra.c
index d1e1a7e..2cfc6c7 100644
--- a/drivers/input/misc/twl4030-vibra.c
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -26,6 +26,7 @@
 #include linux/module.h
 #include linux/jiffies.h
 #include linux/platform_device.h
+#include linux/of.h
 #include linux/workqueue.h
 #include linux/i2c/twl.h
 #include linux/mfd/twl4030-audio.h
@@ -194,13 +195,28 @@ static int twl4030_vibra_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
 twl4030_vibra_suspend, twl4030_vibra_resume);
 
+static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
+ struct device_node *node)
+{
+   if (pdata  pdata-coexist)
+   return true;
+
+#ifdef CONFIG_OF
+   if (of_find_node_by_name(node, codec))
+   return true;
+#endif
+
+   return false;
+}
+
 static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
 {
struct twl4030_vibra_data *pdata = pdev-dev.platform_data;
+   struct device_node *twl4030_core_node = pdev-dev.parent-of_node;
struct vibra_info *info;
int ret;
 
-   if (!pdata) {
+   if (!pdata  !twl4030_core_node) {
dev_dbg(pdev-dev, platform_data not available\n);
return -EINVAL;
}
@@ -210,7 +226,7 @@ static int __devinit twl4030_vibra_probe(struct 
platform_device *pdev)
return -ENOMEM;
 
info-dev = pdev-dev;
-   info-coexist = pdata-coexist;
+   info-coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node);
INIT_WORK(info-play_work, vibra_play_work);
 
info-input_dev = input_allocate_device();
-- 
1.7.8.6

--
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/14] ASoC: twl4030: Convert to use devm_kzalloc

2012-08-14 Thread Peter Ujfalusi
Allocate the private data with devm_kzalloc.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 sound/soc/codecs/twl4030.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 27ccea4..413e698 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -2231,7 +2231,8 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
 {
struct twl4030_priv *twl4030;
 
-   twl4030 = kzalloc(sizeof(struct twl4030_priv), GFP_KERNEL);
+   twl4030 = devm_kzalloc(codec-dev, sizeof(struct twl4030_priv),
+  GFP_KERNEL);
if (twl4030 == NULL) {
dev_err(codec-dev, Can not allocate memory\n);
return -ENOMEM;
@@ -2253,7 +2254,6 @@ static int twl4030_soc_remove(struct snd_soc_codec *codec)
/* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec);
twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
-   kfree(twl4030);
 
if (pdata  pdata-hs_extmute  gpio_is_valid(pdata-hs_extmute_gpio))
gpio_free(pdata-hs_extmute_gpio);
-- 
1.7.8.6

--
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 5/8] fs, epoll: Add procfs fdinfo helper v2

2012-08-14 Thread Pavel Emelyanov
On 08/14/2012 06:03 PM, Cyrill Gorcunov wrote:
 This allow us to print out eventpoll target file descriptor,
 events and data, the /proc/pid/fdinfo/fd consists of
 
  | pos:   0
  | flags: 02
  | tfd:5 events:   1d data: 
 
 This feature is CONFIG_CHECKPOINT_RESTORE only.
 
 v2:
  - don't walk over all rb nodes on seq-next,
try to continue from pervious position
 
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 CC: Al Viro v...@zeniv.linux.org.uk
 CC: Alexey Dobriyan adobri...@gmail.com
 CC: Andrew Morton a...@linux-foundation.org
 CC: Pavel Emelyanov xe...@parallels.com
 CC: James Bottomley jbottom...@parallels.com
 CC: Matthew Helsley matt.hels...@gmail.com

Acked-by: Pavel Emelyanov xe...@parallels.com

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


[PATCH v2 09/14] ASoC: twl4030: Move hs_extmute GPIO handling to driver

2012-08-14 Thread Peter Ujfalusi
The external mute (if it is in use) is handled by a GPIO line. Prepare to
remove the set_hs_extmute callback and replace it with:
hs_extmute_gpio: the GPIO number to use for external mute

When the users of set_hs_extmute has been converted the callback can be removed.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 include/linux/i2c/twl.h|4 +++-
 sound/soc/codecs/twl4030.c |   32 ++--
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index ac6488c..2040309 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -667,7 +667,9 @@ struct twl4030_codec_data {
unsigned int check_defaults:1;
unsigned int reset_registers:1;
unsigned int hs_extmute:1;
-   void (*set_hs_extmute)(int mute);
+   void (*set_hs_extmute)(int mute); /* Deprecated, use hs_extmute_gpio and
+hs_extmute_disable_level */
+   int hs_extmute_gpio;
 };
 
 struct twl4030_vibra_data {
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 391fcfc..5fc271a 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -28,6 +28,7 @@
 #include linux/platform_device.h
 #include linux/i2c/twl.h
 #include linux/slab.h
+#include linux/gpio.h
 #include sound/core.h
 #include sound/pcm.h
 #include sound/pcm_params.h
@@ -302,6 +303,22 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
u8 reg, byte;
int i = 0;
 
+   if (pdata  pdata-hs_extmute 
+   gpio_is_valid(pdata-hs_extmute_gpio)) {
+   int ret;
+
+   if (!pdata-hs_extmute_gpio)
+   dev_warn(codec-dev,
+Extmute GPIO is 0 is this correct?\n);
+
+   ret = gpio_request_one(pdata-hs_extmute_gpio,
+  GPIOF_OUT_INIT_LOW, hs_extmute);
+   if (ret) {
+   dev_err(codec-dev, Failed to get hs_extmute GPIO\n);
+   pdata-hs_extmute_gpio = -1;
+   }
+   }
+
/* Check defaults, if instructed before anything else */
if (pdata  pdata-check_defaults)
twl4030_check_defaults(codec);
@@ -748,7 +765,10 @@ static void headset_ramp(struct snd_soc_codec *codec, int 
ramp)
/* Enable external mute control, this dramatically reduces
 * the pop-noise */
if (pdata  pdata-hs_extmute) {
-   if (pdata-set_hs_extmute) {
+   if (gpio_is_valid(pdata-hs_extmute_gpio)) {
+   gpio_set_value(pdata-hs_extmute_gpio, 1);
+   } else if (pdata-set_hs_extmute) {
+   dev_warn(codec-dev, set_hs_extmute is deprecated\n);
pdata-set_hs_extmute(1);
} else {
hs_pop |= TWL4030_EXTMUTE;
@@ -786,7 +806,10 @@ static void headset_ramp(struct snd_soc_codec *codec, int 
ramp)
 
/* Disable external mute */
if (pdata  pdata-hs_extmute) {
-   if (pdata-set_hs_extmute) {
+   if (gpio_is_valid(pdata-hs_extmute_gpio)) {
+   gpio_set_value(pdata-hs_extmute_gpio, 0);
+   } else if (pdata-set_hs_extmute) {
+   dev_warn(codec-dev, set_hs_extmute is deprecated\n);
pdata-set_hs_extmute(0);
} else {
hs_pop = ~TWL4030_EXTMUTE;
@@ -2230,12 +2253,17 @@ static int twl4030_soc_probe(struct snd_soc_codec 
*codec)
 
 static int twl4030_soc_remove(struct snd_soc_codec *codec)
 {
+   struct twl4030_codec_data *pdata = dev_get_platdata(codec-dev);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
/* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec);
twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
kfree(twl4030);
+
+   if (pdata  pdata-hs_extmute  gpio_is_valid(pdata-hs_extmute_gpio))
+   gpio_free(pdata-hs_extmute_gpio);
+
return 0;
 }
 
-- 
1.7.8.6

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


Re: [rfc patch] fs,reiserfs: unlock superblock before callling reiserfs_quota_on_mount()

2012-08-14 Thread Steven Rostedt
On Tue, 2012-08-14 at 15:06 +0200, Mike Galbraith wrote:
 Greetings,
 
 Using openSUSE's partitioner gizmo to set up a reiserfs partition with
 quotas and whatnot enabled rewarded me with a deadlock.

Is this just a -rt bug? Can't this deadlock also in mainline?

-- Steve

 
 In reiserfs/lock.c we see:
 ... 
 * Also this lock is often released before a call that could block because
  * reiserfs performances were partially based on the release while schedule()
  * property of the Bkl.
  */
 void reiserfs_write_lock(struct super_block *s)
 
 And in the problematic reiserfs_fill_super():
 /*
  * This function is called with the bkl, which also was the old
  * locking used here.
  * do_journal_begin() will soon check if we hold the lock (ie: was the
  * bkl). This is likely because do_journal_begin() has several another
  * callers because at this time, it doesn't seem to be necessary to
  * protect against anything.
  * Anyway, let's be conservative and lock for now.
  */
 reiserfs_write_lock(s);
 
 Given wishy-washy be conservative for now, and this lock is often
 released before a call that could block, it seemed reasonable to trade
 a little conservatism for a chance to return from the blocking
 function. 
 
 If we hold the super block lock while calling reiserfs_quota_on_mount(), we 
 can
 deadlock - mount blocks kworker/3:2, and sleeps forever more.
 
 crash ps|grep UN
 715  2   3  880220734d30  UN   0.0   0  0  [kworker/3:2]
9369   9341   2  88021ffb7560  UN   1.3  493404 123184  Xorg
9665   9664   3  880225b92ab0  UN   0.0   47368812  udisks-daemon
   10635  10403   3  880222f22c70  UN   0.0   14904936  mount
 crash bt 880220734d30
 PID: 715TASK: 880220734d30  CPU: 3   COMMAND: kworker/3:2
  #0 [8802244c3c20] schedule at 8144584b
  #1 [8802244c3cc8] __rt_mutex_slowlock at 814472b3
  #2 [8802244c3d28] rt_mutex_slowlock at 814473f5
  #3 [8802244c3dc8] reiserfs_write_lock at a05f28fd [reiserfs]
  #4 [8802244c3de8] flush_async_commits at a05ec91d [reiserfs]
  #5 [8802244c3e08] process_one_work at 81073726
  #6 [8802244c3e68] worker_thread at 81073eba
  #7 [8802244c3ec8] kthread at 810782e0
  #8 [8802244c3f48] kernel_thread_helper at 81450064
 
 crash struct rt_mutex 880222e8f628
 struct rt_mutex {
   wait_lock = {
 raw_lock = {
   slock = 65537
 }
   }, 
   wait_list = {
 node_list = {
   next = 0x8802244c3d48, 
   prev = 0x8802244c3d48
 }
   }, 
   owner = 0x880222f22c71, 
   save_state = 0
 }
 crash bt 0x880222f22c70  
   
   
   
 PID: 10635  TASK: 880222f22c70  CPU: 3   COMMAND: mount 
   
   
   
  #0 [8802216a9868] schedule at 8144584b   
   
   
   
  #1 [8802216a9910] schedule_timeout at 81446865   
   
   
   
  #2 [8802216a99a0] wait_for_common at 81445f74
  #3 [8802216a9a30] flush_work at 810712d3
  #4 [8802216a9ab0] schedule_on_each_cpu at 81074463
  #5 [8802216a9ae0] invalidate_bdev at 81178aba
  #6 [8802216a9af0] vfs_load_quota_inode at 811a3632
  #7 [8802216a9b50] dquot_quota_on_mount at 811a375c
  #8 [8802216a9b80] finish_unfinished at a05dd8b0 [reiserfs]
  #9 [8802216a9cc0] reiserfs_fill_super at a05de825 [reiserfs]
 #10 [8802216a9d90] mount_bdev at 8114c93f
 #11 [8802216a9e00] mount_fs at 8114d035
 #12 [8802216a9e50] vfs_kern_mount at 81167d36
 #13 [8802216a9e90] do_kern_mount at 811692c3
 #14 [8802216a9ed0] do_mount at 8116adb5
 #15 [8802216a9f30] sys_mount at 8116b25a
 #16 [8802216a9f80] system_call_fastpath at 8144ef12
 RIP: 7f7b9303997a  RSP: 7443c7a8  RFLAGS: 00010202
 RAX: 00a5  RBX: 8144ef12  RCX: 7f7b932e9ee0
 RDX: 7f7b93d9a400  RSI: 7f7b93d9a3e0  RDI: 7f7b93d9a3c0
 RBP: 7f7b93d9a2c0   R8: 7f7b93d9a550   R9: 0001
 R10: c0ed040e  R11: 0202  R12: 040e
 R13: 

Re: [PATCH v3 3/6] floppy: avoid leaking extra reference to queue on do_floppy_init error handling

2012-08-14 Thread Herton Ronaldo Krzesinski
On Tue, Aug 14, 2012 at 11:03:30AM +0200, Stanislaw Gruszka wrote:
 On Tue, Aug 14, 2012 at 04:20:39AM +0100, Ben Hutchings wrote:
  It's totally ridiculous that a driver should have to do this.  Any
  registered disk should have the GENHD_FL_UP flag set... so why can't
  genhd check it?  It doesn't look like floppy is the only driver affected
  by this problem, either.  So I suggest the following general fix
  (untested):
  
  ---
  Subject: genhd: Make put_disk() safe for disks that have not been registered
  
  Since commit 9f53d2f ('block: fix __blkdev_get and add_disk race
  condition'), add_disk() adds a reference to disk-queue,
 
 I do not see this? Commit 9f53d2fe insert disk_alloc_events() to add_disk(),
 but disk_alloc_events() function does not get any reference to disk-queue,
 I missed something?

I think he meant commit 523e1d3 (block: make gendisk hold a reference
to its queue) instead.

 
 Stanislaw
 

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


Re: linux-next: Tree for July 26 (uml)

2012-08-14 Thread David Howells

Rusty Russell ru...@rustcorp.com.au wrote:

 CC  arch/x86/um/../kernel/module.o
   arch/x86/um/../kernel/module.c:96:5: error: redefinition of 
   'apply_relocate_add'
   include/linux/moduleloader.h:64:19: note: previous definition of 
   'apply_relocate_add' was here
   make[2]: *** [arch/x86/um/../kernel/module.o] Error 1

Hmmm...  I'm not sure how to deal with this.  The problem is that UML doesn't
draw the:

select MODULES_USE_ELF_REL if X86_32
select MODULES_USE_ELF_RELA if X86_64

definitions from arch/foo/Kconfig that tell it what modules will look like.

Should I just enable both REL and RELA in UML, or is there a better way to do
this?

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


[PATCH v2 06/14] dt: Add empty of_find_node_by_name() function

2012-08-14 Thread Peter Ujfalusi
This commit adds an empty of_find_node_by_name() function for !CONFIG_OF
builds.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 include/linux/of.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 5919ee3..c90e59a 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -308,6 +308,12 @@ static inline const char* of_node_full_name(struct 
device_node *np)
return no-node;
 }
 
+static inline device_node *of_find_node_by_name(struct device_node *from,
+   const char *name)
+{
+   return NULL;
+}
+
 static inline bool of_have_populated_dt(void)
 {
return false;
-- 
1.7.8.6

--
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 3/6] floppy: avoid leaking extra reference to queue on do_floppy_init error handling

2012-08-14 Thread Ben Hutchings
On Tue, 2012-08-14 at 11:03 +0200, Stanislaw Gruszka wrote:
 On Tue, Aug 14, 2012 at 04:20:39AM +0100, Ben Hutchings wrote:
  On Mon, 2012-08-13 at 15:16 -0300, Herton Ronaldo Krzesinski wrote:
   After commit 3f9a5aa (floppy: Cleanup disk-queue before caling
   put_disk() if add_disk() was never called), if something fails in the
   add_disk loop, we unconditionally set disks[dr]-queue to NULL. But
   that's wrong, since we may have succesfully done an add_disk on some of
   the drives previously in the loop, and in this case we would end up with
   an extra reference to the disks[dr]-queue.
   
   Add a new global array to mark registered disks, and use that to check
   if we did an add_disk on one of the disks already. Using an array to
   track added disks also will help to simplify/cleanup code later, as
   suggested by Vivek Goyal.
  [...]
  
  It's totally ridiculous that a driver should have to do this.  Any
  registered disk should have the GENHD_FL_UP flag set... so why can't
  genhd check it?  It doesn't look like floppy is the only driver affected
  by this problem, either.  So I suggest the following general fix
  (untested):
  
  ---
  Subject: genhd: Make put_disk() safe for disks that have not been registered
  
  Since commit 9f53d2f ('block: fix __blkdev_get and add_disk race
  condition'), add_disk() adds a reference to disk-queue,
 
 I do not see this? Commit 9f53d2fe insert disk_alloc_events() to add_disk(),
 but disk_alloc_events() function does not get any reference to disk-queue,
 I missed something?

Sorry, not sure why I pointed to that one.  The reference should of
course be to:

commit 523e1d399ce0e23bec562abe2b2f8d297af81161
Author: Tejun Heo t...@kernel.org
Date:   Wed Oct 19 14:31:07 2011 +0200

block: make gendisk hold a reference to its queue

Ben.

-- 
Ben Hutchings
I say we take off; nuke the site from orbit.  It's the only way to be sure.


signature.asc
Description: This is a digitally signed message part


[PATCH v2 05/14] MFD: twl4030-audio: Get audio MCLK via twl-core API instead of pdata

2012-08-14 Thread Peter Ujfalusi
twl-core has API to get the boot time configured HFCLK rate which has the
same rate as the audio MCLK.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/mfd/twl4030-audio.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index ca2d669..a48bf3a 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -175,7 +175,7 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
return -ENOMEM;
 
mutex_init(audio-mutex);
-   audio-audio_mclk = pdata-audio_mclk;
+   audio-audio_mclk = twl_get_hfclk_rate();
 
/* Configure APLL_INFREQ and disable APLL if enabled */
switch (audio-audio_mclk) {
-- 
1.7.8.6

--
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/14] MFD: twl4030-audio: Rearange and clean-up the probe function

2012-08-14 Thread Peter Ujfalusi
To facilitate the device tree support the probe function need to be rearanged.
Small cleanup in the APLL frequency selection part as well.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 drivers/mfd/twl4030-audio.c |   34 --
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index efa2d42..ca2d669 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -169,35 +169,30 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
return -EINVAL;
}
 
+   audio = devm_kzalloc(pdev-dev, sizeof(struct twl4030_audio),
+GFP_KERNEL);
+   if (!audio)
+   return -ENOMEM;
+
+   mutex_init(audio-mutex);
+   audio-audio_mclk = pdata-audio_mclk;
+
/* Configure APLL_INFREQ and disable APLL if enabled */
-   val = 0;
-   switch (pdata-audio_mclk) {
+   switch (audio-audio_mclk) {
case 1920:
-   val |= TWL4030_APLL_INFREQ_19200KHZ;
+   val = TWL4030_APLL_INFREQ_19200KHZ;
break;
case 2600:
-   val |= TWL4030_APLL_INFREQ_26000KHZ;
+   val = TWL4030_APLL_INFREQ_26000KHZ;
break;
case 3840:
-   val |= TWL4030_APLL_INFREQ_38400KHZ;
+   val = TWL4030_APLL_INFREQ_38400KHZ;
break;
default:
dev_err(pdev-dev, Invalid audio_mclk\n);
return -EINVAL;
}
-   twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
-   val, TWL4030_REG_APLL_CTL);
-
-   audio = devm_kzalloc(pdev-dev, sizeof(struct twl4030_audio),
-GFP_KERNEL);
-   if (!audio)
-   return -ENOMEM;
-
-   platform_set_drvdata(pdev, audio);
-
-   twl4030_audio_dev = pdev;
-   mutex_init(audio-mutex);
-   audio-audio_mclk = pdata-audio_mclk;
+   twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, val, TWL4030_REG_APLL_CTL);
 
/* Codec power */
audio-resource[TWL4030_AUDIO_RES_POWER].reg = TWL4030_REG_CODEC_MODE;
@@ -222,6 +217,9 @@ static int __devinit twl4030_audio_probe(struct 
platform_device *pdev)
childs++;
}
 
+   platform_set_drvdata(pdev, audio);
+   twl4030_audio_dev = pdev;
+
if (childs)
ret = mfd_add_devices(pdev-dev, pdev-id, audio-cells,
  childs, NULL, 0);
-- 
1.7.8.6

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


Using random in interrupts for RT

2012-08-14 Thread Steven Rostedt
Thomas,

Ben Hutchings asked me if we still need genirq: Disable random call on
preempt-rt for -rt? With commit 902c098a366 random: use lockless
techniques in the interrupt path there is no more locks used. But does
it still produce high latencies?

-- Steve


--
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 2/5] x86/uprobes: implement x86 specific arch_uprobe_*_step

2012-08-14 Thread Oleg Nesterov
On 08/14, Sebastian Andrzej Siewior wrote:

 On 08/13/2012 03:24 PM, Oleg Nesterov wrote:

 this patch still adds restore_flags into arch_uprobe_task.

 Yes, but

OOPS. Yes, we need a new member in -utask now to record the state
of TIF_SINGLESTEP (X86_EFLAGS_TF actually).

I meant that, since the patch still uses TIF_SINGLESTEP,
arch_uprobe_disable_step() can check it but somehow I forgot that
since arch_uprobe_enable_step() still does user_enable_single_step()
TIF_SINGLESTEP is always set.

   static void prepare_fixups(struct arch_uprobe *auprobe, struct insn *insn)
   {
 -   bool fix_ip = true, fix_call = false;   /* defaults */
 +   bool fix_ip = true, fix_call = false, fix_tf = false;   /* defaults */
 int reg;

 insn_get_opcode(insn);  /* should be a nop */

 switch (OPCODE1(insn)) {
 +   case 0x9d:
 +   /* popf */
 +   fix_tf = true;
 +   break;
 case 0xc3:  /* ret/lret */
 case 0xcb:
 case 0xc2:
 @@ -277,6 +284,8 @@ static void prepare_fixups(struct arch_uprobe *auprobe, 
 struct insn *insn)
 auprobe-fixups |= UPROBE_FIX_IP;
 if (fix_call)
 auprobe-fixups |= UPROBE_FIX_CALL;
 +   if (fix_tf)
 +   auprobe-fixups |= UPROBE_TF_CHANGES;
   }

 I won't insist, but do we really need fix_tf? case 0x9d could simply
 add UPROBE_TF_CHANGES.

 if it is not 0x9d (in most cases) we need to decide on per-process
 basis (not per-breakpoint) whether the task has gdb watching it or not.

Yes, yes, I see, thanks.

But this doesn't explain why do we need to add the new variable, fix_tf.

case 0x9d:
auprobe-fixups |= UPROBE_TF_CHANGES;
break;

seems enough.

Oleg.

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


Re: linux-next: Tree for July 26 (uml)

2012-08-14 Thread Richard Weinberger
Am 14.08.2012 16:26, schrieb David Howells:
 Rusty Russell ru...@rustcorp.com.au wrote:
 
   CC  arch/x86/um/../kernel/module.o
 arch/x86/um/../kernel/module.c:96:5: error: redefinition of 
 'apply_relocate_add'
 include/linux/moduleloader.h:64:19: note: previous definition of 
 'apply_relocate_add' was here
 make[2]: *** [arch/x86/um/../kernel/module.o] Error 1
 
 Hmmm...  I'm not sure how to deal with this.  The problem is that UML doesn't
 draw the:
 
   select MODULES_USE_ELF_REL if X86_32
   select MODULES_USE_ELF_RELA if X86_64
 
 definitions from arch/foo/Kconfig that tell it what modules will look like.
 
 Should I just enable both REL and RELA in UML, or is there a better way to do
 this?

Is there no way to get this information from the UML subarch?
Which is currently X86_32 or X86_64.

Thanks,
//richard



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v3 3/6] floppy: avoid leaking extra reference to queue on do_floppy_init error handling

2012-08-14 Thread Herton Ronaldo Krzesinski
On Tue, Aug 14, 2012 at 04:20:39AM +0100, Ben Hutchings wrote:
 It's totally ridiculous that a driver should have to do this.  Any
 registered disk should have the GENHD_FL_UP flag set... so why can't
 genhd check it?  It doesn't look like floppy is the only driver affected
 by this problem, either.  So I suggest the following general fix
 (untested):
 
 ---
 Subject: genhd: Make put_disk() safe for disks that have not been registered
 
 Since commit 9f53d2f ('block: fix __blkdev_get and add_disk race
 condition'), add_disk() adds a reference to disk-queue, which is then
 dropped by disk_release().  But if a disk is destroyed without being
 registered through add_disk() (or if add_disk() fails at the first
 hurdle) then we have a reference imbalance.
 
 Use the GENHD_FL_UP flag to tell whether this extra reference has been
 added.  Remove the incomplete workaround from the floppy driver.

Indeed this is a more sane/right approach.

Acked-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com

Just the changelog is pointing to the wrong commit as already noted by
Stanislaw.

 
 Signed-off-by: Ben Hutchings b...@decadent.org.uk
 Cc: sta...@vger.kernel.org

-- 
[]'s
Herton
--
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] net: Checking usb_register() return value

2012-08-14 Thread Kalle Valo
On 08/14/2012 11:11 AM, Marina Makienko wrote:
 ath6kl_usb_init() does not check usb_register() return value.
 As a result it may incorrectly report success of driver initialization.
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Marina Makienko makie...@ispras.ru

Thanks, applied to ath6kl.git. But I changed the title to use ath6kl:
and made some cosmetic changes to the code.

Kalle
--
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: [net PATCH v2 2/2] net: netprio: fd passed in SCM_RIGHTS datagram not set correctly

2012-08-14 Thread John Fastabend

On 8/14/2012 5:55 AM, Neil Horman wrote:

On Mon, Aug 13, 2012 at 07:43:27PM -0700, John Fastabend wrote:

A socket fd passed in a SCM_RIGHTS datagram was not getting
updated with the new tasks cgrp prioidx. This leaves IO on
the socket tagged with the old tasks priority.

To fix this add a check in the scm recvmsg path to update the
sock cgrp prioidx with the new tasks value.

Thanks to Al Viro for catching this.

CC: Neil Horman nhor...@tuxdriver.com
Reported-by: Al Viro v...@zeniv.linux.org.uk
Signed-off-by: John Fastabend john.r.fastab...@intel.com
---



[...]


@@ -281,6 +283,9 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie 
*scm)
}
/* Bump the usage count and install the file. */
get_file(fp[i]);
+   sock = sock_from_file(fp[i], err);
+   if (sock)
+   sock-sk-sk_cgrp_prioidx = prioidx;

nit: You can replace the prioidx variable above and this set with a call to
sock_update_netprioidx

Neil



OK but then I should also make sock_update_netprioidx inline and drop
the in_interrupt() call. I'll send a v3 with this change and also a
third patch to fix a race between write_priomap and cgrp_create (also
spotted by Al Viro).

--
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] mtd: kill MTD_NAND_VERIFY_WRITE

2012-08-14 Thread Huang Shijie
Just as Artem suggested:

Both UBI and JFFS2 are able to read verify what they wrote already.
There are also MTD tests which do this verification. So I think there
is no reason to keep this in the NAND layer, let alone wasting RAM in
the driver to support this feature.

So kill MTD_NAND_VERIFY_WRITE entirely.

Signed-off-by: Huang Shijie shij...@gmail.com
---
 drivers/mtd/nand/Kconfig |9 -
 drivers/mtd/nand/ams-delta.c |   13 
 drivers/mtd/nand/au1550nd.c  |   46 ---
 drivers/mtd/nand/bcm_umi_nand.c  |   22 -
 drivers/mtd/nand/cafe_nand.c |7 
 drivers/mtd/nand/cmx270_nand.c   |   13 
 drivers/mtd/nand/diskonchip.c|   63 --
 drivers/mtd/nand/fsl_elbc_nand.c |   36 -
 drivers/mtd/nand/fsl_ifc_nand.c  |   41 
 drivers/mtd/nand/gpio.c  |   39 ---
 drivers/mtd/nand/lpc32xx_slc.c   |   19 ---
 drivers/mtd/nand/mpc5121_nfc.c   |   22 -
 drivers/mtd/nand/mxc_nand.c  |9 -
 drivers/mtd/nand/nand_base.c |   53 
 drivers/mtd/nand/nandsim.c   |   16 -
 drivers/mtd/nand/ndfc.c  |   13 
 drivers/mtd/nand/nuc900_nand.c   |   17 --
 drivers/mtd/nand/omap2.c |   23 --
 drivers/mtd/nand/pxa3xx_nand.c   |7 
 drivers/mtd/nand/r852.c  |   22 -
 drivers/mtd/nand/sh_flctl.c  |   11 --
 drivers/mtd/nand/socrates_nand.c |   19 ---
 drivers/mtd/nand/tmio_nand.c |   13 
 drivers/mtd/nand/txx9ndfmc.c |   13 
 include/linux/mtd/nand.h |3 --
 25 files changed, 0 insertions(+), 549 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 588e989..0ca7257 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -22,15 +22,6 @@ menuconfig MTD_NAND
 
 if MTD_NAND
 
-config MTD_NAND_VERIFY_WRITE
-   bool Verify NAND page writes
-   help
- This adds an extra check when data is written to the flash. The
- NAND flash device internally checks only bits transitioning
- from 1 to 0. There is a rare possibility that even though the
- device thinks the write was successful, a bit could have been
- flipped accidentally due to device wear or something else.
-
 config MTD_NAND_BCH
tristate
select BCH
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 861ca8f..2d73f23 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -103,18 +103,6 @@ static void ams_delta_read_buf(struct mtd_info *mtd, 
u_char *buf, int len)
buf[i] = ams_delta_read_byte(mtd);
 }
 
-static int ams_delta_verify_buf(struct mtd_info *mtd, const u_char *buf,
-   int len)
-{
-   int i;
-
-   for (i=0; ilen; i++)
-   if (buf[i] != ams_delta_read_byte(mtd))
-   return -EFAULT;
-
-   return 0;
-}
-
 /*
  * Command control function
  *
@@ -233,7 +221,6 @@ static int __devinit ams_delta_init(struct platform_device 
*pdev)
this-read_byte = ams_delta_read_byte;
this-write_buf = ams_delta_write_buf;
this-read_buf = ams_delta_read_buf;
-   this-verify_buf = ams_delta_verify_buf;
this-cmd_ctrl = ams_delta_hwcontrol;
if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, nand_rdy) == 0) {
this-dev_ready = ams_delta_nand_ready;
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 9f609d2..5c47b20 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -141,28 +141,6 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, 
int len)
 }
 
 /**
- * au_verify_buf -  Verify chip data against buffer
- * @mtd:   MTD device structure
- * @buf:   buffer containing the data to compare
- * @len:   number of bytes to compare
- *
- * verify function for 8bit buswidth
- */
-static int au_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-   int i;
-   struct nand_chip *this = mtd-priv;
-
-   for (i = 0; i  len; i++) {
-   if (buf[i] != readb(this-IO_ADDR_R))
-   return -EFAULT;
-   au_sync();
-   }
-
-   return 0;
-}
-
-/**
  * au_write_buf16 -  write buffer to chip
  * @mtd:   MTD device structure
  * @buf:   data buffer
@@ -205,29 +183,6 @@ static void au_read_buf16(struct mtd_info *mtd, u_char 
*buf, int len)
}
 }
 
-/**
- * au_verify_buf16 -  Verify chip data against buffer
- * @mtd:   MTD device structure
- * @buf:   buffer containing the data to compare
- * @len:   number of bytes to compare
- *
- * verify function for 16bit buswidth
- */
-static int au_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len)
-{
-   int i;
-   struct 

Re: [rfc patch] fs,reiserfs: unlock superblock before callling reiserfs_quota_on_mount()

2012-08-14 Thread Mike Galbraith
On Tue, 2012-08-14 at 10:23 -0400, Steven Rostedt wrote: 
 On Tue, 2012-08-14 at 15:06 +0200, Mike Galbraith wrote:
  Greetings,
  
  Using openSUSE's partitioner gizmo to set up a reiserfs partition with
  quotas and whatnot enabled rewarded me with a deadlock.
 
 Is this just a -rt bug? Can't this deadlock also in mainline?

It didn't with a NOPREEMPT kernel the one time I tried it, which seemed
mighty odd when I stared at the rt deadlock.  I'll give it another go, I
likely just munged q/d NOPREEMPT test.

-Mike

--
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] Powerpc 8xx CPM_UART delay in receive

2012-08-14 Thread Christophe Leroy
Hello,

I'm not sure who to address this Patch to either

It fixes a delay issue with CPM UART driver on Powerpc MPC8xx.
The problem is that with the actual code, the driver waits 32 IDLE patterns 
before returning the received data to the upper level. It means for instance 
about 1 second at 300 bauds.
This fix limits to one byte the waiting period.

Signed-off-by: Christophe Leroy christophe.le...@c-s.fr

--- linux-3.5-vanilla/drivers/tty/serial/cpm_uart/cpm_uart_core.c   
2012-07-21 22:58:29.0 +0200
+++ linux-3.5/drivers/tty/serial/cpm_uart/cpm_uart_core.c   2012-08-09 
17:38:37.0 +0200
@@ -798,7 +799,7 @@
cpm_set_scc_fcr(sup);
 
out_be16(sup-scc_genscc.scc_mrblr, pinfo-rx_fifosize);
-   out_be16(sup-scc_maxidl, pinfo-rx_fifosize);
+   out_be16(sup-scc_maxidl, 1);
out_be16(sup-scc_brkcr, 1);
out_be16(sup-scc_parec, 0);
out_be16(sup-scc_frmec, 0);
@@ -872,7 +873,7 @@
 
/* Using idle character time requires some additional tuning.  */
out_be16(up-smc_mrblr, pinfo-rx_fifosize);
-   out_be16(up-smc_maxidl, pinfo-rx_fifosize);
+   out_be16(up-smc_maxidl, 1);
out_be16(up-smc_brklen, 0);
out_be16(up-smc_brkec, 0);
out_be16(up-smc_brkcr, 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] Powerpc 8xx CPM_UART desynchronisation

2012-08-14 Thread Christophe Leroy
Hello,

I'm not sure who to address this Patch to.

It fixes a desynchronisation problem with CPM UART driver on Powerpc MPC8xx.
The problem happens if data is received before the device is open by the user 
application.

Signed-off-by: Christophe Leroy christophe.le...@c-s.fr

--- linux-3.5-vanilla/drivers/tty/serial/cpm_uart/cpm_uart_core.c   
2012-07-21 22:58:29.0 +0200
+++ linux-3.5/drivers/tty/serial/cpm_uart/cpm_uart_core.c   2012-08-09 
17:38:37.0 +0200
@@ -417,6 +417,7 @@
clrbits32(pinfo-sccp-scc_gsmrl, SCC_GSMRL_ENR);
clrbits16(pinfo-sccp-scc_sccm, UART_SCCM_RX);
}
+   cpm_uart_initbd(pinfo);
cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
}
/* Install interrupt handler. */
--
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 4/6] floppy: properly handle failure on add_disk loop

2012-08-14 Thread Herton Ronaldo Krzesinski
On Tue, Aug 14, 2012 at 04:31:23AM +0100, Ben Hutchings wrote:
 On Mon, 2012-08-13 at 15:16 -0300, Herton Ronaldo Krzesinski wrote:
  On do_floppy_init, if something failed inside the loop we call add_disk,
  there was no cleanup of previous iterations in the error handling.
  
  Cc: sta...@vger.kernel.org
  Acked-by: Vivek Goyal vgo...@redhat.com
  Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
 
 This depends on 3/6.  If that's replaced by my proposed fix, then:
 
  ---
   drivers/block/floppy.c |   10 +-
   1 file changed, 9 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
  index 9272203..3eafe93 100644
  --- a/drivers/block/floppy.c
  +++ b/drivers/block/floppy.c
  @@ -4294,7 +4294,7 @@ static int __init do_floppy_init(void)
   
  err = platform_device_register(floppy_device[drive]);
  if (err)
  -   goto out_release_dma;
  +   goto out_remove_drives;
   
  err = device_create_file(floppy_device[drive].dev,
   dev_attr_cmos);
  @@ -4313,6 +4313,14 @@ static int __init do_floppy_init(void)
   
   out_unreg_platform_dev:
  platform_device_unregister(floppy_device[drive]);
  +out_remove_drives:
  +   while (drive--) {
  +   if (disk_registered[drive]) {
 
 I think the test of allowed_drive_mask and FDC version before
 registering each driver should be factored out into a function that you
 can use here.  There would then no need for the disk_registered array.

Seems a better approach. I'll redo the patches, but I'm not sure how to
proceed now, since it depends on your change. Patches 4-6 that I did
needs to be dropped/redone. At first my patches 0001/0002 could be
applied with yours, then I would submit another series for the rest. Or
I could take your change and submit your patch along with my series.

 
 Ben.
 

-- 
[]'s
Herton
--
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: bisected regression: v3.6-rc1: resume from s2ram does not restore ata_piix (v3.5 worked)

2012-08-14 Thread Aaron Lu
On Tue, Aug 14, 2012 at 11:44:20AM +0300, Sergei Trofimovich wrote:
  The only problem I can see is the offending commit didn't do a gtm for
  IDE channel during init. It was used to be done in
  ata_acpi_associate_ide_port.
  
  So can you please test if the following code fix your problem? Thanks.
 
 Unfortunately, nothing changed. The same hangup after resume.
 Did the bisected patch change the way kernel relies on ACPI
 information? I have some complains in dmesg output about it
 (attached whole dmesg) like that:
 
 ACPI Exception: AE_AML_PACKAGE_LIMIT, Index (0x0004) is beyond 
 end of object (20120711/exoparg2-418)
 ACPI Error: Method parse/execution failed [\_SB_.C003.C09A._DOD] (Node 
 88007b82c988), AE_AML_PACKAGE_LIMIT (20120711/psparse-536)
 ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _DOD (20120711/video-1149)


 ata1: ACPI get timing mode failed (AE 0x1001)
Do you see this error message when using a working kernel?

And here is another try:

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 902b5a4..fd9ecf7 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -60,17 +60,7 @@ acpi_handle ata_ap_acpi_handle(struct ata_port *ap)
if (ap-flags  ATA_FLAG_ACPI_SATA)
return NULL;
 
-   /*
-* If acpi bind operation has already happened, we can get the handle
-* for the port by checking the corresponding scsi_host device's
-* firmware node, otherwise we will need to find out the handle from
-* its parent's acpi node.
-*/
-   if (ap-scsi_host)
-   return DEVICE_ACPI_HANDLE(ap-scsi_host-shost_gendev);
-   else
-   return acpi_get_child(DEVICE_ACPI_HANDLE(ap-host-dev),
-   ap-port_no);
+   return acpi_get_child(DEVICE_ACPI_HANDLE(ap-host-dev), ap-port_no);
 }
 EXPORT_SYMBOL(ata_ap_acpi_handle);
 
@@ -1101,6 +1091,9 @@ static int ata_acpi_bind_host(struct ata_port *ap, 
acpi_handle *handle)
if (!*handle)
return -ENODEV;
 
+   if (ata_acpi_gtm(ap, ap-__acpi_init_gtm) == 0)
+   ap-pflags |= ATA_PFLAG_INIT_GTM_VALID;
+
return 0;
 }

Thanks,
Aaron
--
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/


<    4   5   6   7   8   9   10   11   12   13   >