Re: [PATCH RFC] mm/swap: automatic tuning for swapin readahead

2012-10-22 Thread Shaohua Li
On Mon, Oct 22, 2012 at 10:16:40PM -0700, Hugh Dickins wrote:
> On Mon, 22 Oct 2012, Shaohua Li wrote:
> > On Tue, Oct 16, 2012 at 08:50:49AM +0800, Shaohua Li wrote:
> > > On Mon, Oct 08, 2012 at 03:09:58PM -0700, Hugh Dickins wrote:
> > > > On Thu, 4 Oct 2012, Konstantin Khlebnikov wrote:
> > > > 
> > > > > Here results of my test. Workload isn't very realistic, but at least 
> > > > > it
> > > > > threaded: compiling linux-3.6 with defconfig in 16 threads on tmpfs,
> > > > > 512mb ram, dualcore cpu, ordinary hard disk. (test script in 
> > > > > attachment)
> > > > > 
> > > > > average results for ten runs:
> > > > > 
> > > > >   RA=3RA=0RA=1RA=2RA=4HughShaohua
> > > > > real time 500 542 528 519 500 523 522
> > > > > user time 738 737 735 737 739 737 739
> > > > > sys time  93  93  91  92  96  92  93
> > > > > pgmajfault62918   110533  92454   78221   54342   86601   77229
> > > > > pgpgin2070372 795228  1034046 1471010 3177192 1154532 1599388
> > > > > pgpgout   2597278 2022037 2110020 2350380 2802670 2286671 2526570
> > > > > pswpin462747  138873  202148  310969  739431  232710  341320
> > > > > pswpout   646363  502599  524613  584731  697797  568784  628677
> > > > > 
> > > > > So, last two columns shows mostly equal results: +4.6% and +4.4% in
> > > > > comparison to vanilla kernel with RA=3, but your version shows more 
> > > > > stable
> > > > > results (std-error 2.7% against 4.8%) (all this numbers in huge table 
> > > > > in
> > > > > attachment)
> > > > 
> > > > Thanks for doing this, Konstantin, but I'm stuck for anything much to 
> > > > say!
> > > > Shaohua and I are both about 4.5% bad for this particular test, but I'm
> > > > more consistently bad - hurrah!
> > > > 
> > > > I suspect (not a convincing argument) that if the test were just 
> > > > slightly
> > > > different (a little more or a little less memory, SSD instead of hard
> > > > disk, diskcache instead of tmpfs), then it would come out differently.
> > > > 
> > > > Did you draw any conclusions from the numbers you found?
> > > > 
> > > > I haven't done any more on this in the last few days, except to verify
> > > > that once an anon_vma is judged random with Shaohua's, then it appears
> > > > to be condemned to no-readahead ever after.
> > > > 
> > > > That's probably something that a hack like I had in mine would fix,
> > > > but that addition might change its balance further (and increase vma
> > > > or anon_vma size) - not tried yet.
> > > > 
> > > > All I want to do right now, is suggest to Andrew that he hold Shaohua's
> > > > patch back from 3.7 for the moment: I'll send a response to Sep 7th's
> > > > mm-commits mail to suggest that - but no great disaster if he ignores 
> > > > me.
> > > 
> > > Ok, I tested Hugh's patch. My test is a multithread random write workload.
> > > With Hugh's patch, 49:28.06elapsed
> > > With mine, 43:23.39elapsed
> > > There is 12% more time used with Hugh's patch.
> > > 
> > > In the stable state of this workload, SI:SO ratio should be roughly 1:1. 
> > > With
> > > Hugh's patch, it's around 1.6:1, there is still unnecessary swapin.
> > > 
> > > I also tried a workload with seqential/random write mixed, Hugh's patch 
> > > is 10%
> > > bad too.
> > 
> > With below change, the si/so ratio is back to around 1:1 in my workload. 
> > Guess
> > the run time of my test will be reduced too, though I didn't test yet.
> > -   used = atomic_xchg(_hits, 0) + 1;
> > +   used = atomic_xchg(_hits, 0);
> 
> Thank you for playing and trying that, I haven't found time to revisit it
> at all.  I'll give that adjustment a go at my end.  The "+ 1" was for the
> target page itself; but whatever works best, there's not much science to it.

With '+1', the minimum ra pages is 2 even for a random access.
 
> > 
> > I'm wondering how could a global counter based method detect readahead
> > correctly. For example, if there are a sequential access thread and a random
> > access thread, doesn't this method always make wrong decision?
> 
> But only in the simplest cases is the sequentiality of placement on swap
> well correlated with the sequentiality of placement in virtual memory.
> Once you have a sequential access thread and a random access thread
> swapping out at the same time, their pages will be interspersed.
> 
> I'm pretty sure that if you give it more thought than I am giving it
> at the moment, you can devise a test case which would go amazingly
> faster by your per-vma method than by keeping just this global state.
> 
> But I doubt such a test case would be so realistic as to deserve that
> extra sophistication.  I do prefer to keep the heuristic as stupid and
> unpretentious as possible.

I have no strong point against the global state method. But I'd agree making the
heuristic simple is preferred currently. I'm happy about the patch if the '+1'
is removed.


Re: 3.7 RC1

2012-10-22 Thread Dan Carpenter
On Mon, Oct 22, 2012 at 04:37:45PM -0700, K. Y. Srinivasan wrote:
> 
> While testing 3.7 RC1 I discovered that invoking the function 
> orderly_poweroff()
> from an interrupt context will trigger an ASSERT(). This was not the case till
> recently. The comment preceding the orderly_poweroff() function claims that 
> this
> function can be invoked from any context and in the current Hyper-V util 
> driver,
> we support host-driven orderly shut down of the guest by invoking this
> orderly_poweroff() function in the context of the message callback. This code 
> has
> been working for a very long time and it is broken now. Is my assumption that
> orderly_poweroff() could be invoked from the interrupt context a wrong 
> assumption?

You can't call orderly_poweroff() from interrupt context.

regards,
dan carpenter
--
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] regmap for for v3.7

2012-10-22 Thread Linus Torvalds
On Mon, Oct 22, 2012 at 6:14 PM, Mark Brown
 wrote:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 
> tags/regmap-fix-mmio

I'm not finding the key you used to sign that...

   Linus
--
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/6] perf, x86: Basic Haswell LBR call stack support

2012-10-22 Thread Yan, Zheng
On 10/22/2012 06:35 PM, Peter Zijlstra wrote:
> On Mon, 2012-10-22 at 14:11 +0800, Yan, Zheng wrote:
>> --- a/include/uapi/linux/perf_event.h
>> +++ b/include/uapi/linux/perf_event.h
>> @@ -160,8 +160,9 @@ enum perf_branch_sample_type {
>> PERF_SAMPLE_BRANCH_ABORT= 1U << 7, /* transaction aborts */
>> PERF_SAMPLE_BRANCH_INTX = 1U << 8, /* in transaction (flag) 
>> */
>> PERF_SAMPLE_BRANCH_NOTX = 1U << 9, /* not in transaction 
>> (flag) */
>> +   PERF_SAMPLE_BRANCH_CALL_STACK   = 1U << 10, /* call stack */
>>  
>> -   PERF_SAMPLE_BRANCH_MAX  = 1U << 10, /* non-ABI */
>> +   PERF_SAMPLE_BRANCH_MAX  = 1U << 11, /* non-ABI */
>>  }; 
> 
> You add an ABI sample type without mentioning it in your changelog.. I
> think I'll stop reading here.
> 
Ok, I will add the ABI change to the change log. Do you think we should hide 
this
branch sample type from user?

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


Re: 3.7-rc2 regression : file copied to CIFS-mounted directory corrupted

2012-10-22 Thread Jongman Heo

Hmm,

I've just met the issue, with the commit 5640f768 reverted.
It seems that the issue does not always happen. So, my bisection may not be 
correct.

At this moment, I don't have enough time to do bisection again..

Regards.

[sorry for top posting, our corporate MTA is not good at e-mail writing for 
mailing list... ]

--- Original Message ---
Sender : Jongman Heo
Date : 2012-10-23 12:30 (GMT+09:00)
Title : 3.7-rc2 regression : file copied to CIFS-mounted directory corrupted


Hi, all,

With 3.7-rc2, I noticed that file copied to CIFS-mounted directory is 
corrupted. 
Integrity is checked by md5sum.

  1. get md5sum of file located on local (ext4) disk
  2. copy the file to CIFS-mounted directory
  3. check md5sum of the copied file

Host   : Windows 7
Guest : Fedora 16 on VMWare
Kernel : 3.7-rc2

Shared directory exists on Windows 7 Host, and Linux Guest on VMware mounts it 
using CIFS.

I thought it was related to CIFS or VFS changes, but it wasn't.

Below is a git bisect log, and first bad commit is 5640f768, "net: use a per 
task frag allocator".

Reverting the commit 5640f768 fixes the corruption issue on CIFS directory.
During revert, I got conflict in net/ipv4/raw.c. I took "parent of 5640f76" 
hunk to resolve it.

# git bisect log
git bisect start
# bad: [6f0c0580b70c89094b3422ba81118c7b959c7556] Linux 3.7-rc2
git bisect bad 6f0c0580b70c89094b3422ba81118c7b959c7556
# good: [a0d271cbfed1dd50278c6b06bead3d00ba0a88f9] Linux 3.6
git bisect good a0d271cbfed1dd50278c6b06bead3d00ba0a88f9
# good: [fec344e3f31aa911297cd3a4639432d983b1f324] cifs: change cifs_call_async 
to use smb_rqst structs
git bisect good fec344e3f31aa911297cd3a4639432d983b1f324
# good: [3d6d854a13844223b603fd7a16a4a4a4afd62c72] cifs: add FL_CLOSE to 
fl_flags mask in cifs_read_flock
git bisect good 3d6d854a13844223b603fd7a16a4a4a4afd62c72
# good: [f065fd099fc475333fc7a55677a7f64764445d55] CIFS: Fix possible freed 
pointer dereference in CIFS_SessSetup
git bisect good f065fd099fc475333fc7a55677a7f64764445d55
# bad: [b7a10626c8bc88fd097a8bb4486c89558f89320c] [CIFS] WARN_ON_ONCE if 
kernel_sendmsg() returns -ENOSPC
git bisect bad b7a10626c8bc88fd097a8bb4486c89558f89320c
# good: [1d4ab9077681b7cce60ff46e3a42fe2dafa0b83d] [CIFS] Fix indentation of 
fs/cifs/Kconfig entries
git bisect good 1d4ab9077681b7cce60ff46e3a42fe2dafa0b83d
# bad: [aab174f0df5d72d31caccf281af5f614fa254578] Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect bad aab174f0df5d72d31caccf281af5f614fa254578
# good: [d9a807461fc8cc0d6ba589ea0730d139122af012] Merge tag 'usb-3.6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect good d9a807461fc8cc0d6ba589ea0730d139122af012
# good: [a20acf99f75e49271381d65db097c9763060a1e8] Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
git bisect good a20acf99f75e49271381d65db097c9763060a1e8
# bad: [d379142bc4d9b78cdd9fc5aa696ca1ea083fb7d4] be2net: fixup log messages
git bisect bad d379142bc4d9b78cdd9fc5aa696ca1ea083fb7d4
# good: [2a35cfa591ac63f17815c2d9432b799e37527980] r8169: add D-Link DGE-560T 
identifiers.
git bisect good 2a35cfa591ac63f17815c2d9432b799e37527980
# good: [9316f0e3c6ba524d8fa14bfded048b252891931a] Merge branch 'master' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into 
for-davem
git bisect good 9316f0e3c6ba524d8fa14bfded048b252891931a
# good: [623df484a777f3c00c1ea3d6a7565b8d8ac688a1] tcp: extract code to compute 
SYNACK RTT
git bisect good 623df484a777f3c00c1ea3d6a7565b8d8ac688a1
# bad: [c523530ce17defe6b28ccfe622c506488f430866] can: c_can: fix segfault 
during rmmod
git bisect bad c523530ce17defe6b28ccfe622c506488f430866
# good: [6ee584be3ee30f72dec8a8ca87bc10824e27a631] netfilter: nfnetlink_queue: 
add NFQA_CAP_LEN attribute
git bisect good 6ee584be3ee30f72dec8a8ca87bc10824e27a631
# good: [725b9c0425f54450d1f376befb85dae706ea0c7a] qeth: cleanup channel path 
descriptor function
git bisect good 725b9c0425f54450d1f376befb85dae706ea0c7a
# good: [0cf833aefaa85bbfce3ff70485e5534e09254773] net: loopback: set default 
mtu to 64K
git bisect good 0cf833aefaa85bbfce3ff70485e5534e09254773
# bad: [9e49e88958feb41ec701fa34b44723dabadbc28c] filter: add XOR instruction 
for use with X/K
git bisect bad 9e49e88958feb41ec701fa34b44723dabadbc28c
# bad: [5640f7685831e088fe6c2e1f863a6805962f8e81] net: use a per task frag 
allocator
git bisect bad 5640f7685831e088fe6c2e1f863a6805962f8e81
# good: [b98b8babd6e3370fadb7c6eaacb00eb2f6344a6c] gianfar: Change default HW 
Tx queue scheduling mode
git bisect good b98b8babd6e3370fadb7c6eaacb00eb2f6344a6c

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH] Input: introduce managed input devices (add devres support)

2012-10-22 Thread Dmitry Torokhov
There is a demand from driver's writers to use managed devices framework
for their drivers. Unfortunately up to this moment input devices did not
provide support for managed devices and that lead to mixing two styles
of resource management which usually introduced more bugs, such as
manually unregistering input device but relying in devres to free
interrupt handler which (unless device is properly shut off) can cause
ISR to reference already freed memory.

This change introduces devm_input_allocate_device() that will allocate
managed instance of input device so that driver writers who prefer
using devm_* framework do not have to mix 2 styles.

Signed-off-by: Dmitry Torokhov 
---
 drivers/input/input.c | 175 ++
 include/linux/input.h |   7 +-
 2 files changed, 154 insertions(+), 28 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 53a0dde..7fe74f8 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1723,7 +1723,7 @@ EXPORT_SYMBOL_GPL(input_class);
 /**
  * input_allocate_device - allocate memory for new input device
  *
- * Returns prepared struct input_dev or NULL.
+ * Returns prepared struct input_dev or %NULL.
  *
  * NOTE: Use input_free_device() to free devices that have not been
  * registered; input_unregister_device() should be used for already
@@ -1750,6 +1750,70 @@ struct input_dev *input_allocate_device(void)
 }
 EXPORT_SYMBOL(input_allocate_device);
 
+struct input_devres {
+   struct input_dev *input;
+};
+
+static int devm_input_device_match(struct device *dev, void *res, void *data)
+{
+   struct input_devres *devres = res;
+
+   return devres->input == data;
+}
+
+static void devm_input_device_release(struct device *dev, void *res)
+{
+   struct input_devres *devres = res;
+   struct input_dev *input = devres->input;
+
+   dev_dbg(dev, "%s: dropping reference to %s\n",
+   __func__, dev_name(>dev));
+   input_put_device(input);
+}
+
+/**
+ * devm_input_allocate_device - allocate managed input device
+ * @dev: device owning the input device being created
+ *
+ * Returns prepared struct input_dev or %NULL.
+ *
+ * Managed input devices do not need to be explicitly unregistered or
+ * freed as it will be done automatically when owner device unbinds from
+ * its driver (or binding fails). Once managed input device is allocated,
+ * it is ready to be set up and registered in the same fashion as regular
+ * input device. There are no special devm_input_device_[un]register()
+ * variants, regular ones work with both managed and unmanaged devices.
+ *
+ * NOTE: the owner device is set up as parent of input device and users
+ * should not override it.
+ */
+
+struct input_dev *devm_input_allocate_device(struct device *dev)
+{
+   struct input_dev *input;
+   struct input_devres *devres;
+
+   devres = devres_alloc(devm_input_device_release,
+ sizeof(struct input_devres), GFP_KERNEL);
+   if (!devres)
+   return NULL;
+
+   input = input_allocate_device();
+   if (!input) {
+   devres_free(devres);
+   return NULL;
+   }
+
+   input->dev.parent = dev;
+   input->devres_managed = true;
+
+   devres->input = input;
+   devres_add(dev, devres);
+
+   return input;
+}
+EXPORT_SYMBOL(devm_input_allocate_device);
+
 /**
  * input_free_device - free memory occupied by input_dev structure
  * @dev: input device to free
@@ -1766,8 +1830,14 @@ EXPORT_SYMBOL(input_allocate_device);
  */
 void input_free_device(struct input_dev *dev)
 {
-   if (dev)
+   if (dev) {
+   if (dev->devres_managed)
+   WARN_ON(devres_destroy(dev->dev.parent,
+   devm_input_device_release,
+   devm_input_device_match,
+   dev));
input_put_device(dev);
+   }
 }
 EXPORT_SYMBOL(input_free_device);
 
@@ -1888,6 +1958,38 @@ static void input_cleanse_bitmasks(struct input_dev *dev)
INPUT_CLEANSE_BITMASK(dev, SW, sw);
 }
 
+static void __input_unregister_device(struct input_dev *dev)
+{
+   struct input_handle *handle, *next;
+
+   input_disconnect_device(dev);
+
+   mutex_lock(_mutex);
+
+   list_for_each_entry_safe(handle, next, >h_list, d_node)
+   handle->handler->disconnect(handle);
+   WARN_ON(!list_empty(>h_list));
+
+   del_timer_sync(>timer);
+   list_del_init(>node);
+
+   input_wakeup_procfs_readers();
+
+   mutex_unlock(_mutex);
+
+   device_del(>dev);
+}
+
+static void devm_input_device_unregister(struct device *dev, void *res)
+{
+   struct input_devres *devres = res;
+   struct input_dev *input = devres->input;
+
+   dev_dbg(dev, "%s: unregistering device %s\n",
+   __func__, dev_name(>dev));
+   

Re: [E1000-devel] [PATCH] RX initialization sequence fixed - enable RX after corresponding ring initialization only

2012-10-22 Thread Jeff Kirsher
On Fri, 2012-10-19 at 20:19 +0100, Richard Davies wrote:
> Jeff Kirsher wrote:
> > Dmitry Fleytman wrote:
> > > Reported-by: Chris Webb 
> > > Reported-by: Richard Davies 
> > >
> > > Signed-off-by: Dmitry Fleytman 
> > > ---
> > >  drivers/net/ethernet/intel/e1000/e1000_ethtool.c |9 +
> > >  drivers/net/ethernet/intel/e1000/e1000_main.c|   18
> > > --
> > >  2 files changed, 21 insertions(+), 6 deletions(-) 
> >
> > I will add it to my queue.  Thanks!
> 
> Hi Jeff,
> 
> I hope it was already clear from the following discussion - this patch
> turned out to be a qemu-kvm bug and you do not need to apply it.
> 
> Dmitry - please confirm.
> 
> Richard.

I have dropped the patch from my queue, thanks guys!


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


[PATCH] backlight: s6e63m0: remove unnecessary cast of void pointer

2012-10-22 Thread Jingoo Han
Removes unnecessary case of void pointer for platform data
in probe function.

Signed-off-by: Jingoo Han 
Cc: Richard Purdie 
---
 drivers/video/backlight/s6e63m0.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/backlight/s6e63m0.c 
b/drivers/video/backlight/s6e63m0.c
index 6437ae4..1f435e2 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -757,7 +757,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
lcd->spi = spi;
lcd->dev = >dev;
 
-   lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data;
+   lcd->lcd_pd = spi->dev.platform_data;
if (!lcd->lcd_pd) {
dev_err(>dev, "platform data is NULL.\n");
return -EFAULT;
-- 
1.7.1


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


Re: [PATCH 1/6] perf, x86: Basic Haswell LBR call stack support

2012-10-22 Thread Yan, Zheng
On 10/22/2012 07:23 PM, Stephane Eranian wrote:
> On Mon, Oct 22, 2012 at 12:33 PM, Peter Zijlstra  
> wrote:
>>
>> On Mon, 2012-10-22 at 14:11 +0800, Yan, Zheng wrote:
>>> +   /* LBR callstack does not work well with FREEZE_LBRS_ON_PMI */
>>> +   if (!cpuc->lbr_sel || !(cpuc->lbr_sel->config & LBR_CALL_STACK))
>>> +   debugctl |= DEBUGCTLMSR_FREEZE_LBRS_ON_PMI;
>>
> Is this a bug or a feature?
> 
It's a hardware bug. If FREEZE_LBRS_ON_PMI is set, PMI may corrupt the call 
stack records.

Regards
Yan, Zheng

>>
>> How useful it is without this? How many calls between PMI and us getting
>> to intel_pmu_lbr_read()?
> 
> Agreed with Peter. Freeze on PMI is critical for LBR in general.
> 

--
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/6] perf, x86: Basic Haswell LBR call stack support

2012-10-22 Thread Yan, Zheng
On 10/22/2012 06:33 PM, Peter Zijlstra wrote:
> On Mon, 2012-10-22 at 14:11 +0800, Yan, Zheng wrote:
>> +   /* LBR callstack does not work well with FREEZE_LBRS_ON_PMI */
>> +   if (!cpuc->lbr_sel || !(cpuc->lbr_sel->config & LBR_CALL_STACK))
>> +   debugctl |= DEBUGCTLMSR_FREEZE_LBRS_ON_PMI; 
> 
> How useful it is without this? How many calls between PMI and us getting
> to intel_pmu_lbr_read()?
> 

So far we use the call stack feature only for ring 3. but even for ring 0,
it's OK. because LBR is disabled at the very beginning of PMI hander, and
enabled when exiting the PMI hander. the depth to _intel_pmu_lbr_enable/
_intel_pmu_lbr_disable are the same. So entries that are added by calling
_intel_pmu_lbr_disable will be popped during enabling LBR.

Regards
Yan, Zheng
--
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] pc8736x_gpio: use platform_device_unregister in pc8736x_gpio_cleanup()

2012-10-22 Thread Wei Yongjun
From: Wei Yongjun 

platform_device_unregister() only calls platform_device_del() and
platform_device_put(), thus use platform_device_unregister() to
simplify the code.

Also the documents in platform.c shows that platform_device_del
and platform_device_put must _only_ be externally called in error
cases.  All other usage is a bug.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun 
---
 drivers/char/pc8736x_gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index b304ec0..3f79a9f 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -345,8 +345,7 @@ static void __exit pc8736x_gpio_cleanup(void)
unregister_chrdev_region(MKDEV(major,0), PC8736X_GPIO_CT);
release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
 
-   platform_device_del(pdev);
-   platform_device_put(pdev);
+   platform_device_unregister(pdev);
 }
 
 module_init(pc8736x_gpio_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/


Re: [PATCH RFC] mm/swap: automatic tuning for swapin readahead

2012-10-22 Thread Hugh Dickins
On Mon, 22 Oct 2012, Shaohua Li wrote:
> On Tue, Oct 16, 2012 at 08:50:49AM +0800, Shaohua Li wrote:
> > On Mon, Oct 08, 2012 at 03:09:58PM -0700, Hugh Dickins wrote:
> > > On Thu, 4 Oct 2012, Konstantin Khlebnikov wrote:
> > > 
> > > > Here results of my test. Workload isn't very realistic, but at least it
> > > > threaded: compiling linux-3.6 with defconfig in 16 threads on tmpfs,
> > > > 512mb ram, dualcore cpu, ordinary hard disk. (test script in attachment)
> > > > 
> > > > average results for ten runs:
> > > > 
> > > > RA=3RA=0RA=1RA=2RA=4HughShaohua
> > > > real time   500 542 528 519 500 523 522
> > > > user time   738 737 735 737 739 737 739
> > > > sys time93  93  91  92  96  92  93
> > > > pgmajfault  62918   110533  92454   78221   54342   86601   77229
> > > > pgpgin  2070372 795228  1034046 1471010 3177192 1154532 1599388
> > > > pgpgout 2597278 2022037 2110020 2350380 2802670 2286671 2526570
> > > > pswpin  462747  138873  202148  310969  739431  232710  341320
> > > > pswpout 646363  502599  524613  584731  697797  568784  628677
> > > > 
> > > > So, last two columns shows mostly equal results: +4.6% and +4.4% in
> > > > comparison to vanilla kernel with RA=3, but your version shows more 
> > > > stable
> > > > results (std-error 2.7% against 4.8%) (all this numbers in huge table in
> > > > attachment)
> > > 
> > > Thanks for doing this, Konstantin, but I'm stuck for anything much to say!
> > > Shaohua and I are both about 4.5% bad for this particular test, but I'm
> > > more consistently bad - hurrah!
> > > 
> > > I suspect (not a convincing argument) that if the test were just slightly
> > > different (a little more or a little less memory, SSD instead of hard
> > > disk, diskcache instead of tmpfs), then it would come out differently.
> > > 
> > > Did you draw any conclusions from the numbers you found?
> > > 
> > > I haven't done any more on this in the last few days, except to verify
> > > that once an anon_vma is judged random with Shaohua's, then it appears
> > > to be condemned to no-readahead ever after.
> > > 
> > > That's probably something that a hack like I had in mine would fix,
> > > but that addition might change its balance further (and increase vma
> > > or anon_vma size) - not tried yet.
> > > 
> > > All I want to do right now, is suggest to Andrew that he hold Shaohua's
> > > patch back from 3.7 for the moment: I'll send a response to Sep 7th's
> > > mm-commits mail to suggest that - but no great disaster if he ignores me.
> > 
> > Ok, I tested Hugh's patch. My test is a multithread random write workload.
> > With Hugh's patch, 49:28.06elapsed
> > With mine, 43:23.39elapsed
> > There is 12% more time used with Hugh's patch.
> > 
> > In the stable state of this workload, SI:SO ratio should be roughly 1:1. 
> > With
> > Hugh's patch, it's around 1.6:1, there is still unnecessary swapin.
> > 
> > I also tried a workload with seqential/random write mixed, Hugh's patch is 
> > 10%
> > bad too.
> 
> With below change, the si/so ratio is back to around 1:1 in my workload. Guess
> the run time of my test will be reduced too, though I didn't test yet.
> - used = atomic_xchg(_hits, 0) + 1;
> + used = atomic_xchg(_hits, 0);

Thank you for playing and trying that, I haven't found time to revisit it
at all.  I'll give that adjustment a go at my end.  The "+ 1" was for the
target page itself; but whatever works best, there's not much science to it.

> 
> I'm wondering how could a global counter based method detect readahead
> correctly. For example, if there are a sequential access thread and a random
> access thread, doesn't this method always make wrong decision?

But only in the simplest cases is the sequentiality of placement on swap
well correlated with the sequentiality of placement in virtual memory.
Once you have a sequential access thread and a random access thread
swapping out at the same time, their pages will be interspersed.

I'm pretty sure that if you give it more thought than I am giving it
at the moment, you can devise a test case which would go amazingly
faster by your per-vma method than by keeping just this global state.

But I doubt such a test case would be so realistic as to deserve that
extra sophistication.  I do prefer to keep the heuristic as stupid and
unpretentious as possible.

Especially when I remember how get_swap_page() stripes across swap
areas of equal priority: my guess is that nobody uses that feature,
and we don't even want to consider it here; but it feels wrong to
ignore it if we aim for more cleverness at the readahead end.

Hugh
--
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] rtc: avoid calling platform_device_put() twice in test_init()

2012-10-22 Thread Wei Yongjun
From: Wei Yongjun 

In case of error, the function test_init() need to call
platform_device_del() instead of platform_device_unregister().
Otherwise, we may call platform_device_put() twice.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun 
---
 drivers/rtc/rtc-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 7e96254..209a127 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -164,7 +164,7 @@ static int __init test_init(void)
return 0;
 
 exit_device_unregister:
-   platform_device_unregister(test0);
+   platform_device_del(test0);
 
 exit_free_test1:
platform_device_put(test1);


--
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/5] xen-fbfront: handle backend CLOSED without CLOSING

2012-10-22 Thread Florian Tobias Schandinat
Hi Konrad,

On 10/19/2012 01:00 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Oct 18, 2012 at 11:03:37AM +0100, David Vrabel wrote:
>> From: David Vrabel 
>>
>> Backend drivers shouldn't transistion to CLOSED unless the frontend is
>> CLOSED.  If a backend does transition to CLOSED too soon then the
>> frontend may not see the CLOSING state and will not properly shutdown.
>>
>> So, treat an unexpected backend CLOSED state the same as CLOSING.
>>
>> Signed-off-by: David Vrabel 
>> Acked-by: Konrad Rzeszutek Wilk 
>> ---
>> Cc: linux-fb...@vger.kernel.org
>> Cc: Florian Tobias Schandinat 
> 
> Hey Florian,
> 
> Should I prep a git pull for you with this or would it be OK
> if I just have your Ack to put this in my git pull for Linus?

Feel free to take it and add
Acked-by: Florian Tobias Schandinat 


Best regards,

Florian Tobias Schandinat

> 
> Thanks!
>> ---
>>  drivers/video/xen-fbfront.c |5 -
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
>> index b7f5173..917bb56 100644
>> --- a/drivers/video/xen-fbfront.c
>> +++ b/drivers/video/xen-fbfront.c
>> @@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device 
>> *dev,
>>  case XenbusStateReconfiguring:
>>  case XenbusStateReconfigured:
>>  case XenbusStateUnknown:
>> -case XenbusStateClosed:
>>  break;
>>  
>>  case XenbusStateInitWait:
>> @@ -670,6 +669,10 @@ InitWait:
>>  info->feature_resize = val;
>>  break;
>>  
>> +case XenbusStateClosed:
>> +if (dev->state == XenbusStateClosed)
>> +break;
>> +/* Missed the backend's CLOSING state -- fallthrough */
>>  case XenbusStateClosing:
>>  xenbus_frontend_closed(dev);
>>  break;
>> -- 
>> 1.7.2.5
> 

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


Re: usbview 2.0 release

2012-10-22 Thread Anil Nair
Hello Greg,

> No, debugfs needs to be mounted at /sys/kernel/debug/  Is it not mounted
> that way for you?  Perhaps it is mounted with root-only access (default
> for 3.7-rc1 and newer kernels)?

Yes you are right i verified "/sys/kernel/debug" has root-only access.
The kernel version i am using is 3.0.0-26-generic(Default kernel
provided by ubuntu 11.10 amd64).

> I should just port the thing to use libusb instead of debugfs, but
> that's a larger job for such a low-priority tool.

If you don't mind i would like to give it a try, though most of the
terminologies i don't know but i would like to give it a try, just
guide me on way of doing it thats all.

-- 
Regards,
Anil Nair
--
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: process hangs on do_exit when oom happens

2012-10-22 Thread Balbir Singh
On Tue, Oct 23, 2012 at 9:05 AM, Qiang Gao  wrote:
> information about the system is in the attach file "information.txt"
>
> I can not reproduce it in the upstream 3.6.0 kernel..
>
> On Sat, Oct 20, 2012 at 12:04 AM, Michal Hocko  wrote:
>> On Wed 17-10-12 18:23:34, gaoqiang wrote:
>>> I looked up nothing useful with google,so I'm here for help..
>>>
>>> when this happens:  I use memcg to limit the memory use of a
>>> process,and when the memcg cgroup was out of memory,
>>> the process was oom-killed   however,it cannot really complete the
>>> exiting. here is the some information
>>
>> How many tasks are in the group and what kind of memory do they use?
>> Is it possible that you were hit by the same issue as described in
>> 79dfdacc memcg: make oom_lock 0 and 1 based rather than counter.
>>
>>> OS version:  centos6.22.6.32.220.7.1
>>
>> Your kernel is quite old and you should be probably asking your
>> distribution to help you out. There were many fixes since 2.6.32.
>> Are you able to reproduce the same issue with the current vanila kernel?
>>
>>> /proc/pid/stack
>>> ---
>>>
>>> [] __cond_resched+0x2a/0x40
>>> [] unmap_vmas+0xb49/0xb70
>>> [] exit_mmap+0x7e/0x140
>>> [] mmput+0x58/0x110
>>> [] exit_mm+0x11d/0x160
>>> [] do_exit+0x1ad/0x860
>>> [] do_group_exit+0x41/0xb0
>>> [] get_signal_to_deliver+0x1e8/0x430
>>> [] do_notify_resume+0xf4/0x8b0
>>> [] int_signal+0x12/0x17
>>> [] 0x
>>
>> This looks strange because this is just an exit part which shouldn't
>> deadlock or anything. Is this stack stable? Have you tried to take check
>> it more times?

Looking at information.txt, I found something interesting

rt_rq[0]:/1314
  .rt_nr_running : 1
  .rt_throttled  : 1
  .rt_time   : 0.856656
  .rt_runtime: 0.00


cfs_rq[0]:/1314
  .exec_clock: 8738.133429
  .MIN_vruntime  : 0.01
  .min_vruntime  : 8739.371271
  .max_vruntime  : 0.01
  .spread: 0.00
  .spread0   : -9792.24
  .nr_spread_over: 1
  .nr_running: 0
  .load  : 0
  .load_avg  : 7376.722880
  .load_period   : 7.203830
  .load_contrib  : 1023
  .load_tg   : 1023
  .se->exec_start: 282004.715064
  .se->vruntime  : 18435.664560
  .se->sum_exec_runtime  : 8738.133429
  .se->wait_start: 0.00
  .se->sleep_start   : 0.00
  .se->block_start   : 0.00
  .se->sleep_max : 0.00
  .se->block_max : 0.00
  .se->exec_max  : 77.977054
  .se->slice_max : 0.00
  .se->wait_max  : 2.664779
  .se->wait_sum  : 29.970575
  .se->wait_count: 102
  .se->load.weight   : 2

So 1314 is a real time process and

cpu.rt_period_us:
100
--
cpu.rt_runtime_us:
0

When did tt move to being a Real Time process (hint: see nr_running
and nr_throttled)?

Balbir
--
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-10-22-17-08 uploaded (memory_hotplug.c)

2012-10-22 Thread Randy Dunlap
On 10/22/2012 05:09 PM, a...@linux-foundation.org wrote:

> The mm-of-the-moment snapshot 2012-10-22-17-08 has been uploaded to
> 
>http://www.ozlabs.org/~akpm/mmotm/
> 
> mmotm-readme.txt says
> 
> README for mm-of-the-moment:
> 
> http://www.ozlabs.org/~akpm/mmotm/
> 
> This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
> more than once a week.
> 



on x86_64, when CONFIG_MEMORY_HOTREMOVE is not enabled:

mm/built-in.o: In function `online_pages':
(.ref.text+0x10e7): undefined reference to `zone_pcp_reset'


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


Re: linux-next: build failure after merge of the final tree (usb tree related)

2012-10-22 Thread Greg KH
On Tue, Oct 23, 2012 at 03:13:54PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> In file included from drivers/usb/host/ohci-hcd.c:1165:0:
> drivers/usb/host/ohci-sm501.c: In function 'ohci_sm501_resume':
> drivers/usb/host/ohci-sm501.c:241:2: error: implicit declaration of function 
> 'ohci_finish_controller_resume' [-Werror=implicit-function-declaration]
> 
> Caused by commit cfa49b4b88fe ("USB: ohci: merge
> ohci_finish_controller_resume with ohci_resume").

Ick.  Florian, can you send me a fix-up patch for this?

thanks,

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


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

2012-10-22 Thread Joe Perches
On Tue, 2012-10-23 at 14:42 +1100, Stephen Rothwell wrote:
> Hi Andrew,
> 
> After merging the akpm tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
> 
> kernel/printk/printk_syslog.c: In function 'printk_syslog_print':
> kernel/printk/printk_syslog.c:108:3: error: implicit declaration of function 
> 'copy_to_user' [-Werror=implicit-function-declaration]
> kernel/printk/printk_syslog.c: In function 'do_syslog':
> kernel/printk/printk_syslog.c:245:3: error: implicit declaration of function 
> 'access_ok' [-Werror=implicit-function-declaration]
> kernel/printk/printk_syslog.c:245:18: error: 'VERIFY_WRITE' undeclared (first 
> use in this function)
> kernel/printk/printk_syslog.c:245:18: note: each undeclared identifier is 
> reported only once for each function it appears in
> 
> Caused by commit 598815e5f25f ("printk: add printk_syslog.c and .h").
> 
> Presumably missing an (or some) include files - see Rule 1 in
> Documentation/SubmitChecklist.

Yup, missing at least  which x86 gets
via an arch specific include.

I compiled it only x86.

I'll resubmit that one.

--
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/4] backlight: vgg2432a4: add missing const

2012-10-22 Thread Jingoo Han
Add 'const' to static array that was missing it in its
definition. Also, 'const' is added to ili9320_write_regs(),
because it is called by vgg2432a4 driver.

Signed-off-by: Jingoo Han 
Cc: Ben Dooks 
Cc: Richard Purdie 
---
 drivers/video/backlight/ili9320.c   |2 +-
 drivers/video/backlight/ili9320.h   |2 +-
 drivers/video/backlight/vgg2432a4.c |8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/backlight/ili9320.c 
b/drivers/video/backlight/ili9320.c
index 9327cd1..8ec9484 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -60,7 +60,7 @@ int ili9320_write(struct ili9320 *ili, unsigned int reg, 
unsigned int value)
 EXPORT_SYMBOL_GPL(ili9320_write);
 
 int ili9320_write_regs(struct ili9320 *ili,
-  struct ili9320_reg *values,
+  const struct ili9320_reg *values,
   int nr_values)
 {
int index;
diff --git a/drivers/video/backlight/ili9320.h 
b/drivers/video/backlight/ili9320.h
index e388eca..e0db738 100644
--- a/drivers/video/backlight/ili9320.h
+++ b/drivers/video/backlight/ili9320.h
@@ -63,7 +63,7 @@ extern int ili9320_write(struct ili9320 *ili,
 unsigned int reg, unsigned int value);
 
 extern int ili9320_write_regs(struct ili9320 *ili,
- struct ili9320_reg *values,
+ const struct ili9320_reg *values,
  int nr_values);
 
 /* Device probe */
diff --git a/drivers/video/backlight/vgg2432a4.c 
b/drivers/video/backlight/vgg2432a4.c
index b617fae..38c4bb1 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -26,7 +26,7 @@
 
 /* Device initialisation sequences */
 
-static struct ili9320_reg vgg_init1[] = {
+static const struct ili9320_reg vgg_init1[] = {
{
.address = ILI9320_POWER1,
.value   = ILI9320_POWER1_AP(0) | ILI9320_POWER1_BT(0),
@@ -43,7 +43,7 @@ static struct ili9320_reg vgg_init1[] = {
},
 };
 
-static struct ili9320_reg vgg_init2[] = {
+static const struct ili9320_reg vgg_init2[] = {
{
.address = ILI9320_POWER1,
.value   = (ILI9320_POWER1_AP(3) | ILI9320_POWER1_APE |
@@ -54,7 +54,7 @@ static struct ili9320_reg vgg_init2[] = {
}
 };
 
-static struct ili9320_reg vgg_gamma[] = {
+static const struct ili9320_reg vgg_gamma[] = {
{
.address = ILI9320_GAMMA1,
.value   = 0x,
@@ -89,7 +89,7 @@ static struct ili9320_reg vgg_gamma[] = {
 
 };
 
-static struct ili9320_reg vgg_init0[] = {
+static const struct ili9320_reg vgg_init0[] = {
[0] = {
/* set direction and scan mode gate */
.address = ILI9320_DRIVER,
-- 
1.7.1


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


Re: Major performance regressions in 3.7rc1/2

2012-10-22 Thread Hugh Dickins
On Mon, 22 Oct 2012, Andrew Morton wrote:
> On Mon, 22 Oct 2012 21:45:02 +0200
> Julian Wollrath  wrote:
> 
> > Hello,
> > 
> > seems like I found the other bad commit. Everything, which means
> > v3.7-rc*, works fine again with commit e6c509f85 (mm: use
> > clear_page_mlock() in page_remove_rmap()) and commit 957f822a0 (mm,
> > numa: reclaim from all nodes within reclaim distance) revoked.
> 
> Thanks.  Let's add some cc's.  Can you please describe your workload
> and some estimate of the slowdown?

I'm currently assuming that my clear_page_mlock() commit is innocent
of this: it went in just two before David's numa reclaim commit, and
I don't see how mine could have any such marked effect: I'm thinking
it was just a bisection hiccup that implicated it.

Julian (or Patrik), what do you find if you revert the numa reclaim
commit but leave in the clear_page_mlock commit?  Or vice versa.

Whereas David's numa reclaim distance commit does look suspicious to
me: as I read it (perhaps wrongly), zone_reclaim_mode would previously
have stayed 0 if all nodes were close or equidistant (e.g. CONFIG_NUMA=y
on a non-NUMA machine), but now it would be 1 in this case, invoking
zone_reclaim() more frequently than before.

Hugh

> 
> Patrik has also seen this and his description is
> 
> : I'm using an Asus Zenbook UX31E and have been installing all RCs in
> : hope of improving the Wireless and Touchpad functionality.
> : However, when trying 3.7 (rc1 and now rc2) I have major performance issues.
> : 
> : Easiest way to reproduce is to launch and play a game like Nexuiz,
> : where the computer will lag, stutter and freeze until the machine is
> : unresponsive within a couple of minutes.
> : But an easy workload like browsing will also cause lags when switching
> : tabs or redrawing a web page after a tab switch.
> : Basically 3.7 is unusable for this machine.
--
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/4] backlight: tdo24m: add missing const

2012-10-22 Thread Jingoo Han
Add 'const' to static array that was missing it in its
definition.

Signed-off-by: Jingoo Han 
Cc: Eric Miao 
Cc: Richard Purdie 
---
 drivers/video/backlight/tdo24m.c |   27 ++-
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 02444d0..2278a28 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -47,7 +47,7 @@ struct tdo24m {
((x1) << 9) | 0x100 | (x2))
 #define CMD_NULL   (-1)
 
-static uint32_t lcd_panel_reset[] = {
+static const uint32_t lcd_panel_reset[] = {
CMD0(0x1), /* reset */
CMD0(0x0), /* nop */
CMD0(0x0), /* nop */
@@ -55,7 +55,7 @@ static uint32_t lcd_panel_reset[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_panel_on[] = {
+static const uint32_t lcd_panel_on[] = {
CMD0(0x29), /* Display ON */
CMD2(0xB8, 0xFF, 0xF9), /* Output Control */
CMD0(0x11), /* Sleep out */
@@ -63,7 +63,7 @@ static uint32_t lcd_panel_on[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_panel_off[] = {
+static const uint32_t lcd_panel_off[] = {
CMD0(0x28), /* Display OFF */
CMD2(0xB8, 0x80, 0x02), /* Output Control */
CMD0(0x10), /* Sleep in */
@@ -71,7 +71,7 @@ static uint32_t lcd_panel_off[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_vga_pass_through_tdo24m[] = {
+static const uint32_t lcd_vga_pass_through_tdo24m[] = {
CMD1(0xB0, 0x16),
CMD1(0xBC, 0x80),
CMD1(0xE1, 0x00),
@@ -80,7 +80,7 @@ static uint32_t lcd_vga_pass_through_tdo24m[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_qvga_pass_through_tdo24m[] = {
+static const uint32_t lcd_qvga_pass_through_tdo24m[] = {
CMD1(0xB0, 0x16),
CMD1(0xBC, 0x81),
CMD1(0xE1, 0x00),
@@ -89,7 +89,7 @@ static uint32_t lcd_qvga_pass_through_tdo24m[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_vga_transfer_tdo24m[] = {
+static const uint32_t lcd_vga_transfer_tdo24m[] = {
CMD1(0xcf, 0x02),   /* Blanking period control (1) */
CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */
CMD1(0xd1, 0x01),   /* CKV timing control on/off */
@@ -102,7 +102,7 @@ static uint32_t lcd_vga_transfer_tdo24m[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_qvga_transfer[] = {
+static const uint32_t lcd_qvga_transfer[] = {
CMD1(0xd6, 0x02),   /* Blanking period control (1) */
CMD2(0xd7, 0x08, 0x04), /* Blanking period control (2) */
CMD1(0xd8, 0x01),   /* CKV timing control on/off */
@@ -115,7 +115,7 @@ static uint32_t lcd_qvga_transfer[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_vga_pass_through_tdo35s[] = {
+static const uint32_t lcd_vga_pass_through_tdo35s[] = {
CMD1(0xB0, 0x16),
CMD1(0xBC, 0x80),
CMD1(0xE1, 0x00),
@@ -123,7 +123,7 @@ static uint32_t lcd_vga_pass_through_tdo35s[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_qvga_pass_through_tdo35s[] = {
+static const uint32_t lcd_qvga_pass_through_tdo35s[] = {
CMD1(0xB0, 0x16),
CMD1(0xBC, 0x81),
CMD1(0xE1, 0x00),
@@ -131,7 +131,7 @@ static uint32_t lcd_qvga_pass_through_tdo35s[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_vga_transfer_tdo35s[] = {
+static const uint32_t lcd_vga_transfer_tdo35s[] = {
CMD1(0xcf, 0x02),   /* Blanking period control (1) */
CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */
CMD1(0xd1, 0x01),   /* CKV timing control on/off */
@@ -144,7 +144,7 @@ static uint32_t lcd_vga_transfer_tdo35s[] = {
CMD_NULL,
 };
 
-static uint32_t lcd_panel_config[] = {
+static const uint32_t lcd_panel_config[] = {
CMD2(0xb8, 0xff, 0xf9), /* Output control */
CMD0(0x11), /* sleep out */
CMD1(0xba, 0x01),   /* Display mode (1) */
@@ -175,10 +175,11 @@ static uint32_t lcd_panel_config[] = {
CMD_NULL,
 };
 
-static int tdo24m_writes(struct tdo24m *lcd, uint32_t *array)
+static int tdo24m_writes(struct tdo24m *lcd, const uint32_t *array)
 {
struct spi_transfer *x = >xfer;
-   uint32_t data, *p = array;
+   const uint32_t *p = array;
+   uint32_t data;
int nparams, err = 0;
 
for (; *p != CMD_NULL; p++) {
-- 
1.7.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/


linux-next: Tree for Oct 23

2012-10-22 Thread Stephen Rothwell
Hi all,

Changes since 201201022:

New tree: drop-experimental

The xtensa tree lost its conflict.

The usb tree gained a build failure for which I reverted a commit.

The akpm tree gained 2 build failures for which I reverted some commits.



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

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log files
in the Next directory.  Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64. After the
final fixups (if any), it is also built with powerpc allnoconfig (32 and
64 bit), ppc44x_defconfig and allyesconfig (minus
CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc,
sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

We are up to 205 trees (counting Linus' and 26 trees of patches pending
for Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

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

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

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (0390c88 module_signing: fix printk format warning)
Merging fixes/master (12250d8 Merge branch 'i2c-embedded/for-next' of 
git://git.pengutronix.de/git/wsa/linux)
Merging kbuild-current/rc-fixes (b1e0d8b kbuild: Fix gcc -x syntax)
Merging arm-current/fixes (3d6ee36 Merge branch 'late-for-linus' of 
git://git.linaro.org/people/rmk/linux-arm)
Merging m68k-current/for-linus (8a745ee m68k: Wire up kcmp)
Merging powerpc-merge/merge (83dac59 cpuidle/powerpc: Fix snooze state problem 
in the cpuidle design on pseries.)
Merging sparc/master (43c422e apparmor: fix apparmor OOPS in 
audit_log_untrustedstring+0x1c/0x40)
Merging net/master (3d861f6 net: fix secpath kmemleak)
Merging sound-current/for-linus (21b3de8 ALSA: als3000: check for the kzalloc 
return value)
Merging pci-current/for-linus (0ff9514 PCI: Don't print anything while decoding 
is disabled)
Merging wireless/master (290eddc Merge branch 'for-john' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211)
Merging driver-core.current/driver-core-linus (d28d388 firmware loader: sync 
firmware cache by async_synchronize_full_domain)
Merging tty.current/tty-linus (6f0c058 Linux 3.7-rc2)
Merging usb.current/usb-linus (3b6054d usb hub: send clear_tt_buffer_complete 
events when canceling TT clear work)
Merging staging.current/staging-linus (b3ca610 staging: ramster: depends on NET)
Merging char-misc.current/char-misc-linus (ddffeb8 Linux 3.7-rc1)
Merging input-current/for-linus (0cc8d6a Merge branch 'next' into for-linus)
Merging md-current/for-linus (72f36d5 md: refine reporting of resync/reshape 
delays.)
Merging audit-current/for-linus (c158a35 audit: no leading space in 
audit_log_d_path prefix)
Merging crypto-current/master (c9f97a2 crypto: x86/glue_helper - fix storing of 
new IV in CBC encryption)
Merging ide/master (9974e43 ide: fix generic_ide_suspend/resume Oops)
Merging dwmw2/master (244dc4e Merge 
git://git.infradead.org/users/dwmw2/random-2.6)
Merging sh-current/sh-fixes-for-linus (4403310 SH: Convert out[bwl] macros to 
inline functions)
Merging irqdomain-current/irqdomain/merge (15e06bf irqdomain: Fix debugfs 
formatting)
Merging devicetree-current/devicetree/merge (4e8383b of: release node fix for 
of_parse_phandle_with_args)
Merging spi-current/spi/merge (d1c185b of/spi: Fix SPI module loading by using 
proper "spi:" modalias prefixes.)
Merging gpio-current/gpio/merge (96b7064 gpio/tca6424: merge I2C transactions, 
remove cast)
Merging asm-generic/master (c37d615 Merge branch 'disintegrate-asm-generic' of 
git://git.infradead.org/users/dhowells/linux-headers into asm-generic)
Merging arm/for-next (ef4e305 ARM: mm: use bitmap operations when allocating 
new ASIDs)
Merging arm-perf/for-next/perf (eab8fc8 Merge branch 'hw-breakpoint' into 
for-next/perf)
Merging 

[PATCH 2/4] backlight: lms283gf05: add missing const

2012-10-22 Thread Jingoo Han
Add 'const' to static array that was missing it in its
definition.

Signed-off-by: Jingoo Han 
Cc: Marek Vasut 
Cc: Richard Purdie 
---
 drivers/video/backlight/lms283gf05.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/lms283gf05.c 
b/drivers/video/backlight/lms283gf05.c
index ea43f22..151f0da 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -31,7 +31,7 @@ struct lms283gf05_seq {
 };
 
 /* Magic sequences supplied by manufacturer, for details refer to datasheet */
-static struct lms283gf05_seq disp_initseq[] = {
+static const struct lms283gf05_seq disp_initseq[] = {
/* REG, VALUE, DELAY */
{ 0x07, 0x, 0 },
{ 0x13, 0x, 10 },
@@ -78,7 +78,7 @@ static struct lms283gf05_seq disp_initseq[] = {
{ 0x22, 0x, 0 }
 };
 
-static struct lms283gf05_seq disp_pdwnseq[] = {
+static const struct lms283gf05_seq disp_pdwnseq[] = {
{ 0x07, 0x0016, 30 },
 
{ 0x07, 0x0004, 0 },
@@ -104,7 +104,7 @@ static void lms283gf05_reset(unsigned long gpio, bool 
inverted)
 }
 
 static void lms283gf05_toggle(struct spi_device *spi,
-   struct lms283gf05_seq *seq, int sz)
+   const struct lms283gf05_seq *seq, int sz)
 {
char buf[3];
int i;
-- 
1.7.1


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


Re: [PATCH 3/6] perf, x86: Save/resotre LBR stack during context switch

2012-10-22 Thread Yan, Zheng
On 10/22/2012 04:31 PM, Stephane Eranian wrote:
> On Mon, Oct 22, 2012 at 7:57 AM, Yan, Zheng  wrote:
>> From: "Yan, Zheng" 
>>
>> When the LBR call stack is enabled, it is necessary to save/restore
>> the stack on context switch. The solution is saving/restoring the
>> stack to/from task's perf event context. If task has no perf event
>> context, just flush the stack on context switch.
>>
> I assume you mean necessary because you want to pop on return
> to work more often that none. However, you could also say that
> having save/restore for the other modes could be useful as well
> otherwise you may disconnected branch paths which is a problem
> which measuring basic block execution counts.
> 
> But your patch seems to address the problem ONLY for
> callstack mode.

The on-chip LBR stack has limited size and no PMI when overflow.
I don't think it suits for sampling branch paths. To get continuous,
branch path, maybe we can add similar save/restore function to BTS.

Regards
Yan, Zheng

> 
> 
>> Signed-off-by: Yan, Zheng 
>> ---
>>  arch/x86/kernel/cpu/perf_event.c   |  18 +++--
>>  arch/x86/kernel/cpu/perf_event.h   |  14 +++-
>>  arch/x86/kernel/cpu/perf_event_intel.c |  13 +---
>>  arch/x86/kernel/cpu/perf_event_intel_lbr.c | 115 
>> ++---
>>  include/linux/perf_event.h |   6 +-
>>  kernel/events/core.c   |  64 +---
>>  6 files changed, 176 insertions(+), 54 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/perf_event.c 
>> b/arch/x86/kernel/cpu/perf_event.c
>> index 3361114..119687d 100644
>> --- a/arch/x86/kernel/cpu/perf_event.c
>> +++ b/arch/x86/kernel/cpu/perf_event.c
>> @@ -1606,6 +1606,13 @@ static int x86_pmu_event_idx(struct perf_event *event)
>> return idx + 1;
>>  }
>>
>> +static void x86_pmu_branch_stack_sched(struct perf_event_context *ctx,
>> +   bool sched_in)
>> +{
>> +   if (x86_pmu.branch_stack_sched)
>> +   x86_pmu.branch_stack_sched(ctx, sched_in);
>> +}
>> +
>>  static void *x86_pmu_event_context_alloc(struct perf_event_context 
>> *parent_ctx)
>>  {
>> struct perf_event_context *ctx;
>> @@ -1614,6 +1621,9 @@ static void *x86_pmu_event_context_alloc(struct 
>> perf_event_context *parent_ctx)
>> if (!ctx)
>> return ERR_PTR(-ENOMEM);
>>
>> +   if (parent_ctx)
>> +   intel_pmu_lbr_init_context(ctx, parent_ctx);
>> +
>> return ctx;
>>  }
>>
>> @@ -1673,12 +1683,6 @@ static const struct attribute_group 
>> *x86_pmu_attr_groups[] = {
>> NULL,
>>  };
>>
>> -static void x86_pmu_flush_branch_stack(void)
>> -{
>> -   if (x86_pmu.flush_branch_stack)
>> -   x86_pmu.flush_branch_stack();
>> -}
>> -
>>  void perf_check_microcode(void)
>>  {
>> if (x86_pmu.check_microcode)
>> @@ -1705,7 +1709,7 @@ static struct pmu pmu = {
>> .commit_txn = x86_pmu_commit_txn,
>>
>> .event_idx  = x86_pmu_event_idx,
>> -   .flush_branch_stack = x86_pmu_flush_branch_stack,
>> +   .branch_stack_sched = x86_pmu_branch_stack_sched,
>> .event_context_alloc= x86_pmu_event_context_alloc,
>>  };
>>
>> diff --git a/arch/x86/kernel/cpu/perf_event.h 
>> b/arch/x86/kernel/cpu/perf_event.h
>> index 97fc4b0..cd96109 100644
>> --- a/arch/x86/kernel/cpu/perf_event.h
>> +++ b/arch/x86/kernel/cpu/perf_event.h
>> @@ -369,7 +369,6 @@ struct x86_pmu {
>> void(*cpu_dead)(int cpu);
>>
>> void(*check_microcode)(void);
>> -   void(*flush_branch_stack)(void);
>>
>> /*
>>  * Intel Arch Perfmon v2+
>> @@ -399,6 +398,8 @@ struct x86_pmu {
>> int lbr_nr;/* hardware stack size */
>> u64 lbr_sel_mask;  /* LBR_SELECT valid bits 
>> */
>> const int   *lbr_sel_map;  /* lbr_select mappings */
>> +   void(*branch_stack_sched)(struct perf_event_context *ctx,
>> + bool sched_in);
>>
>> /*
>>  * Extra registers for events
>> @@ -414,6 +415,13 @@ struct x86_pmu {
>>
>>  struct x86_perf_event_context {
>> struct perf_event_context ctx;
>> +
>> +   u64 lbr_from[MAX_LBR_ENTRIES];
>> +   u64 lbr_to[MAX_LBR_ENTRIES];
>> +   u64 lbr_callstack_gen;
>> +   int lbr_callstack_users;
>> +   bool lbr_callstack_saved;
>> +
>>  };
>>
>>  #define x86_add_quirk(func_)   \
>> @@ -615,8 +623,12 @@ void intel_pmu_pebs_disable_all(void);
>>
>>  void intel_ds_init(void);
>>
>> +void intel_pmu_lbr_init_context(struct perf_event_context *child_ctx,
>> +   struct perf_event_context *parent_ctx);
>>  void intel_pmu_lbr_reset(void);
>>
>> +void intel_pmu_lbr_sched(struct perf_event_context *ctx, bool sched_in);
>> +
>>  void 

[PATCH 1/4] backlight: da9052: add missing const

2012-10-22 Thread Jingoo Han
Add 'const' to static array that was missing it in its
definition.

Signed-off-by: Jingoo Han 
Cc: Ashish Jangam 
Cc: Richard Purdie 
---
 drivers/video/backlight/da9052_bl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/backlight/da9052_bl.c 
b/drivers/video/backlight/da9052_bl.c
index ac19618..842da5a 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -34,7 +34,7 @@ enum {
DA9052_TYPE_WLED3,
 };
 
-static unsigned char wled_bank[] = {
+static const unsigned char wled_bank[] = {
DA9052_LED1_CONF_REG,
DA9052_LED2_CONF_REG,
DA9052_LED3_CONF_REG,
-- 
1.7.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/


linux-next: build failure after merge of the final tree (usb tree related)

2012-10-22 Thread Stephen Rothwell
Hi all,

After merging the final tree, today's linux-next build (powerpc
allyesconfig) failed like this:

In file included from drivers/usb/host/ohci-hcd.c:1165:0:
drivers/usb/host/ohci-sm501.c: In function 'ohci_sm501_resume':
drivers/usb/host/ohci-sm501.c:241:2: error: implicit declaration of function 
'ohci_finish_controller_resume' [-Werror=implicit-function-declaration]

Caused by commit cfa49b4b88fe ("USB: ohci: merge
ohci_finish_controller_resume with ohci_resume").

I have reverted that commit for today.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpSJl3lAr8is.pgp
Description: PGP signature


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-10-22 Thread Lucas De Marchi
On Tue, Oct 23, 2012 at 1:40 AM, Kees Cook  wrote:
> On Mon, Oct 22, 2012 at 7:37 PM, Lucas De Marchi
>  wrote:
>> On Mon, Oct 22, 2012 at 5:39 AM, Rusty Russell  wrote:
>>> "Michael Kerrisk (man-pages)"  writes:
> FIX: add flags arg to sys_finit_module()
>
> Thanks to Michael Kerrisk for keeping us honest.

 w00t! Thanks, Rusty ;-).

 Acked-by: Michael Kerrisk 
>>>
>>> Here's the version I ended up with when I added two flags.
>>>
>>> Lucas, is this useful to you?
>>>
>>> BTW Michael: why aren't the syscall man pages in the kernel source?
>>>
>>> Thanks,
>>> Rusty.
>>>
>>> module: add flags arg to sys_finit_module()
>>>
>>> Thanks to Michael Kerrisk for keeping us honest.  These flags are actually
>>> useful for eliminating the only case where kmod has to mangle a module's
>>> internals: for overriding module versioning.
>>>
>>> Signed-off-by: Rusty Russell 
>
> Acked-by: Kees Cook 
>
>> I wonder if we shouldn't get a new init_module2() as well, adding the
>> flags parameter. Of course this would be in another patch.
>>
>> My worries are that for compressed modules we still need to use
>> init_module() and then --force won't work with signed modules.
>
> For those cases, I think it should remain up to userspace to do the
> decompress and use init_module(). The code I'd written for patching
> module-init-tools basically just kept the fd around if it didn't need
> to mangle the module, and it would use finit_module (written before
> the flags argument was added):
>
> /* request kernel linkage */
> -   ret = init_module(module->data, module->len, opts);
> +   if (fd < 0)
> +   ret = init_module(module->data, module->len, opts);
> +   else {
> +   ret = finit_module(fd, opts);
> +   if (ret != 0 && errno == ENOSYS)
> +   ret = init_module(module->data, module->len, opts);
> +   }
> if (ret != 0) {
>
> (And yes, I realize kmod is what'll actually be getting this logic.
> This was for my testing in Chrome OS, which is still using
> module-init-tools.)

sure... but do you realize this will fail in case kernel is checking
module signature and we passed --force to modprobe (therefore mangled
the decompressed memory area)?


Lucas De Marchi
--
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 v1] Support Elan Touchscreen eKTF product.

2012-10-22 Thread 劉嘉駿
Hi,

> -Original Message-
> From: Benjamin Tissoires [mailto:benjamin.tissoi...@gmail.com]
> Sent: Tuesday, October 23, 2012 1:12 AM
> To: Dmitry Torokhov
> Cc: Jian-Jhong Ding; Scott Liu; linux-in...@vger.kernel.org;
linux-...@vger.kernel.org;
> linux-kernel@vger.kernel.org; Jesse; Vincent Wang; Paul
> Subject: Re: [PATCH v1] Support Elan Touchscreen eKTF product.
> 
> On Mon, Oct 22, 2012 at 6:07 PM, Dmitry Torokhov
>  wrote:
> > On Mon, Oct 22, 2012 at 11:47:42AM +0800, Jian-Jhong Ding wrote:
> >> Scott Liu  writes:
> >> > +
> >> > +struct mt_device {
> >> > +   struct mt_slot curdata; /* placeholder of incoming data */
> >> > +   __u8 num_received;  /* how many contacts we received */
> >> > +   __u8 num_expected;  /* expected last contact index */
> >> > +   __u8 maxcontacts;
> >> > +   bool curvalid;  /* is the current contact valid? */
> >> > +   struct mt_slot *slots;
> >> > +};
> >>
> >> With Benjamin's i2c-hid implimentation, is it possible to make
> >> hid-multitouch not depend on USBHID and reuse it to drive this device?
> 
> We can already use hid-multitouch with hid over I2C devices (I'm
> testing my i2c devices with this module).
> But it's true that hid-multitouch depends on usbhid, and I the funny
> think is that I was removing this dependency today.
> The fact is that currently, i2c devices do not segfault with
> hid-multitouch  because win8 devices do not require anymore to set
> some feature at plug.
> 
> >
> > Exactly. Before looking any further - is this the same part that Tom Lin
> > posted a driver for earlier this summer?
> 
> I'm not Elan, and I can not be sure, but judging from the "hello
> packets" and the other commands, I doubt this device is an I2C over
> HID one.
> 
It's an I2C device with ELAN own format, no HID packet transferring.

> Anyway, reusing hid-multitouch for this specific case seams to be a
> little bit difficult. You would have first to provide a fake report
> descriptor (or inject commands as if you were hid-core) and then, you
> would have to reformat the incoming data into valid win7 (or 8)
> packets. Judging by the functions elan_touch_parse_fid,
> elan_touch_parse_wid and elants_parse_xy, the data seem to be mixed
> (all the finger ids at the beginning, and not one per touch), so it is
> definitively needed to recreate a valid HID packet.
> 
> So I'm not surprised with the duplicated code. However, Henrik did a
> big job in kernel 3.7 to factorize mt code, and some part of the
> duplication can be achieve with these functions (look at
> input_mt_sync_frame and input_mt_get_slot_by_key for example).
> 
I think so; it would cause too much pain for reuse hid-multitouch.
BTW, I'll have checked Henrik's code to see if there are possible to reuse
some code.

Thanks,
Scott


> Cheers,
> Benjamin
> 
> >
> > Thanks.
> >
> > --
> > Dmitry

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


Re: [PATCH 02/16 v2] f2fs: add on-disk layout

2012-10-22 Thread NeilBrown
On Tue, 23 Oct 2012 11:26:00 +0900 Jaegeuk Kim 
wrote:

> This adds a header file describing the on-disk layout of f2fs.
> 


> +struct f2fs_inode {
> + __le16 i_mode;  /* File mode */
> + __u8 i_advise;  /* File hints */
> + __u8 i_reserved;/* Reserved */
> + __le32 i_uid;   /* User ID */
> + __le32 i_gid;   /* Group ID */
> + __le32 i_links; /* Links count */
> + __le64 i_size;  /* File size in bytes */
> + __le64 i_blocks;/* File size in blocks */
> + __le64 i_ctime; /* Inode change time */
> + __le64 i_mtime; /* Modification time */
> + __le32 i_ctime_nsec;
> + __le32 i_mtime_nsec;
> + __le32 current_depth;
> + __le32 i_xattr_nid; /* nid to save xattr */
> + __le32 i_flags; /* file attributes */
> + __le32 i_pino;  /* parent inode number */
> + __le32 i_namelen;   /* file name length */
> + __u8 i_name[F2FS_MAX_NAME_LEN]; /* file name for SPOR */
> +
> + struct f2fs_extent i_ext;   /* caching a largest extent */
> +
> + __le32 i_addr[ADDRS_PER_INODE]; /* Pointers to data blocks */
> +
> + __le32 i_nid[5];/* direct(2), indirect(2),
> + double_indirect(1) node id */
> +} __packed;
> +


You appear to have dropped i_btime - no big deal, you weren't using it anyway.
However if you ever want to support NFS export you will need some value which
is assigned when the inode is allocated and never changed until it is
de-allocated.  This is used to detect when an NFS file-handle refers to a
previous incarnation of an inode and so should be rejected as STALE.
i_btime could have possibly provided this, but not any more.  You might want
to add something back.
ext3 uses "i_generation" and has an 's_next_generation' in the superblock to
ensure that each new inode gets a new generation number.

You've also dropped i_atime.  I can certainly understand the desire to do
that, but I wonder if it is entirely wise.  There are some use-cases where
i_mtime is a poor substitute.

Also 'current_depth' looks a little odd without a 'i_' prefix.  It wouldn't
hurt to have a comment noting that it is for directories.

Thanks,
NeilBrown



signature.asc
Description: PGP signature


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

2012-10-22 Thread Stephen Rothwell
Hi Andrew,

After merging the akpm tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

kernel/printk/printk_syslog.c: In function 'printk_syslog_print':
kernel/printk/printk_syslog.c:108:3: error: implicit declaration of function 
'copy_to_user' [-Werror=implicit-function-declaration]
kernel/printk/printk_syslog.c: In function 'do_syslog':
kernel/printk/printk_syslog.c:245:3: error: implicit declaration of function 
'access_ok' [-Werror=implicit-function-declaration]
kernel/printk/printk_syslog.c:245:18: error: 'VERIFY_WRITE' undeclared (first 
use in this function)
kernel/printk/printk_syslog.c:245:18: note: each undeclared identifier is 
reported only once for each function it appears in

Caused by commit 598815e5f25f ("printk: add printk_syslog.c and .h").

Presumably missing an (or some) include files - see Rule 1 in
Documentation/SubmitChecklist.

I have reverted that commit for today (and the following commit
2cf91e0e4b9f ("printk: move kmsg_dump functions to separate file")).
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpmjP4fO3yZH.pgp
Description: PGP signature


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-10-22 Thread Kees Cook
On Mon, Oct 22, 2012 at 7:37 PM, Lucas De Marchi
 wrote:
> On Mon, Oct 22, 2012 at 5:39 AM, Rusty Russell  wrote:
>> "Michael Kerrisk (man-pages)"  writes:
 FIX: add flags arg to sys_finit_module()

 Thanks to Michael Kerrisk for keeping us honest.
>>>
>>> w00t! Thanks, Rusty ;-).
>>>
>>> Acked-by: Michael Kerrisk 
>>
>> Here's the version I ended up with when I added two flags.
>>
>> Lucas, is this useful to you?
>>
>> BTW Michael: why aren't the syscall man pages in the kernel source?
>>
>> Thanks,
>> Rusty.
>>
>> module: add flags arg to sys_finit_module()
>>
>> Thanks to Michael Kerrisk for keeping us honest.  These flags are actually
>> useful for eliminating the only case where kmod has to mangle a module's
>> internals: for overriding module versioning.
>>
>> Signed-off-by: Rusty Russell 

Acked-by: Kees Cook 

> I wonder if we shouldn't get a new init_module2() as well, adding the
> flags parameter. Of course this would be in another patch.
>
> My worries are that for compressed modules we still need to use
> init_module() and then --force won't work with signed modules.

For those cases, I think it should remain up to userspace to do the
decompress and use init_module(). The code I'd written for patching
module-init-tools basically just kept the fd around if it didn't need
to mangle the module, and it would use finit_module (written before
the flags argument was added):

/* request kernel linkage */
-   ret = init_module(module->data, module->len, opts);
+   if (fd < 0)
+   ret = init_module(module->data, module->len, opts);
+   else {
+   ret = finit_module(fd, opts);
+   if (ret != 0 && errno == ENOSYS)
+   ret = init_module(module->data, module->len, opts);
+   }
if (ret != 0) {

(And yes, I realize kmod is what'll actually be getting this logic.
This was for my testing in Chrome OS, which is still using
module-init-tools.)

-Kees

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


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

2012-10-22 Thread Stephen Rothwell
Hi Andrew,

After merging the akpm tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

arch/powerpc/platforms/pasemi/idle.c:88:1: error: macro "__define_initcall" 
passed 3 arguments, but takes just 2
arch/powerpc/platforms/pasemi/idle.c:88:1: error: data definition has no type 
or storage class [-Werror]
arch/powerpc/platforms/pasemi/idle.c:88:1: error: type defaults to 'int' in 
declaration of '__define_initcall' [-Werror=implicit-int]
arch/powerpc/platforms/pasemi/idle.c:88:1: error: 
'__machine_initcall_pasemi_pasemi_idle_init' defined but not used 
[-Werror=unused-function]

Caused by commit e509970f45d1 ("include/linux/init.h: use the stringify
operator for the __define_initcall macro").

Please use grep, it is your friend.

I have reverted that commit for today (and the following commit
("init-use-the-stringify-operator-for-the-__define_initcall-macro-checkpatch-fixes")
that depends on it.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpIqqh58adYX.pgp
Description: PGP signature


3.7-rc2 regression : file copied to CIFS-mounted directory corrupted

2012-10-22 Thread Jongman Heo

Hi, all,

With 3.7-rc2, I noticed that file copied to CIFS-mounted directory is 
corrupted. 
Integrity is checked by md5sum.

  1. get md5sum of file located on local (ext4) disk
  2. copy the file to CIFS-mounted directory
  3. check md5sum of the copied file

Host   : Windows 7
Guest : Fedora 16 on VMWare
Kernel : 3.7-rc2

Shared directory exists on Windows 7 Host, and Linux Guest on VMware mounts it 
using CIFS.

I thought it was related to CIFS or VFS changes, but it wasn't.

Below is a git bisect log, and first bad commit is 5640f768, "net: use a per 
task frag allocator".

Reverting the commit 5640f768 fixes the corruption issue on CIFS directory.
During revert, I got conflict in net/ipv4/raw.c. I took "parent of 5640f76" 
hunk to resolve it.

# git bisect log
git bisect start
# bad: [6f0c0580b70c89094b3422ba81118c7b959c7556] Linux 3.7-rc2
git bisect bad 6f0c0580b70c89094b3422ba81118c7b959c7556
# good: [a0d271cbfed1dd50278c6b06bead3d00ba0a88f9] Linux 3.6
git bisect good a0d271cbfed1dd50278c6b06bead3d00ba0a88f9
# good: [fec344e3f31aa911297cd3a4639432d983b1f324] cifs: change cifs_call_async 
to use smb_rqst structs
git bisect good fec344e3f31aa911297cd3a4639432d983b1f324
# good: [3d6d854a13844223b603fd7a16a4a4a4afd62c72] cifs: add FL_CLOSE to 
fl_flags mask in cifs_read_flock
git bisect good 3d6d854a13844223b603fd7a16a4a4a4afd62c72
# good: [f065fd099fc475333fc7a55677a7f64764445d55] CIFS: Fix possible freed 
pointer dereference in CIFS_SessSetup
git bisect good f065fd099fc475333fc7a55677a7f64764445d55
# bad: [b7a10626c8bc88fd097a8bb4486c89558f89320c] [CIFS] WARN_ON_ONCE if 
kernel_sendmsg() returns -ENOSPC
git bisect bad b7a10626c8bc88fd097a8bb4486c89558f89320c
# good: [1d4ab9077681b7cce60ff46e3a42fe2dafa0b83d] [CIFS] Fix indentation of 
fs/cifs/Kconfig entries
git bisect good 1d4ab9077681b7cce60ff46e3a42fe2dafa0b83d
# bad: [aab174f0df5d72d31caccf281af5f614fa254578] Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect bad aab174f0df5d72d31caccf281af5f614fa254578
# good: [d9a807461fc8cc0d6ba589ea0730d139122af012] Merge tag 'usb-3.6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect good d9a807461fc8cc0d6ba589ea0730d139122af012
# good: [a20acf99f75e49271381d65db097c9763060a1e8] Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
git bisect good a20acf99f75e49271381d65db097c9763060a1e8
# bad: [d379142bc4d9b78cdd9fc5aa696ca1ea083fb7d4] be2net: fixup log messages
git bisect bad d379142bc4d9b78cdd9fc5aa696ca1ea083fb7d4
# good: [2a35cfa591ac63f17815c2d9432b799e37527980] r8169: add D-Link DGE-560T 
identifiers.
git bisect good 2a35cfa591ac63f17815c2d9432b799e37527980
# good: [9316f0e3c6ba524d8fa14bfded048b252891931a] Merge branch 'master' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into 
for-davem
git bisect good 9316f0e3c6ba524d8fa14bfded048b252891931a
# good: [623df484a777f3c00c1ea3d6a7565b8d8ac688a1] tcp: extract code to compute 
SYNACK RTT
git bisect good 623df484a777f3c00c1ea3d6a7565b8d8ac688a1
# bad: [c523530ce17defe6b28ccfe622c506488f430866] can: c_can: fix segfault 
during rmmod
git bisect bad c523530ce17defe6b28ccfe622c506488f430866
# good: [6ee584be3ee30f72dec8a8ca87bc10824e27a631] netfilter: nfnetlink_queue: 
add NFQA_CAP_LEN attribute
git bisect good 6ee584be3ee30f72dec8a8ca87bc10824e27a631
# good: [725b9c0425f54450d1f376befb85dae706ea0c7a] qeth: cleanup channel path 
descriptor function
git bisect good 725b9c0425f54450d1f376befb85dae706ea0c7a
# good: [0cf833aefaa85bbfce3ff70485e5534e09254773] net: loopback: set default 
mtu to 64K
git bisect good 0cf833aefaa85bbfce3ff70485e5534e09254773
# bad: [9e49e88958feb41ec701fa34b44723dabadbc28c] filter: add XOR instruction 
for use with X/K
git bisect bad 9e49e88958feb41ec701fa34b44723dabadbc28c
# bad: [5640f7685831e088fe6c2e1f863a6805962f8e81] net: use a per task frag 
allocator
git bisect bad 5640f7685831e088fe6c2e1f863a6805962f8e81
# good: [b98b8babd6e3370fadb7c6eaacb00eb2f6344a6c] gianfar: Change default HW 
Tx queue scheduling mode
git bisect good b98b8babd6e3370fadb7c6eaacb00eb2f6344a6c


RE: [PATCH 07/16 v2] f2fs: add segment operations

2012-10-22 Thread Jaegeuk Kim
> Hi.
> 
> Building f2fs for ARM gives the following error:
> 
>   CC  fs/f2fs/segment.o
>   CC  fs/f2fs/recovery.o
> fs/f2fs/segment.c: In function 'build_sit_info':
> fs/f2fs/segment.c:1399:2: error: implicit declaration of function 'vzalloc' 
> [-Werror=implicit-
> function-declaration]
> fs/f2fs/segment.c:1399:18: warning: assignment makes pointer from integer 
> without a cast [enabled by
> default]
> fs/f2fs/segment.c:1419:22: warning: assignment makes pointer from integer 
> without a cast [enabled by
> default]
> fs/f2fs/segment.c: In function 'destroy_sit_info':
> fs/f2fs/segment.c:1777:2: error: implicit declaration of function 'vfree' 
> [-Werror=implicit-function-
> declaration]
> cc1: some warnings being treated as errors
> 
> The following fixes that:
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 57d0931..5bab838 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include "f2fs.h"
>  #include "segment.h"
> 

Thank you very much.
I'll apply this in v3.

> --
> Thanks.
> -- Max

--
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 16/16 v2] f2fs: update Kconfig and Makefile

2012-10-22 Thread Jaegeuk Kim
> On Tue, Oct 23, 2012 at 11:33:28AM +0900, Jaegeuk Kim wrote:
> > +config F2FS_STAT_FS
> > +   bool "F2FS Status Information"
> > +   depends on F2FS_FS
> > +   default y
> > +   help
> > + /proc/fs/f2fs/ contains information about partitions mounted as f2fs.
> > + For each partition, a corresponding directory, named as its device
> > + name, is provided with the following proc entries.
> > +
> > + f2fs_stat major file system information managed by f2fs currently
> > + f2fs_sit_stat average SIT information about whole segments
> > + f2fs_mem_stat current memory footprint consumed by f2fs
> > +
> > + e.g., in /proc/fs/f2fs/sdb1/
> 
> Again, I will point out that this should either be in debugfs, or in
> /sys/fs/ but it should NOT be in /proc/ at all.
> 
> If you need help, I will be glad to do this conversion, just let me know
> and I'll send you a patch on top of this series that moves these entries
> into debugfs, which is where I think they really belong.

Ok, please. :)
I really appreciate your kindness.

> 
> thanks,
> 
> greg k-h

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


Re: [PATCH 0/1] staging: Add firewire-serial driver

2012-10-22 Thread Greg Kroah-Hartman
On Mon, Oct 22, 2012 at 10:34:39PM -0400, Peter Hurley wrote:
> On Mon, 2012-10-22 at 15:45 -0700, Greg Kroah-Hartman wrote:
> > On Thu, Oct 18, 2012 at 08:56:55AM -0400, Peter Hurley wrote:
> > > Please consider this serial driver for review for submission to staging.
> > > The firewire-serial driver implements TTY over IEEE 1394. In its default
> > > configuration, it creates 4 TTY devices and one loopback device per
> > > firewire card (respectively, named fwtty~fwtty and fwloop).
> > > 
> > > Currently, the TTY devices auto-connect to every cabled peer (the TODO
> > > list includes plans for providing a sysfs interface to control virtual
> > > cabling with whitelist/blacklist support per GUID).
> > > 
> > > Efforts are still ongoing for a companion console driver, with plans to
> > > eventually add early_printk & kgdb support (via additional drivers).
> > > 
> > > Some issues did arise with both the TTY and Firewire subsystems which
> > > are noted in the TODO file. Please review these workarounds.
> > > 
> > > Peter Hurley (1):
> > >   staging: fwserial: Add TTY-over-Firewire serial driver
> > 
> > I'd like to get an Ack from Stefan here, before I'll add this to the
> > staging tree.
> 
> Of course.
> 
> Jiri's newest series ("TTY buffer in tty_port and other stuff") does
> break this driver, so I'll need to resubmit to address those changes.
> Two of the workarounds mentioned in the TODO are related to the
> tty_buffer interface; specifically,
> 
> 1. The ldisc drops the contents of tty_buffer on hangup (rather than
> waiting for completion). Maybe for other devices this isn't so
> noticeable because the ldisc can mostly keep up with the device, but on
> firewire the ldisc lags well behind. Right now, this driver works around
> this by holding off the hangup until the ldisc empties the tty_buffer.
> The driver determines how much data is still left in the tty_buffer by
> walking the flip buffers.

That's not good.  Surely other drivers must see this, as we handle tty
over ethernet, that should be just as fast as firewire, right?  What do
those drivers do to handle this issue?

> 2. Because this driver can fill the entire tty_buffer (64K +) before the
> ldisc even runs once, this driver has to self-throttle when feeding the
> tty_buffer. So as not to drop data, the driver has to know when a
> watermark is reached in the tty_buffer, to ensure that in-flight +
> already-accepted data can safely be moved to what remains avail in the
> tty_buffer. (The tty_buffer maxs at 64K). Currently, the avail level in
> the tty_buffer is computed by this driver (in the same manner as
> tty_buffer_alloc()).

I suggest bringing this up on the linux-serial@vger mailing list, Alan
and Jiri should be able to help you out.

thanks,

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


Re: [PATCH 1/2] Staging: android: binder: Fix memory leak on thread/process exit

2012-10-22 Thread Greg KH
On Mon, Oct 22, 2012 at 05:58:08PM -0700, Arve Hj?nnev?g wrote:
> On Mon, Oct 22, 2012 at 1:00 PM, Greg KH  wrote:
> > On Tue, Oct 16, 2012 at 03:45:20PM -0700, Arve Hj?nnev?g wrote:
> >> On Tue, Oct 16, 2012 at 12:11 AM, Greg KH  
> >> wrote:
> >> > On Mon, Oct 15, 2012 at 05:32:41PM -0700, Arve Hj?nnev?g wrote:
> >> >> If a thread or process exited while a reply, one-way transaction or
> >> >> death notification was pending, the struct holding the pending work
> >> >> was leaked.
> >> >>
> >> >> Change-Id: I2eaafaba1c0ecda3ec0872d449dc16d0721c21e7
> >> >
> >> > What is this field?  Please don't include this in kernel patches, it
> >> > forces me to edit the patch by hand :(
> >> >
> >>
> >> It is a tag generated a git hook to uniquely identify a change through
> >> multiple revisions of that change. If the tag does not already exist
> >> the hook adds it. I removed it from the reposted patches as you
> >> requested, but have you considered leaving it in? It is a useful
> >> search token both for finding different revisions of a patch and for
> >> finding which branch a change has been cherry-picked into.
> >
> > Sorry, I was being facetious, I knew what it really was, but the point
> > was, why would I?
> >
> 
> So you can use it. If, for instance, you want to see which branches
> you cherry-picked this change into you can run "git rev-list --all
> --grep I2eaafaba1c0ecda3ec0872d449dc16d0721c21e7 | xargs -rl git
> branch -a --contains". If it was more widely used, it would also be
> useful for finding mailing list discussion of multiple versions of
> patches (even when the title of the patch changes).

Yes, if you want a unique identifier for a patch in order to try to
track it through trees, you can do something like that (hint, see Alan
Stern's patches, he has his own identifier for that.)  But don't use the
gerrit id for this, it's not useful and it is confusing.  We have
discussed this in the past, see the lkml archives for details.

> > As has been stated before, you can include information like this in your
> > patch, but you MUST reference it properly so that others can be able to
> > figure out what you mean.  A random Change-Id value means nothing given
> > that lots of different groups use gerrit.  You need a url, or a pointer
> > to which gerrit instance this refers to before you can include it.
> >
> 
> There is no single url. The tag was generated by a local git hook
> before it was uploaded anywhere. While gerrit looks for this tag and
> use it when it is there, the same change can be uploaded to different
> gerrit instances. While it would be useful to also include urls to the
> gerrit instance(s) that a patch was discussed on, the Change-Id is
> useful by itself.
> 
> > Same goes for bugzilla entries, if you look in the kernel changelog, we
> > reference lots of different ones, but we use urls to determine which one
> > we are talking about (suse, red hat, kernel.org, etc.)
> >
> 
> Those IDs appear to be local to a specific server, so the id without
> the url would not be very useful.

Ok, then I don't recommend it be used at all, as we have a unique
identifier, the git commit id in Linus's tree.  That id does follow the
patch around if it goes into any stable kernel tree, so let's stick with
it.

thanks,

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


Re: [PATCH] staging: csr: fix coding style

2012-10-22 Thread SeongJae Park
Thank you for fast reply, Greg.

I was very impressed by your session at Linux Forum,
sent linux kernel patch, made a document about your session(write and
submit your first Linux kernel patch) in Korean, and my patch merged,
have discussion with Linux kernel guys...

These whole thing about my first kernel patch were fantastic and great
experience.

I think I got realized meaning & fun of F/OSS a little bit ;)
So, I would never stop contributing to Linux in any ways.

Thank you very much, Greg, and whole kernel people.

Thanks and Best Regards.
SeongJae Park.

On Tue, Oct 23, 2012 at 11:53 AM, Greg KH  wrote:
> On Tue, Oct 23, 2012 at 11:41:06AM +0900, SeongJae Park wrote:
>> Hello,
>>
>>
>> I think it was my mistake.
>>
>> CsrThread is enclosed by macro #ifdef __KERNEL__
>> and it used by csr_framework_ext.h as CsrThreadHandle type(typedef
>> used at csr_framework_ext_types.h).
>>
>> I think that's why I didn't see build failure.
>
> When building the driver __KERNEL__ is defined :)
>
>> So, I think I should not remove CsrThread.
>> If there is anything I missed or wrong, Please let me know.
>
> No, you are right, this can't be removed just yet, so all is good.
>
> If you want to send more patches cleaning stuff up like this one, that
> would be great.
>
> thanks,
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 16/16 v2] f2fs: update Kconfig and Makefile

2012-10-22 Thread Greg KH
On Tue, Oct 23, 2012 at 11:33:28AM +0900, Jaegeuk Kim wrote:
> +config F2FS_STAT_FS
> + bool "F2FS Status Information"
> + depends on F2FS_FS
> + default y
> + help
> +   /proc/fs/f2fs/ contains information about partitions mounted as f2fs.
> +   For each partition, a corresponding directory, named as its device
> +   name, is provided with the following proc entries.
> +
> +   f2fs_stat major file system information managed by f2fs currently
> +   f2fs_sit_stat average SIT information about whole segments
> +   f2fs_mem_stat current memory footprint consumed by f2fs
> +
> +   e.g., in /proc/fs/f2fs/sdb1/

Again, I will point out that this should either be in debugfs, or in
/sys/fs/ but it should NOT be in /proc/ at all.

If you need help, I will be glad to do this conversion, just let me know
and I'll send you a patch on top of this series that moves these entries
into debugfs, which is where I think they really belong.

thanks,

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


Re: [PATCH 07/16 v2] f2fs: add segment operations

2012-10-22 Thread Max Filippov
Hi.

Building f2fs for ARM gives the following error:

  CC  fs/f2fs/segment.o
  CC  fs/f2fs/recovery.o
fs/f2fs/segment.c: In function 'build_sit_info':
fs/f2fs/segment.c:1399:2: error: implicit declaration of function 'vzalloc' 
[-Werror=implicit-function-declaration]
fs/f2fs/segment.c:1399:18: warning: assignment makes pointer from integer 
without a cast [enabled by default]
fs/f2fs/segment.c:1419:22: warning: assignment makes pointer from integer 
without a cast [enabled by default]
fs/f2fs/segment.c: In function 'destroy_sit_info':
fs/f2fs/segment.c:1777:2: error: implicit declaration of function 'vfree' 
[-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

The following fixes that:

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 57d0931..5bab838 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "f2fs.h"
 #include "segment.h"

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


Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6

2012-10-22 Thread Benjamin Herrenschmidt
On Mon, 2012-10-22 at 18:23 +0200, Michael Kerrisk (man-pages) wrote:
> Since PowerPC already allows 16GB page sizes, doesn't there need to be
> allowance for the possibility of future expansion? Choosing a larger
> minimum size (like 2^16) would allow that. Does the minimum size need
> to be 16k? (Surely, if you want a HUGEPAGE, you want a bigger page
> than that? I am not sure.)

I can't say for sure what we're going to come up with in 5 years but so
far, I am not aware of plans to go beyond 16G just yet :-)

Cheers,
Ben.


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


Re: [PATCH v2 1/2] Replace if statement with WARN_ON_ONCE() in cmci_rediscover().

2012-10-22 Thread Tang Chen

On 10/22/2012 06:14 PM, Borislav Petkov wrote:

On Mon, Oct 22, 2012 at 10:10:24AM +0800, Tang Chen wrote:

I don't why before we just jumped over it. But I think if we have an
online cpu == dying here, it must be wrong. So I think we should warn
it, not just jump over it.


Why do we need to warn? What good would that bring us?

AFAICT, the check in cmci_rediscover is there to make sure we absolutely
don't rediscover on the dying cpu. I think it is a safety precaution in
concurrency scenarios between cpu hotplug and mce code.


Well, I see. I dropped the if statement. :)

So, how about warn once, and continue:
if (cpu == dying) {
WARN_ON_ONCE(cpu == dying);
continue;
}

or, use BUG_ON() instead ?



Thanks.



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


Re: [PATCH] staging: csr: fix coding style

2012-10-22 Thread Greg KH
On Tue, Oct 23, 2012 at 11:41:06AM +0900, SeongJae Park wrote:
> Hello,
> 
> 
> I think it was my mistake.
> 
> CsrThread is enclosed by macro #ifdef __KERNEL__
> and it used by csr_framework_ext.h as CsrThreadHandle type(typedef
> used at csr_framework_ext_types.h).
> 
> I think that's why I didn't see build failure.

When building the driver __KERNEL__ is defined :)

> So, I think I should not remove CsrThread.
> If there is anything I missed or wrong, Please let me know.

No, you are right, this can't be removed just yet, so all is good.

If you want to send more patches cleaning stuff up like this one, that
would be great.

thanks,

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


Re: [PATCH] staging: csr: fix coding style

2012-10-22 Thread SeongJae Park
Hello,


I think it was my mistake.

CsrThread is enclosed by macro #ifdef __KERNEL__
and it used by csr_framework_ext.h as CsrThreadHandle type(typedef
used at csr_framework_ext_types.h).

I think that's why I didn't see build failure.

So, I think I should not remove CsrThread.
If there is anything I missed or wrong, Please let me know.


Thnks and Regards.
SeongJae Park.

On Tue, Oct 23, 2012 at 11:13 AM, SeongJae Park  wrote:
> Hello,
>
>
> Thank you very much for your kindness, Greg.
>
> I tried to reply to email-list when I received Lauri's email, but I
> coudln't because my gmail service has some problems.
>
> I'm still newbie, sorry.
>
> I will send new patch that removes whole struct, as soon as
> possible(maybe 4~5 hours later).
>
>
> Thanks and Regards.
> SeongJae Park.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-10-22 Thread Lucas De Marchi
On Mon, Oct 22, 2012 at 5:39 AM, Rusty Russell  wrote:
> "Michael Kerrisk (man-pages)"  writes:
>>> FIX: add flags arg to sys_finit_module()
>>>
>>> Thanks to Michael Kerrisk for keeping us honest.
>>
>> w00t! Thanks, Rusty ;-).
>>
>> Acked-by: Michael Kerrisk 
>
> Here's the version I ended up with when I added two flags.
>
> Lucas, is this useful to you?
>
> BTW Michael: why aren't the syscall man pages in the kernel source?
>
> Thanks,
> Rusty.
>
> module: add flags arg to sys_finit_module()
>
> Thanks to Michael Kerrisk for keeping us honest.  These flags are actually
> useful for eliminating the only case where kmod has to mangle a module's
> internals: for overriding module versioning.
>
> Signed-off-by: Rusty Russell 
>
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 32bc035..8cf7b50 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -868,5 +868,5 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
>
>  asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
>  unsigned long idx1, unsigned long idx2);
> -asmlinkage long sys_finit_module(int fd, const char __user *uargs);
> +asmlinkage long sys_finit_module(int fd, const char __user *uargs, int 
> flags);
>  #endif
> diff --git a/include/uapi/linux/module.h b/include/uapi/linux/module.h
> new file mode 100644
> index 000..38da425
> --- /dev/null
> +++ b/include/uapi/linux/module.h
> @@ -0,0 +1,8 @@
> +#ifndef _UAPI_LINUX_MODULE_H
> +#define _UAPI_LINUX_MODULE_H
> +
> +/* Flags for sys_finit_module: */
> +#define MODULE_INIT_IGNORE_MODVERSIONS 1
> +#define MODULE_INIT_IGNORE_VERMAGIC2
> +
> +#endif /* _UAPI_LINUX_MODULE_H */
> diff --git a/kernel/module.c b/kernel/module.c
> index 261bf82..55b49cd 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -61,6 +61,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "module-internal.h"
>
>  #define CREATE_TRACE_POINTS
> @@ -2569,7 +2570,7 @@ static void free_copy(struct load_info *info)
> vfree(info->hdr);
>  }
>
> -static int rewrite_section_headers(struct load_info *info)
> +static int rewrite_section_headers(struct load_info *info, int flags)
>  {
> unsigned int i;
>
> @@ -2597,7 +2598,10 @@ static int rewrite_section_headers(struct load_info 
> *info)
> }
>
> /* Track but don't keep modinfo and version sections. */
> -   info->index.vers = find_sec(info, "__versions");
> +   if (flags & MODULE_INIT_IGNORE_MODVERSIONS)
> +   info->index.vers = 0; /* Pretend no __versions section! */
> +   else
> +   info->index.vers = find_sec(info, "__versions");
> info->index.info = find_sec(info, ".modinfo");
> info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC;
> info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC;
> @@ -2612,7 +2617,7 @@ static int rewrite_section_headers(struct load_info 
> *info)
>   * Return the temporary module pointer (we'll replace it with the final
>   * one when we move the module sections around).
>   */
> -static struct module *setup_load_info(struct load_info *info)
> +static struct module *setup_load_info(struct load_info *info, int flags)
>  {
> unsigned int i;
> int err;
> @@ -2623,7 +2628,7 @@ static struct module *setup_load_info(struct load_info 
> *info)
> info->secstrings = (void *)info->hdr
> + info->sechdrs[info->hdr->e_shstrndx].sh_offset;
>
> -   err = rewrite_section_headers(info);
> +   err = rewrite_section_headers(info, flags);
> if (err)
> return ERR_PTR(err);
>
> @@ -2661,11 +2666,14 @@ static struct module *setup_load_info(struct 
> load_info *info)
> return mod;
>  }
>
> -static int check_modinfo(struct module *mod, struct load_info *info)
> +static int check_modinfo(struct module *mod, struct load_info *info, int 
> flags)
>  {
> const char *modmagic = get_modinfo(info, "vermagic");
> int err;
>
> +   if (flags & MODULE_INIT_IGNORE_VERMAGIC)
> +   modmagic = NULL;
> +
> /* This is allowed: modprobe --force will invalidate it. */
> if (!modmagic) {
> err = try_to_force_load(mod, "bad vermagic");
> @@ -2901,18 +2909,18 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
> return 0;
>  }
>
> -static struct module *layout_and_allocate(struct load_info *info)
> +static struct module *layout_and_allocate(struct load_info *info, int flags)
>  {
> /* Module within temporary copy. */
> struct module *mod;
> Elf_Shdr *pcpusec;
> int err;
>
> -   mod = setup_load_info(info);
> +   mod = setup_load_info(info, flags);
> if (IS_ERR(mod))
> return mod;
>
> -   err = check_modinfo(mod, info);
> +   err = check_modinfo(mod, info, flags);
> if (err)
> return ERR_PTR(err);
>
> @@ -3094,7 +3102,8 @@ 

Re: [PATCH 0/1] staging: Add firewire-serial driver

2012-10-22 Thread Peter Hurley
On Mon, 2012-10-22 at 15:45 -0700, Greg Kroah-Hartman wrote:
> On Thu, Oct 18, 2012 at 08:56:55AM -0400, Peter Hurley wrote:
> > Please consider this serial driver for review for submission to staging.
> > The firewire-serial driver implements TTY over IEEE 1394. In its default
> > configuration, it creates 4 TTY devices and one loopback device per
> > firewire card (respectively, named fwtty~fwtty and fwloop).
> > 
> > Currently, the TTY devices auto-connect to every cabled peer (the TODO
> > list includes plans for providing a sysfs interface to control virtual
> > cabling with whitelist/blacklist support per GUID).
> > 
> > Efforts are still ongoing for a companion console driver, with plans to
> > eventually add early_printk & kgdb support (via additional drivers).
> > 
> > Some issues did arise with both the TTY and Firewire subsystems which
> > are noted in the TODO file. Please review these workarounds.
> > 
> > Peter Hurley (1):
> >   staging: fwserial: Add TTY-over-Firewire serial driver
> 
> I'd like to get an Ack from Stefan here, before I'll add this to the
> staging tree.

Of course.

Jiri's newest series ("TTY buffer in tty_port and other stuff") does
break this driver, so I'll need to resubmit to address those changes.
Two of the workarounds mentioned in the TODO are related to the
tty_buffer interface; specifically,

1. The ldisc drops the contents of tty_buffer on hangup (rather than
waiting for completion). Maybe for other devices this isn't so
noticeable because the ldisc can mostly keep up with the device, but on
firewire the ldisc lags well behind. Right now, this driver works around
this by holding off the hangup until the ldisc empties the tty_buffer.
The driver determines how much data is still left in the tty_buffer by
walking the flip buffers.

2. Because this driver can fill the entire tty_buffer (64K +) before the
ldisc even runs once, this driver has to self-throttle when feeding the
tty_buffer. So as not to drop data, the driver has to know when a
watermark is reached in the tty_buffer, to ensure that in-flight +
already-accepted data can safely be moved to what remains avail in the
tty_buffer. (The tty_buffer maxs at 64K). Currently, the avail level in
the tty_buffer is computed by this driver (in the same manner as
tty_buffer_alloc()).

Eventually, I'd like to move these changes into tty_buffer but I wanted
to present the use case first.

Regards,
Peter Hurley

--
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 16/16 v2] f2fs: update Kconfig and Makefile

2012-10-22 Thread Jaegeuk Kim
This adds Makefile and Kconfig for f2fs, and updates Makefile and Kconfig files
in the fs directory.

Signed-off-by: Jaegeuk Kim 
---
 fs/Kconfig   |1 +
 fs/Makefile  |1 +
 fs/f2fs/Kconfig  |   55 ++
 fs/f2fs/Makefile |6 ++
 4 files changed, 63 insertions(+)
 create mode 100644 fs/f2fs/Kconfig
 create mode 100644 fs/f2fs/Makefile

diff --git a/fs/Kconfig b/fs/Kconfig
index f95ae3a..e352b37 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -220,6 +220,7 @@ source "fs/pstore/Kconfig"
 source "fs/sysv/Kconfig"
 source "fs/ufs/Kconfig"
 source "fs/exofs/Kconfig"
+source "fs/f2fs/Kconfig"
 
 endif # MISC_FILESYSTEMS
 
diff --git a/fs/Makefile b/fs/Makefile
index 1d7af79..9d53192 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -123,6 +123,7 @@ obj-$(CONFIG_DEBUG_FS)  += debugfs/
 obj-$(CONFIG_OCFS2_FS) += ocfs2/
 obj-$(CONFIG_BTRFS_FS) += btrfs/
 obj-$(CONFIG_GFS2_FS)   += gfs2/
+obj-$(CONFIG_F2FS_FS)  += f2fs/
 obj-y  += exofs/ # Multiple modules
 obj-$(CONFIG_CEPH_FS)  += ceph/
 obj-$(CONFIG_PSTORE)   += pstore/
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig
new file mode 100644
index 000..8821c6a
--- /dev/null
+++ b/fs/f2fs/Kconfig
@@ -0,0 +1,55 @@
+config F2FS_FS
+   tristate "F2FS filesystem support (EXPERIMENTAL)"
+   depends on EXPERIMENTAL
+   help
+ F2FS is based on Log-structured File System (LFS), which supports
+ versatile "flash-friendly" features. The design has been focused on
+ addressing the fundamental issues in LFS, which are snowball effect
+ of wandering tree and high cleaning overhead.
+
+ Since flash-based storages show different characteristics according to
+ the internal geometry or flash memory management schemes aka FTL, F2FS
+ and tools support various parameters not only for configuring on-disk
+ layout, but also for selecting allocation and cleaning algorithms.
+
+ If unsure, say N.
+
+config F2FS_STAT_FS
+   bool "F2FS Status Information"
+   depends on F2FS_FS
+   default y
+   help
+ /proc/fs/f2fs/ contains information about partitions mounted as f2fs.
+ For each partition, a corresponding directory, named as its device
+ name, is provided with the following proc entries.
+
+ f2fs_stat major file system information managed by f2fs currently
+ f2fs_sit_stat average SIT information about whole segments
+ f2fs_mem_stat current memory footprint consumed by f2fs
+
+ e.g., in /proc/fs/f2fs/sdb1/
+
+config F2FS_FS_XATTR
+   bool "F2FS extended attributes"
+   depends on F2FS_FS
+   default y
+   help
+ Extended attributes are name:value pairs associated with inodes by
+ the kernel or by users (see the attr(5) manual page, or visit
+  for details).
+
+ If unsure, say N.
+
+config F2FS_FS_POSIX_ACL
+   bool "F2FS Access Control Lists"
+   depends on F2FS_FS_XATTR
+   select FS_POSIX_ACL
+   default y
+   help
+ Posix Access Control Lists (ACLs) support permissions for users and
+ gourps beyond the owner/group/world scheme.
+
+ To learn more about Access Control Lists, visit the POSIX ACLs for
+ Linux website .
+
+ If you don't know what Access Control Lists are, say N
diff --git a/fs/f2fs/Makefile b/fs/f2fs/Makefile
new file mode 100644
index 000..72fcf9a
--- /dev/null
+++ b/fs/f2fs/Makefile
@@ -0,0 +1,6 @@
+obj-$(CONFIG_F2FS_FS) += f2fs.o
+
+f2fs-y := dir.o file.o inode.o namei.o hash.o super.o
+f2fs-y += checkpoint.o gc.o data.o node.o segment.o recovery.o
+f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o
+f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o
-- 
1.7.9.5




---
Jaegeuk Kim
Samsung



--
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 15/16 v2] f2fs: add recovery routines for roll-forward

2012-10-22 Thread Jaegeuk Kim
This adds roll-forward routines to recover fsynced data.

- F2FS uses basically roll-back model with checkpointing.

- In order to implement fsync(), there are two approaches as follows.

1. A roll-back model with checkpointing at every fsync()
 : This is a naive method, but suffers from very low performance.

2. A roll-forward model
 : F2FS adopts this model where all the fsynced data should be recovered, which
   were written after checkpointing was done. In order to figure out the data,
   F2FS keeps a "fsync" mark in direct node blocks. In addition, F2FS remains
   the location of next node block in each direct node block for reconstructing
   the chain of node blocks during the recovery.

- In order to enhance the performance, F2FS keeps a "dentry" mark also in direct
  node blocks. If this is set during the recovery, F2FS replays adding a dentry.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/recovery.c |  375 
 1 file changed, 375 insertions(+)
 create mode 100644 fs/f2fs/recovery.c

diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
new file mode 100644
index 000..59b6331
--- /dev/null
+++ b/fs/f2fs/recovery.c
@@ -0,0 +1,375 @@
+/**
+ * fs/f2fs/recovery.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+
+static struct kmem_cache *fsync_entry_slab;
+
+bool space_for_roll_forward(struct f2fs_sb_info *sbi)
+{
+   if (sbi->last_valid_block_count + sbi->alloc_valid_block_count
+   > sbi->user_block_count)
+   return false;
+   return true;
+}
+
+static struct fsync_inode_entry *get_fsync_inode(struct list_head *head,
+   nid_t ino)
+{
+   struct list_head *this;
+   struct fsync_inode_entry *entry;
+
+   list_for_each(this, head) {
+   entry = list_entry(this, struct fsync_inode_entry, list);
+   if (entry->inode->i_ino == ino)
+   return entry;
+   }
+   return NULL;
+}
+
+static int recover_dentry(struct page *ipage, struct inode *inode)
+{
+   struct f2fs_node *raw_node = (struct f2fs_node *)kmap(ipage);
+   struct f2fs_inode *raw_inode = &(raw_node->i);
+   struct dentry dent, parent;
+   struct f2fs_dir_entry *de;
+   struct page *page;
+   struct inode *dir;
+   int err = 0;
+
+   if (!is_dent_dnode(ipage))
+   goto out;
+
+   dir = f2fs_iget(inode->i_sb, le32_to_cpu(raw_inode->i_pino));
+   if (IS_ERR(dir)) {
+   err = -EINVAL;
+   goto out;
+   }
+
+   parent.d_inode = dir;
+   dent.d_parent = 
+   dent.d_name.len = le32_to_cpu(raw_inode->i_namelen);
+   dent.d_name.name = raw_inode->i_name;
+
+   de = f2fs_find_entry(dir, _name, );
+   if (de) {
+   kunmap(page);
+   f2fs_put_page(page, 0);
+   } else {
+   f2fs_add_link(, inode);
+   }
+   iput(dir);
+out:
+   kunmap(ipage);
+   return err;
+}
+
+static int recover_inode(struct inode *inode, struct page *node_page)
+{
+   void *kaddr = page_address(node_page);
+   struct f2fs_node *raw_node = (struct f2fs_node *)kaddr;
+   struct f2fs_inode *raw_inode = &(raw_node->i);
+
+   inode->i_mode = le32_to_cpu(raw_inode->i_mode);
+   i_size_write(inode, le64_to_cpu(raw_inode->i_size));
+   inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
+   inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime);
+   inode->i_mtime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
+   inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
+   inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec);
+   inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
+
+   return recover_dentry(node_page, inode);
+}
+
+static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
+{
+   unsigned long long cp_ver = le64_to_cpu(sbi->ckpt->checkpoint_ver);
+   struct curseg_info *curseg;
+   struct page *page;
+   block_t blkaddr;
+   int err = 0;
+
+   /* get node pages in the current segment */
+   curseg = CURSEG_I(sbi, CURSEG_WARM_NODE);
+   blkaddr = START_BLOCK(sbi, curseg->segno) + curseg->next_blkoff;
+
+   /* read node page */
+   page = alloc_page(GFP_NOFS | __GFP_ZERO);
+   if (IS_ERR(page))
+   return PTR_ERR(page);
+   lock_page(page);
+
+   while (1) {
+   struct fsync_inode_entry *entry;
+
+   if (f2fs_readpage(sbi, page, blkaddr, READ_SYNC))
+   goto out;
+
+   if 

[PATCH 14/16 v2] f2fs: add garbage collection functions

2012-10-22 Thread Jaegeuk Kim
This adds on-demand and background cleaning functions.

- The basic background cleaning policy is trying to do cleaning jobs as much as
  possible whenever the system is idle. Once the background cleaning is done,
  the cleaner sleeps an amount of time not to interfere with VFS calls. The time
  is dynamically adjusted according to the status of whole segments, which is
  decreased when the following conditions are satisfied.

  . GC is not conducted currently, and
  . IO subsystem is idle by checking the number of requets in bdev's request
 list, and
  . There are enough dirty segments.

  Otherwise, the time is increased incrementally until to the maximum time.
  Note that, min and max times are 10 secs and 30 secs by default.

- F2FS adopts a default victim selection policy where background cleaning uses
  a cost-benefit algorithm, while on-demand cleaning uses a greedy algorithm.

- The method of moving data during the cleaning is slightly different between
  background and on-demand cleaning schemes. In the case of background cleaning,
  F2FS loads the data, and marks them as dirty. Then, F2FS expects that the data
  will be moved by flusher or VM. In the case of on-demand cleaning, F2FS should
  move the data right away.

- In order to identify valid blocks in a victim segment, F2FS scans the bitmap
  of the segment managed as an SIT entry.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/gc.c | 1139 ++
 fs/f2fs/gc.h |  203 +++
 2 files changed, 1342 insertions(+)
 create mode 100644 fs/f2fs/gc.c
 create mode 100644 fs/f2fs/gc.h

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
new file mode 100644
index 000..753b05e
--- /dev/null
+++ b/fs/f2fs/gc.c
@@ -0,0 +1,1139 @@
+/**
+ * fs/f2fs/gc.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+#include "gc.h"
+
+static LIST_HEAD(f2fs_stat_list);
+static struct kmem_cache *winode_slab;
+
+static int gc_thread_func(void *data)
+{
+   struct f2fs_sb_info *sbi = data;
+   wait_queue_head_t *wq = >gc_thread->gc_wait_queue_head;
+   long wait_ms;
+
+   wait_ms = GC_THREAD_MIN_SLEEP_TIME;
+
+   do {
+   if (try_to_freeze())
+   continue;
+   else
+   wait_event_interruptible_timeout(*wq,
+   kthread_should_stop(),
+   msecs_to_jiffies(wait_ms));
+   if (kthread_should_stop())
+   break;
+
+   f2fs_balance_fs(sbi);
+
+   if (!test_opt(sbi, BG_GC))
+   continue;
+
+   /*
+* [GC triggering condition]
+* 0. GC is not conducted currently.
+* 1. There are enough dirty segments.
+* 2. IO subsystem is idle by checking the # of writeback pages.
+* 3. IO subsystem is idle by checking the # of requests in
+*bdev's request list.
+*
+* Note) We have to avoid triggering GCs too much frequently.
+* Because it is possible that some segments can be
+* invalidated soon after by user update or deletion.
+* So, I'd like to wait some time to collect dirty segments.
+*/
+   if (!mutex_trylock(>gc_mutex))
+   continue;
+
+   if (!is_idle(sbi)) {
+   wait_ms = increase_sleep_time(wait_ms);
+   mutex_unlock(>gc_mutex);
+   continue;
+   }
+
+   if (has_enough_invalid_blocks(sbi))
+   wait_ms = decrease_sleep_time(wait_ms);
+   else
+   wait_ms = increase_sleep_time(wait_ms);
+
+   sbi->bg_gc++;
+
+   if (f2fs_gc(sbi, 1) == GC_NONE)
+   wait_ms = GC_THREAD_NOGC_SLEEP_TIME;
+   else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME)
+   wait_ms = GC_THREAD_MAX_SLEEP_TIME;
+
+   } while (!kthread_should_stop());
+   return 0;
+}
+
+int start_gc_thread(struct f2fs_sb_info *sbi)
+{
+   struct f2fs_gc_kthread *gc_th = NULL;
+
+   gc_th = kmalloc(sizeof(struct f2fs_gc_kthread), GFP_KERNEL);
+   if (!gc_th)
+   return -ENOMEM;
+
+   sbi->gc_thread = gc_th;
+   init_waitqueue_head(>gc_thread->gc_wait_queue_head);
+   sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi,
+   

[PATCH 13/16 v2] f2fs: add xattr and acl functionalities

2012-10-22 Thread Jaegeuk Kim
This implements xattr and acl functionalities.

- F2FS uses a node page to contain use extended attributes.

Signed-off-by: Changman Lee 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/acl.c   |  465 +++
 fs/f2fs/acl.h   |   57 +++
 fs/f2fs/xattr.c |  389 ++
 fs/f2fs/xattr.h |  145 +
 4 files changed, 1056 insertions(+)
 create mode 100644 fs/f2fs/acl.c
 create mode 100644 fs/f2fs/acl.h
 create mode 100644 fs/f2fs/xattr.c
 create mode 100644 fs/f2fs/xattr.h

diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
new file mode 100644
index 000..dff2a2b
--- /dev/null
+++ b/fs/f2fs/acl.c
@@ -0,0 +1,465 @@
+/**
+ * fs/f2fs/acl.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * Portions of this code from linux/fs/ext2/acl.c
+ *
+ * Copyright (C) 2001-2003 Andreas Gruenbacher, 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include "f2fs.h"
+#include "xattr.h"
+#include "acl.h"
+
+#define get_inode_mode(i)  ((is_inode_flag_set(F2FS_I(i), FI_ACL_MODE)) ? \
+   (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
+
+static inline size_t f2fs_acl_size(int count)
+{
+   if (count <= 4) {
+   return sizeof(struct f2fs_acl_header) +
+   count * sizeof(struct f2fs_acl_entry_short);
+   } else {
+   return sizeof(struct f2fs_acl_header) +
+   4 * sizeof(struct f2fs_acl_entry_short) +
+   (count - 4) * sizeof(struct f2fs_acl_entry);
+   }
+}
+
+static inline int f2fs_acl_count(size_t size)
+{
+   ssize_t s;
+   size -= sizeof(struct f2fs_acl_header);
+   s = size - 4 * sizeof(struct f2fs_acl_entry_short);
+   if (s < 0) {
+   if (size % sizeof(struct f2fs_acl_entry_short))
+   return -1;
+   return size / sizeof(struct f2fs_acl_entry_short);
+   } else {
+   if (s % sizeof(struct f2fs_acl_entry))
+   return -1;
+   return s / sizeof(struct f2fs_acl_entry) + 4;
+   }
+}
+
+static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size)
+{
+   int i, count;
+   struct posix_acl *acl;
+   struct f2fs_acl_header *hdr = (struct f2fs_acl_header *)value;
+   struct f2fs_acl_entry *entry = (struct f2fs_acl_entry *)(hdr + 1);
+   const char *end = value + size;
+
+   if (hdr->a_version != cpu_to_le32(F2FS_ACL_VERSION))
+   return ERR_PTR(-EINVAL);
+
+   count = f2fs_acl_count(size);
+   if (count < 0)
+   return ERR_PTR(-EINVAL);
+   if (count == 0)
+   return NULL;
+
+   acl = posix_acl_alloc(count, GFP_KERNEL);
+   if (!acl)
+   return ERR_PTR(-ENOMEM);
+
+   for (i = 0; i < count; i++) {
+
+   if ((char *)entry > end)
+   goto fail;
+
+   acl->a_entries[i].e_tag  = le16_to_cpu(entry->e_tag);
+   acl->a_entries[i].e_perm = le16_to_cpu(entry->e_perm);
+
+   switch (acl->a_entries[i].e_tag) {
+   case ACL_USER_OBJ:
+   case ACL_GROUP_OBJ:
+   case ACL_MASK:
+   case ACL_OTHER:
+   acl->a_entries[i].e_id = ACL_UNDEFINED_ID;
+   entry = (struct f2fs_acl_entry *)((char *)entry +
+   sizeof(struct f2fs_acl_entry_short));
+   break;
+
+   case ACL_USER:
+   acl->a_entries[i].e_uid =
+   make_kuid(_user_ns,
+   le32_to_cpu(entry->e_id));
+   entry = (struct f2fs_acl_entry *)((char *)entry +
+   sizeof(struct f2fs_acl_entry));
+   break;
+   case ACL_GROUP:
+   acl->a_entries[i].e_gid =
+   make_kgid(_user_ns,
+   le32_to_cpu(entry->e_id));
+   entry = (struct f2fs_acl_entry *)((char *)entry +
+   sizeof(struct f2fs_acl_entry));
+   break;
+   default:
+   goto fail;
+   }
+   }
+   if ((char *)entry != end)
+   goto fail;
+   return acl;
+fail:
+   posix_acl_release(acl);
+   return ERR_PTR(-EINVAL);
+}
+
+static void *f2fs_acl_to_disk(const struct posix_acl *acl, size_t *size)
+{
+   struct f2fs_acl_header *f2fs_acl;
+   struct f2fs_acl_entry *entry;
+   int i;
+
+   f2fs_acl = kmalloc(sizeof(struct f2fs_acl_header) + 

[PATCH 12/16 v2] f2fs: add core directory operations

2012-10-22 Thread Jaegeuk Kim
This adds core functions to find, add, delete, and link dentries.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/dir.c  |  657 
 fs/f2fs/hash.c |   98 +
 2 files changed, 755 insertions(+)
 create mode 100644 fs/f2fs/dir.c
 create mode 100644 fs/f2fs/hash.c

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
new file mode 100644
index 000..f3de333
--- /dev/null
+++ b/fs/f2fs/dir.c
@@ -0,0 +1,657 @@
+/**
+ * fs/f2fs/dir.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include "f2fs.h"
+#include "acl.h"
+
+static unsigned long dir_blocks(struct inode *inode)
+{
+   return ((unsigned long long) (i_size_read(inode) + PAGE_CACHE_SIZE - 1))
+   >> PAGE_CACHE_SHIFT;
+}
+
+static unsigned int dir_buckets(unsigned int level)
+{
+   if (level < MAX_DIR_HASH_DEPTH / 2)
+   return 1 << level;
+   else
+   return 1 << ((MAX_DIR_HASH_DEPTH / 2) - 1);
+}
+
+static unsigned int bucket_blocks(unsigned int level)
+{
+   if (level < MAX_DIR_HASH_DEPTH / 2)
+   return 2;
+   else
+   return 4;
+}
+
+static unsigned char f2fs_filetype_table[F2FS_FT_MAX] = {
+   [F2FS_FT_UNKNOWN]   = DT_UNKNOWN,
+   [F2FS_FT_REG_FILE]  = DT_REG,
+   [F2FS_FT_DIR]   = DT_DIR,
+   [F2FS_FT_CHRDEV]= DT_CHR,
+   [F2FS_FT_BLKDEV]= DT_BLK,
+   [F2FS_FT_FIFO]  = DT_FIFO,
+   [F2FS_FT_SOCK]  = DT_SOCK,
+   [F2FS_FT_SYMLINK]   = DT_LNK,
+};
+
+#define S_SHIFT 12
+static unsigned char f2fs_type_by_mode[S_IFMT >> S_SHIFT] = {
+   [S_IFREG >> S_SHIFT]= F2FS_FT_REG_FILE,
+   [S_IFDIR >> S_SHIFT]= F2FS_FT_DIR,
+   [S_IFCHR >> S_SHIFT]= F2FS_FT_CHRDEV,
+   [S_IFBLK >> S_SHIFT]= F2FS_FT_BLKDEV,
+   [S_IFIFO >> S_SHIFT]= F2FS_FT_FIFO,
+   [S_IFSOCK >> S_SHIFT]   = F2FS_FT_SOCK,
+   [S_IFLNK >> S_SHIFT]= F2FS_FT_SYMLINK,
+};
+
+static void set_de_type(struct f2fs_dir_entry *de, struct inode *inode)
+{
+   mode_t mode = inode->i_mode;
+   de->file_type = f2fs_type_by_mode[(mode & S_IFMT) >> S_SHIFT];
+}
+
+static unsigned long dir_block_index(unsigned int level, unsigned int idx)
+{
+   unsigned long i;
+   unsigned long bidx = 0;
+
+   for (i = 0; i < level; i++)
+   bidx += dir_buckets(i) * bucket_blocks(i);
+   bidx += idx * bucket_blocks(level);
+   return bidx;
+}
+
+static bool early_match_name(const char *name, int namelen,
+   f2fs_hash_t namehash, struct f2fs_dir_entry *de)
+{
+   if (le16_to_cpu(de->name_len) != namelen)
+   return false;
+
+   if (le32_to_cpu(de->hash_code) != namehash)
+   return false;
+
+   return true;
+}
+
+static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
+   const char *name, int namelen, int *max_slots,
+   f2fs_hash_t namehash, struct page **res_page)
+{
+   struct f2fs_dir_entry *de;
+   unsigned long bit_pos, end_pos, next_pos;
+   struct f2fs_dentry_block *dentry_blk = kmap(dentry_page);
+   int slots;
+
+   bit_pos = find_next_bit_le(_blk->dentry_bitmap,
+   NR_DENTRY_IN_BLOCK, 0);
+   while (bit_pos < NR_DENTRY_IN_BLOCK) {
+   de = _blk->dentry[bit_pos];
+   slots = (le16_to_cpu(de->name_len) + F2FS_NAME_LEN - 1) /
+   F2FS_NAME_LEN;
+
+   if (early_match_name(name, namelen, namehash, de)) {
+   if (!memcmp(dentry_blk->filename[bit_pos],
+   name, namelen)) {
+   *res_page = dentry_page;
+   goto found;
+   }
+   }
+   next_pos = bit_pos + slots;
+   bit_pos = find_next_bit_le(_blk->dentry_bitmap,
+   NR_DENTRY_IN_BLOCK, next_pos);
+   if (bit_pos >= NR_DENTRY_IN_BLOCK)
+   end_pos = NR_DENTRY_IN_BLOCK;
+   else
+   end_pos = bit_pos;
+   if (*max_slots < end_pos - next_pos)
+   *max_slots = end_pos - next_pos;
+   }
+
+   de = NULL;
+   kunmap(dentry_page);
+found:
+   return de;
+}
+
+static struct f2fs_dir_entry *find_in_level(struct inode *dir,
+   unsigned int level, const char *name, int namelen,
+   f2fs_hash_t namehash, struct page **res_page)
+{
+   int s = (namelen + F2FS_NAME_LEN - 1) / 

[PATCH 11/16 v2] f2fs: add inode operations for special inodes

2012-10-22 Thread Jaegeuk Kim
This adds inode operations for directory, symlink, and special inodes.

Signed-off-by: Changman Lee 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/namei.c |  494 +++
 1 file changed, 494 insertions(+)
 create mode 100644 fs/f2fs/namei.c

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
new file mode 100644
index 000..899d144
--- /dev/null
+++ b/fs/f2fs/namei.c
@@ -0,0 +1,494 @@
+/**
+ * fs/f2fs/namei.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "xattr.h"
+#include "acl.h"
+
+static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
+{
+   struct super_block *sb = dir->i_sb;
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   nid_t ino;
+   struct inode *inode;
+   bool nid_free = false;
+   int err;
+
+   inode = new_inode(sb);
+   if (!inode)
+   return ERR_PTR(-ENOMEM);
+
+   mutex_lock_op(sbi, NODE_NEW);
+   if (!alloc_nid(sbi, )) {
+   mutex_unlock_op(sbi, NODE_NEW);
+   err = -ENOSPC;
+   goto fail;
+   }
+   mutex_unlock_op(sbi, NODE_NEW);
+
+   inode->i_uid = current_fsuid();
+
+   if (dir->i_mode & S_ISGID) {
+   inode->i_gid = dir->i_gid;
+   if (S_ISDIR(mode))
+   mode |= S_ISGID;
+   } else {
+   inode->i_gid = current_fsgid();
+   }
+
+   inode->i_ino = ino;
+   inode->i_mode = mode;
+   inode->i_blocks = 0;
+   inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+
+   err = insert_inode_locked(inode);
+   if (err) {
+   err = -EINVAL;
+   nid_free = true;
+   goto out;
+   }
+
+   mark_inode_dirty(inode);
+   return inode;
+
+out:
+   clear_nlink(inode);
+   unlock_new_inode(inode);
+fail:
+   iput(inode);
+   if (nid_free)
+   alloc_nid_failed(sbi, ino);
+   return ERR_PTR(err);
+}
+
+static int is_multimedia_file(const unsigned char *s, const char *sub)
+{
+   int slen = strlen(s);
+   int sublen = strlen(sub);
+   int ret;
+
+   if (sublen > slen)
+   return 1;
+
+   ret = memcmp(s + slen - sublen, sub, sublen);
+   if (ret) {  /* compare upper case */
+   int i;
+   char upper_sub[8];
+   for (i = 0; i < sublen && i < sizeof(upper_sub); i++)
+   upper_sub[i] = toupper(sub[i]);
+   return memcmp(s + slen - sublen, upper_sub, sublen);
+   }
+
+   return ret;
+}
+
+/**
+ * Set multimedia files as cold files for hot/cold data separation
+ */
+static inline void set_cold_file(struct f2fs_sb_info *sbi, struct inode *inode,
+   const unsigned char *name)
+{
+   int i;
+   __u8 (*extlist)[8] = sbi->raw_super->extension_list;
+
+   int count = le32_to_cpu(sbi->raw_super->extension_count);
+   for (i = 0; i < count; i++) {
+   if (!is_multimedia_file(name, extlist[i])) {
+   F2FS_I(inode)->i_advise |= FADVISE_COLD_BIT;
+   break;
+   }
+   }
+}
+
+static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
+   bool excl)
+{
+   struct super_block *sb = dir->i_sb;
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   struct inode *inode;
+   nid_t ino = 0;
+   int err;
+
+   inode = f2fs_new_inode(dir, mode);
+   if (IS_ERR(inode))
+   return PTR_ERR(inode);
+
+   if (!test_opt(sbi, DISABLE_EXT_IDENTIFY))
+   set_cold_file(sbi, inode, dentry->d_name.name);
+
+   inode->i_op = _file_inode_operations;
+   inode->i_fop = _file_operations;
+   inode->i_mapping->a_ops = _dblock_aops;
+   ino = inode->i_ino;
+
+   err = f2fs_add_link(dentry, inode);
+   if (err)
+   goto out;
+
+   alloc_nid_done(sbi, ino);
+
+   if (!sbi->por_doing)
+   d_instantiate(dentry, inode);
+   unlock_new_inode(inode);
+
+   f2fs_balance_fs(sbi);
+   return 0;
+out:
+   clear_nlink(inode);
+   unlock_new_inode(inode);
+   iput(inode);
+   alloc_nid_failed(sbi, ino);
+   return err;
+}
+
+static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
+   struct dentry *dentry)
+{
+   struct inode *inode = old_dentry->d_inode;
+   struct super_block *sb = dir->i_sb;
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   int err;
+
+   inode->i_ctime = CURRENT_TIME;
+   atomic_inc(>i_count);
+
+   

[PATCH 10/16 v2] f2fs: add core inode operations

2012-10-22 Thread Jaegeuk Kim
This adds core functions to get, read, write, and evict an inode.

Signed-off-by: Changman Lee 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/inode.c |  262 +++
 1 file changed, 262 insertions(+)
 create mode 100644 fs/f2fs/inode.c

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
new file mode 100644
index 000..0cf61da
--- /dev/null
+++ b/fs/f2fs/inode.c
@@ -0,0 +1,262 @@
+/**
+ * fs/f2fs/inode.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+
+struct f2fs_iget_args {
+   u64 ino;
+   int on_free;
+};
+
+void f2fs_set_inode_flags(struct inode *inode)
+{
+   unsigned int flags = F2FS_I(inode)->i_flags;
+
+   inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE |
+   S_NOATIME | S_DIRSYNC);
+
+   if (flags & FS_SYNC_FL)
+   inode->i_flags |= S_SYNC;
+   if (flags & FS_APPEND_FL)
+   inode->i_flags |= S_APPEND;
+   if (flags & FS_IMMUTABLE_FL)
+   inode->i_flags |= S_IMMUTABLE;
+   if (flags & FS_NOATIME_FL)
+   inode->i_flags |= S_NOATIME;
+   if (flags & FS_DIRSYNC_FL)
+   inode->i_flags |= S_DIRSYNC;
+}
+
+static int f2fs_iget_test(struct inode *inode, void *data)
+{
+   struct f2fs_iget_args *args = data;
+
+   if (inode->i_ino != args->ino)
+   return 0;
+   if (inode->i_state & (I_FREEING | I_WILL_FREE)) {
+   args->on_free = 1;
+   return 0;
+   }
+   return 1;
+}
+
+struct inode *f2fs_iget_nowait(struct super_block *sb, unsigned long ino)
+{
+   struct f2fs_iget_args args = {
+   .ino = ino,
+   .on_free = 0
+   };
+   struct inode *inode = ilookup5(sb, ino, f2fs_iget_test, );
+
+   if (inode)
+   return inode;
+   if (!args.on_free)
+   return f2fs_iget(sb, ino);
+   return ERR_PTR(-ENOENT);
+}
+
+static int do_read_inode(struct inode *inode)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_inode_info *fi = F2FS_I(inode);
+   struct page *node_page;
+   struct f2fs_node *rn;
+   struct f2fs_inode *ri;
+
+   /* Check if ino is within scope */
+   check_nid_range(sbi, inode->i_ino);
+
+   node_page = get_node_page(sbi, inode->i_ino);
+   if (IS_ERR(node_page))
+   return PTR_ERR(node_page);
+
+   rn = page_address(node_page);
+   ri = &(rn->i);
+
+   inode->i_mode = le16_to_cpu(ri->i_mode);
+   i_uid_write(inode, le32_to_cpu(ri->i_uid));
+   i_gid_write(inode, le32_to_cpu(ri->i_gid));
+   set_nlink(inode, le32_to_cpu(ri->i_links));
+   inode->i_size = le64_to_cpu(ri->i_size);
+   inode->i_blocks = le64_to_cpu(ri->i_blocks);
+
+   inode->i_atime.tv_sec = le64_to_cpu(ri->i_mtime);
+   inode->i_ctime.tv_sec = le64_to_cpu(ri->i_ctime);
+   inode->i_mtime.tv_sec = le64_to_cpu(ri->i_mtime);
+   inode->i_atime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec);
+   inode->i_ctime.tv_nsec = le32_to_cpu(ri->i_ctime_nsec);
+   inode->i_mtime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec);
+
+   fi->current_depth = le32_to_cpu(ri->current_depth);
+   fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid);
+   fi->i_flags = le32_to_cpu(ri->i_flags);
+   fi->flags = 0;
+   fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1;
+   fi->i_advise = ri->i_advise;
+   get_extent_info(>ext, ri->i_ext);
+   f2fs_put_page(node_page, 1);
+   return 0;
+}
+
+struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   struct inode *inode;
+   int ret;
+
+   inode = iget_locked(sb, ino);
+   if (!inode)
+   return ERR_PTR(-ENOMEM);
+   if (!(inode->i_state & I_NEW))
+   return inode;
+   if (ino == F2FS_NODE_INO(sbi) || ino == F2FS_META_INO(sbi))
+   goto make_now;
+
+   ret = do_read_inode(inode);
+   if (ret)
+   goto bad_inode;
+
+   if (!sbi->por_doing && inode->i_nlink == 0) {
+   ret = -ENOENT;
+   goto bad_inode;
+   }
+
+make_now:
+   if (ino == F2FS_NODE_INO(sbi)) {
+   inode->i_mapping->a_ops = _node_aops;
+   mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_MOVABLE);
+   } else if (ino == F2FS_META_INO(sbi)) {
+   inode->i_mapping->a_ops = _meta_aops;
+   mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_MOVABLE);
+   } else if (S_ISREG(inode->i_mode)) {
+   inode->i_op = _file_inode_operations;
+   

[PATCH 09/16 v2] f2fs: add address space operations for data

2012-10-22 Thread Jaegeuk Kim
This adds address space operations for data.

- F2FS supports readpages(), writepages(), and direct_IO().

- Because of out-of-place writes, f2fs_direct_IO() does not write data in place.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/data.c |  701 
 1 file changed, 701 insertions(+)
 create mode 100644 fs/f2fs/data.c

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
new file mode 100644
index 000..c2fd0a8
--- /dev/null
+++ b/fs/f2fs/data.c
@@ -0,0 +1,701 @@
+/**
+ * fs/f2fs/data.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+
+/**
+ * Lock ordering for the change of data block address:
+ * ->data_page
+ *  ->node_page
+ *update block addresses in the node page
+ */
+static void __set_data_blkaddr(struct dnode_of_data *dn, block_t new_addr)
+{
+   struct f2fs_node *rn;
+   __le32 *addr_array;
+   struct page *node_page = dn->node_page;
+   unsigned int ofs_in_node = dn->ofs_in_node;
+
+   wait_on_page_writeback(node_page);
+
+   rn = (struct f2fs_node *)page_address(node_page);
+
+   /* Get physical address of data block */
+   addr_array = blkaddr_in_node(rn);
+   addr_array[ofs_in_node] = cpu_to_le32(new_addr);
+   set_page_dirty(node_page);
+}
+
+int reserve_new_block(struct dnode_of_data *dn)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
+
+   if (is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))
+   return -EPERM;
+   if (!inc_valid_block_count(sbi, dn->inode, 1))
+   return -ENOSPC;
+
+   __set_data_blkaddr(dn, NEW_ADDR);
+   dn->data_blkaddr = NEW_ADDR;
+   sync_inode_page(dn);
+   return 0;
+}
+
+static int check_extent_cache(struct inode *inode, pgoff_t pgofs,
+   struct buffer_head *bh_result)
+{
+   struct f2fs_inode_info *fi = F2FS_I(inode);
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   pgoff_t start_fofs, end_fofs;
+   block_t start_blkaddr;
+
+   read_lock(>ext.ext_lock);
+   if (fi->ext.len == 0) {
+   read_unlock(>ext.ext_lock);
+   return 0;
+   }
+
+   sbi->total_hit_ext++;
+   start_fofs = fi->ext.fofs;
+   end_fofs = fi->ext.fofs + fi->ext.len - 1;
+   start_blkaddr = fi->ext.blk_addr;
+
+   if (pgofs >= start_fofs && pgofs <= end_fofs) {
+   unsigned int blkbits = inode->i_sb->s_blocksize_bits;
+   size_t count;
+
+   clear_buffer_new(bh_result);
+   map_bh(bh_result, inode->i_sb,
+   start_blkaddr + pgofs - start_fofs);
+   count = end_fofs - pgofs + 1;
+   if (count < (UINT_MAX >> blkbits))
+   bh_result->b_size = (count << blkbits);
+   else
+   bh_result->b_size = UINT_MAX;
+
+   sbi->read_hit_ext++;
+   read_unlock(>ext.ext_lock);
+   return 1;
+   }
+   read_unlock(>ext.ext_lock);
+   return 0;
+}
+
+void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn)
+{
+   struct f2fs_inode_info *fi = F2FS_I(dn->inode);
+   pgoff_t fofs, start_fofs, end_fofs;
+   block_t start_blkaddr, end_blkaddr;
+
+   BUG_ON(blk_addr == NEW_ADDR);
+   fofs = start_bidx_of_node(ofs_of_node(dn->node_page)) + dn->ofs_in_node;
+
+   /* Update the page address in the parent node */
+   __set_data_blkaddr(dn, blk_addr);
+
+   write_lock(>ext.ext_lock);
+
+   start_fofs = fi->ext.fofs;
+   end_fofs = fi->ext.fofs + fi->ext.len - 1;
+   start_blkaddr = fi->ext.blk_addr;
+   end_blkaddr = fi->ext.blk_addr + fi->ext.len - 1;
+
+   /* Drop and initialize the matched extent */
+   if (fi->ext.len == 1 && fofs == start_fofs)
+   fi->ext.len = 0;
+
+   /* Initial extent */
+   if (fi->ext.len == 0) {
+   if (blk_addr != NULL_ADDR) {
+   fi->ext.fofs = fofs;
+   fi->ext.blk_addr = blk_addr;
+   fi->ext.len = 1;
+   }
+   goto end_update;
+   }
+
+   /* Frone merge */
+   if (fofs == start_fofs - 1 && blk_addr == start_blkaddr - 1) {
+   fi->ext.fofs--;
+   fi->ext.blk_addr--;
+   fi->ext.len++;
+   goto end_update;
+   }
+
+   /* Back merge */
+   if (fofs == end_fofs + 1 && blk_addr == end_blkaddr + 1) {
+   fi->ext.len++;
+   goto end_update;
+   }
+
+   /* Split the 

Re: [PATCH for-v3.7 2/2] slub: optimize kmalloc* inlining for GFP_DMA

2012-10-22 Thread JoonSoo Kim
2012/10/22 Christoph Lameter :
> On Sun, 21 Oct 2012, Joonsoo Kim wrote:
>
>> kmalloc() and kmalloc_node() of the SLUB isn't inlined when @flags = 
>> __GFP_DMA.
>> This patch optimize this case,
>> so when @flags = __GFP_DMA, it will be inlined into generic code.
>
> __GFP_DMA is a rarely used flag for kmalloc allocators and so far it was
> not considered that it is worth to directly support it in the inlining
> code.
>
>

Hmm... but, the SLAB already did that optimization for __GFP_DMA.
Almost every kmalloc() is invoked with constant flags value,
so I think that overhead from this patch may be negligible.
With this patch, code size of vmlinux is reduced slightly.
--
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 08/16 v2] f2fs: add file operations

2012-10-22 Thread Jaegeuk Kim
This adds memory operations and file/file_inode operations.

- F2FS supports fallocate(), mmap(), fsync(), and basic ioctl().

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/file.c |  640 
 1 file changed, 640 insertions(+)
 create mode 100644 fs/f2fs/file.c

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
new file mode 100644
index 000..81b1fd0
--- /dev/null
+++ b/fs/f2fs/file.c
@@ -0,0 +1,640 @@
+/**
+ * fs/f2fs/file.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+#include "xattr.h"
+#include "acl.h"
+
+static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
+   struct vm_fault *vmf)
+{
+   struct page *page = vmf->page;
+   struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct page *node_page;
+   block_t old_blk_addr;
+   struct dnode_of_data dn;
+   int err;
+
+   f2fs_balance_fs(sbi);
+
+   sb_start_pagefault(inode->i_sb);
+
+   mutex_lock_op(sbi, DATA_NEW);
+
+   /* block allocation */
+   set_new_dnode(, inode, NULL, NULL, 0);
+   err = get_dnode_of_data(, page->index, 0);
+   if (err) {
+   mutex_unlock_op(sbi, DATA_NEW);
+   goto out;
+   }
+
+   old_blk_addr = dn.data_blkaddr;
+   node_page = dn.node_page;
+
+   if (old_blk_addr == NULL_ADDR) {
+   err = reserve_new_block();
+   if (err) {
+   f2fs_put_dnode();
+   mutex_unlock_op(sbi, DATA_NEW);
+   goto out;
+   }
+   }
+   f2fs_put_dnode();
+
+   mutex_unlock_op(sbi, DATA_NEW);
+
+   lock_page(page);
+   if (page->mapping != inode->i_mapping ||
+   page_offset(page) >= i_size_read(inode) ||
+   !PageUptodate(page)) {
+   unlock_page(page);
+   err = -EFAULT;
+   goto out;
+   }
+
+   /*
+* check to see if the page is mapped already (no holes)
+*/
+   if (PageMappedToDisk(page))
+   goto out;
+
+   /* fill the page */
+   wait_on_page_writeback(page);
+
+   /* page is wholly or partially inside EOF */
+   if (((page->index + 1) << PAGE_CACHE_SHIFT) > i_size_read(inode)) {
+   unsigned offset;
+   offset = i_size_read(inode) & ~PAGE_CACHE_MASK;
+   zero_user_segment(page, offset, PAGE_CACHE_SIZE);
+   }
+   set_page_dirty(page);
+   SetPageUptodate(page);
+
+   file_update_time(vma->vm_file);
+out:
+   sb_end_pagefault(inode->i_sb);
+   return block_page_mkwrite_return(err);
+}
+
+static const struct vm_operations_struct f2fs_file_vm_ops = {
+   .fault= filemap_fault,
+   .page_mkwrite = f2fs_vm_page_mkwrite,
+};
+
+static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode)
+{
+   struct dentry *dentry;
+   nid_t pino;
+
+   inode = igrab(inode);
+   dentry = d_find_any_alias(inode);
+   if (!dentry) {
+   iput(inode);
+   return 0;
+   }
+   pino = dentry->d_parent->d_inode->i_ino;
+   dput(dentry);
+   iput(inode);
+   return !is_checkpointed_node(sbi, pino);
+}
+
+int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+{
+   struct inode *inode = file->f_mapping->host;
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   unsigned long long cur_version;
+   int ret = 0;
+   bool need_cp = false;
+   struct writeback_control wbc = {
+   .sync_mode = WB_SYNC_ALL,
+   .nr_to_write = LONG_MAX,
+   .for_reclaim = 0,
+   };
+
+   ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
+   if (ret)
+   return ret;
+
+   mutex_lock(>i_mutex);
+
+   if (inode->i_sb->s_flags & MS_RDONLY)
+   goto out;
+   if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
+   goto out;
+
+   mutex_lock(>cp_mutex);
+   cur_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver);
+   mutex_unlock(>cp_mutex);
+
+   if (F2FS_I(inode)->data_version != cur_version &&
+   !(inode->i_state & I_DIRTY))
+   goto out;
+   F2FS_I(inode)->data_version--;
+
+   if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1)
+   need_cp = true;
+   if (is_inode_flag_set(F2FS_I(inode), 

[PATCH 07/16 v2] f2fs: add segment operations

2012-10-22 Thread Jaegeuk Kim
This adds specific functions not only to manage dirty/free segments, SIT pages,
a cache for SIT entries, and summary entries, but also to allocate free blocks
and write three types of pages: data, node, and meta.

- F2FS maintains three types of bitmaps in memory, which indicate free, prefree,
  and dirty segments respectively.

- The key information of an SIT entry consists of a segment number, the number
  of valid blocks in the segment, a bitmap to identify there-in valid or invalid
  blocks.

- An SIT page is composed of a certain range of SIT entries, which is maintained
  by the address space of meta_inode.

- To cache SIT entries, a simple array is used. The index for the array is the
  segment number.

- A summary entry for data contains the parent node information. A summary entry
  for node contains its node offset from the inode.

- F2FS manages information about six active logs and those summary entries in
  memory. Whenever one of them is changed, its summary entries are flushed to
  its SIT page maintained by the address space of meta_inode.

- This patch adds a default block allocation function which supports heap-based
  allocation policy.

- This patch adds core functions to write data, node, and meta pages. Since LFS
  basically produces a series of sequential writes, F2FS merges sequential bios
  with a single one as much as possible to reduce the IO scheduling overhead.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/segment.c | 1795 +
 1 file changed, 1795 insertions(+)
 create mode 100644 fs/f2fs/segment.c

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
new file mode 100644
index 000..57d0931
--- /dev/null
+++ b/fs/f2fs/segment.c
@@ -0,0 +1,1795 @@
+/**
+ * fs/f2fs/segment.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "segment.h"
+#include "node.h"
+
+static int need_to_flush(struct f2fs_sb_info *sbi)
+{
+   unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) *
+   sbi->segs_per_sec;
+   int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1)
+   >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
+   int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1)
+   >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
+
+   if (sbi->por_doing)
+   return 0;
+
+   if (free_sections(sbi) <= (node_secs + 2 * dent_secs +
+   reserved_sections(sbi)))
+   return 1;
+   return 0;
+}
+
+/**
+ * This function balances dirty node and dentry pages.
+ * In addition, it controls garbage collection.
+ */
+void f2fs_balance_fs(struct f2fs_sb_info *sbi)
+{
+   struct writeback_control wbc = {
+   .sync_mode = WB_SYNC_ALL,
+   .nr_to_write = LONG_MAX,
+   .for_reclaim = 0,
+   };
+
+   if (sbi->por_doing)
+   return;
+
+   /*
+* We should do checkpoint when there are so many dirty node pages
+* with enough free segments. After then, we should do GC.
+*/
+   if (need_to_flush(sbi)) {
+   sync_dirty_dir_inodes(sbi);
+   sync_node_pages(sbi, 0, );
+   }
+
+   if (has_not_enough_free_secs(sbi)) {
+   mutex_lock(>gc_mutex);
+   f2fs_gc(sbi, 1);
+   }
+}
+
+static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int 
segno,
+   enum dirty_type dirty_type)
+{
+   struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
+
+   /* need not be added */
+   if (IS_CURSEG(sbi, segno))
+   return;
+
+   if (!test_and_set_bit(segno, dirty_i->dirty_segmap[dirty_type]))
+   dirty_i->nr_dirty[dirty_type]++;
+
+   if (dirty_type == DIRTY) {
+   struct seg_entry *sentry = get_seg_entry(sbi, segno);
+   dirty_type = sentry->type;
+   if (!test_and_set_bit(segno, dirty_i->dirty_segmap[dirty_type]))
+   dirty_i->nr_dirty[dirty_type]++;
+   }
+}
+
+static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int 
segno,
+   enum dirty_type dirty_type)
+{
+   struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
+
+   if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type]))
+   dirty_i->nr_dirty[dirty_type]--;
+
+   if (dirty_type == DIRTY) {
+   struct seg_entry *sentry = get_seg_entry(sbi, segno);
+   dirty_type = sentry->type;
+   if (test_and_clear_bit(segno,
+   

Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6

2012-10-22 Thread Andi Kleen
On Tue, Oct 23, 2012 at 12:44:24PM +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2012-10-22 at 17:53 +0200, Michael Kerrisk (man-pages) wrote:
> 
> > This is all seems to make an awful muck of the API...
> 
>  .../...
> 
> > There seems to be a reasonable argument here for an mmap3() with a
> > 64-bit flags argument...
> 
> I tend to agree. There's a similar issue happening when we try to shovel

Could you comment on the expect range of page sizes on PPC?

I looked at this again and I don't think we have anywhere near true 28 flags
so far.  The man page currently only lists 16 (including MAP_UNUS^INITIALIZED)

So I don't see why I can't have 6 bits from that.

I have no idea why the MAP_UNINITIALIZED flag was put into this strange 
location anyways instead of directly after the existing flags or just
into one of the unused slots. 

I suppose I could put my bits before it, there's plenty of space.

Existing flags on x86:

#define MAP_SHARED  0x01/* Share changes */
#define MAP_PRIVATE 0x02/* Changes are private */

4 unused
8 unused

#define MAP_FIXED   0x10/* Interpret addr exactly */
#define MAP_ANONYMOUS   0x20/* don't use a file */

0x40 unused

#define MAP_GROWSDOWN   0x0100  /* stack-like segment */

0x200 unused
0x400 unused

#define MAP_DENYWRITE   0x0800  /* ETXTBSY */
#define MAP_EXECUTABLE  0x1000  /* mark it as an executable */
#define MAP_LOCKED  0x2000  /* pages are locked */
#define MAP_NORESERVE   0x4000  /* don't check for reservations */
#define MAP_POPULATE0x8000  /* populate (prefault) pagetables */
#define MAP_NONBLOCK0x1 /* do not block on IO */
#define MAP_STACK   0x2 /* give out an address that is best 
suited for process/thread stacks */
#define MAP_HUGETLB 0x4 /* create a huge page mapping */

/* all free here: 6 bits for me? 0x8..0x100 */

# define MAP_UNINITIALIZED 0x400/* For anonymous mmap, memory could be 
uninitialized */

/* more free bits. */

Overall it seems there's no real shortage of bits.

> things into protection bits, like we do with SAO (strong access
> ordering) and want to do with per-page endian on embedded.

mprotect already does this.

Unless someone finds a good reason why this can't work I'll just move
the range to 0x8..0x100.

-Andi
-- 
a...@linux.intel.com -- Speaking for myself only
--
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 06/16 v2] f2fs: add node operations

2012-10-22 Thread Jaegeuk Kim
This adds specific functions to manage NAT pages, a cache for NAT entries, free
nids, direct/indirect node blocks for indexing data, and address space for node
pages.

- The key information of an NAT entry consists of a node id and a block address.

- An NAT page is composed of block addresses covered by a certain range of NAT
  entries, which is maintained by the address space of meta_inode.

- A radix tree structure is used to cache NAT entries. The index for the tree
  is a node id.

- When there is no free nid, F2FS should scan NAT entries to find new one. In
  order to avoid scanning frequently, F2FS manages a list containing a number of
  free nids in memory. Only when free nids in the list are exhausted, scanning
  process, build_free_nids(), is triggered.

- F2FS has direct and indirect node blocks for indexing data. This patch adds
  fuctions related to the node block management such as getting, allocating, and
  truncating node blocks to index data.

- In order to cache node blocks in memory, F2FS has a node_inode with an address
  space for node pages. This patch also adds the address space operations for
  node_inode.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/node.c | 1782 
 1 file changed, 1782 insertions(+)
 create mode 100644 fs/f2fs/node.c

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
new file mode 100644
index 000..df69058
--- /dev/null
+++ b/fs/f2fs/node.c
@@ -0,0 +1,1782 @@
+/**
+ * fs/f2fs/node.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+
+static struct kmem_cache *nat_entry_slab;
+static struct kmem_cache *free_nid_slab;
+
+static void clear_node_page_dirty(struct page *page)
+{
+   struct address_space *mapping = page->mapping;
+   struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
+   unsigned int long flags;
+
+   if (PageDirty(page)) {
+   spin_lock_irqsave(>tree_lock, flags);
+   radix_tree_tag_clear(>page_tree,
+   page_index(page),
+   PAGECACHE_TAG_DIRTY);
+   spin_unlock_irqrestore(>tree_lock, flags);
+
+   clear_page_dirty_for_io(page);
+   dec_page_count(sbi, F2FS_DIRTY_NODES);
+   }
+   ClearPageUptodate(page);
+}
+
+static struct page *get_current_nat_page(struct f2fs_sb_info *sbi, nid_t nid)
+{
+   pgoff_t index = current_nat_addr(sbi, nid);
+   return get_meta_page(sbi, index);
+}
+
+static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid)
+{
+   struct page *src_page;
+   struct page *dst_page;
+   pgoff_t src_off;
+   pgoff_t dst_off;
+   void *src_addr;
+   void *dst_addr;
+   struct f2fs_nm_info *nm_i = NM_I(sbi);
+
+   src_off = current_nat_addr(sbi, nid);
+   dst_off = next_nat_addr(sbi, src_off);
+
+   /* get current nat block page with lock */
+   src_page = get_meta_page(sbi, src_off);
+
+   /* Dirty src_page means that it is already the new target NAT page. */
+   if (PageDirty(src_page))
+   return src_page;
+
+   dst_page = grab_meta_page(sbi, dst_off);
+
+   src_addr = page_address(src_page);
+   dst_addr = page_address(dst_page);
+   memcpy(dst_addr, src_addr, PAGE_CACHE_SIZE);
+   set_page_dirty(dst_page);
+   f2fs_put_page(src_page, 1);
+
+   set_to_next_nat(nm_i, nid);
+
+   return dst_page;
+}
+
+/**
+ * Readahead NAT pages
+ */
+static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)
+{
+   struct address_space *mapping = sbi->meta_inode->i_mapping;
+   struct f2fs_nm_info *nm_i = NM_I(sbi);
+   struct page *page;
+   pgoff_t index;
+   int i;
+
+   for (i = 0; i < FREE_NID_PAGES; i++, nid += NAT_ENTRY_PER_BLOCK) {
+   if (nid >= nm_i->max_nid)
+   nid = 0;
+   index = current_nat_addr(sbi, nid);
+
+   page = grab_cache_page(mapping, index);
+   if (!page)
+   continue;
+   if (f2fs_readpage(sbi, page, index, READ)) {
+   f2fs_put_page(page, 1);
+   continue;
+   }
+   page_cache_release(page);
+   }
+}
+
+static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n)
+{
+   return radix_tree_lookup(_i->nat_root, n);
+}
+
+static unsigned int __gang_lookup_nat_cache(struct f2fs_nm_info *nm_i,
+   nid_t start, unsigned int nr, struct nat_entry **ep)
+{
+   return radix_tree_gang_lookup(_i->nat_root, (void **)ep, 

[PATCH 05/16 v2] f2fs: add checkpoint operations

2012-10-22 Thread Jaegeuk Kim
This adds functions required by the checkpoint operations.

Basically, f2fs adopts a roll-back model with checkpoint blocks written in the
CP area. The checkpoint procedure includes as follows.

- write_checkpoint()
1. block_operations() freezes VFS calls.
2. submit cached bios.
3. flush_nat_entries() writes NAT pages updated by dirty NAT entries.
4. flush_sit_entries() writes SIT pages updated by dirty SIT entries.
5. do_checkpoint() writes,
  - checkpoint block (#0)
  - orphan inode blocks
  - summary blocks made by active logs
  - checkpoint block (copy of #0)
6. unblock_opeations()

In order to provide an address space for meta pages, f2fs_sb_info has a special
inode, namely meta_inode. This patch also adds the address space operations for
meta_inode.

Signed-off-by: Chul Lee 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c |  795 ++
 1 file changed, 795 insertions(+)
 create mode 100644 fs/f2fs/checkpoint.c

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
new file mode 100644
index 000..a0601cc
--- /dev/null
+++ b/fs/f2fs/checkpoint.c
@@ -0,0 +1,795 @@
+/**
+ * fs/f2fs/checkpoint.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "segment.h"
+
+static struct kmem_cache *orphan_entry_slab;
+static struct kmem_cache *inode_entry_slab;
+
+/**
+ * We guarantee no failure on the returned page.
+ */
+struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
+{
+   struct address_space *mapping = sbi->meta_inode->i_mapping;
+   struct page *page = NULL;
+repeat:
+   page = grab_cache_page(mapping, index);
+   if (!page) {
+   cond_resched();
+   goto repeat;
+   }
+
+   /* We wait writeback only inside grab_meta_page() */
+   wait_on_page_writeback(page);
+   SetPageUptodate(page);
+   return page;
+}
+
+/**
+ * We guarantee no failure on the returned page.
+ */
+struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
+{
+   struct address_space *mapping = sbi->meta_inode->i_mapping;
+   struct page *page;
+repeat:
+   page = grab_cache_page(mapping, index);
+   if (!page) {
+   cond_resched();
+   goto repeat;
+   }
+   if (f2fs_readpage(sbi, page, index, READ_SYNC)) {
+   f2fs_put_page(page, 1);
+   goto repeat;
+   }
+   mark_page_accessed(page);
+
+   /* We do not allow returning an errorneous page */
+   return page;
+}
+
+static int f2fs_write_meta_page(struct page *page,
+   struct writeback_control *wbc)
+{
+   struct inode *inode = page->mapping->host;
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   int err;
+
+   wait_on_page_writeback(page);
+
+   err = write_meta_page(sbi, page, wbc);
+   if (err) {
+   wbc->pages_skipped++;
+   set_page_dirty(page);
+   }
+
+   dec_page_count(sbi, F2FS_DIRTY_META);
+
+   /* In this case, we should not unlock this page */
+   if (err != AOP_WRITEPAGE_ACTIVATE)
+   unlock_page(page);
+   return err;
+}
+
+static int f2fs_write_meta_pages(struct address_space *mapping,
+   struct writeback_control *wbc)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
+   struct block_device *bdev = sbi->sb->s_bdev;
+   long written;
+
+   if (wbc->for_kupdate)
+   return 0;
+
+   if (get_pages(sbi, F2FS_DIRTY_META) == 0)
+   return 0;
+
+   /* if mounting is failed, skip writing node pages */
+   mutex_lock(>cp_mutex);
+   written = sync_meta_pages(sbi, META, bio_get_nr_vecs(bdev));
+   mutex_unlock(>cp_mutex);
+   wbc->nr_to_write -= written;
+   return 0;
+}
+
+long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
+   long nr_to_write)
+{
+   struct address_space *mapping = sbi->meta_inode->i_mapping;
+   pgoff_t index = 0, end = LONG_MAX;
+   struct pagevec pvec;
+   long nwritten = 0;
+   struct writeback_control wbc = {
+   .for_reclaim = 0,
+   };
+
+   pagevec_init(, 0);
+
+   while (index <= end) {
+   int i, nr_pages;
+   nr_pages = pagevec_lookup_tag(, mapping, ,
+   PAGECACHE_TAG_DIRTY,
+   min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
+   if (nr_pages == 0)
+   break;
+
+   for (i = 0; i < nr_pages; i++) {
+   

[PATCH 04/16 v2] f2fs: add super block operations

2012-10-22 Thread Jaegeuk Kim
This adds the implementation of superblock operations for f2fs, which includes
- init_f2fs_fs/exit_f2fs_fs
- f2fs_mount
- super_operations of f2fs

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/super.c |  590 +++
 1 file changed, 590 insertions(+)
 create mode 100644 fs/f2fs/super.c

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
new file mode 100644
index 000..8e608a0
--- /dev/null
+++ b/fs/f2fs/super.c
@@ -0,0 +1,590 @@
+/**
+ * fs/f2fs/super.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "f2fs.h"
+#include "node.h"
+#include "xattr.h"
+
+static struct kmem_cache *f2fs_inode_cachep;
+static struct proc_dir_entry *f2fs_proc_root;
+
+enum {
+   Opt_gc_background_off,
+   Opt_disable_roll_forward,
+   Opt_discard,
+   Opt_noheap,
+   Opt_nouser_xattr,
+   Opt_noacl,
+   Opt_active_logs,
+   Opt_disable_ext_identify,
+   Opt_err,
+};
+
+static match_table_t f2fs_tokens = {
+   {Opt_gc_background_off, "background_gc_off"},
+   {Opt_disable_roll_forward, "disable_roll_forward"},
+   {Opt_discard, "discard"},
+   {Opt_noheap, "no_heap"},
+   {Opt_nouser_xattr, "nouser_xattr"},
+   {Opt_noacl, "noacl"},
+   {Opt_active_logs, "active_logs=%u"},
+   {Opt_disable_ext_identify, "disable_ext_identify"},
+   {Opt_err, NULL},
+};
+
+static void init_once(void *foo)
+{
+   struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;
+
+   memset(fi, 0, sizeof(*fi));
+   inode_init_once(>vfs_inode);
+}
+
+static struct inode *f2fs_alloc_inode(struct super_block *sb)
+{
+   struct f2fs_inode_info *fi;
+
+   fi = kmem_cache_alloc(f2fs_inode_cachep, GFP_NOFS | __GFP_ZERO);
+   if (!fi)
+   return NULL;
+
+   init_once((void *) fi);
+
+   /* Initilize f2fs-specific inode info */
+   fi->vfs_inode.i_version = 1;
+   atomic_set(>dirty_dents, 0);
+   fi->current_depth = 1;
+   fi->i_advise = 0;
+   rwlock_init(>ext.ext_lock);
+
+   set_inode_flag(fi, FI_NEW_INODE);
+
+   return >vfs_inode;
+}
+
+static void f2fs_i_callback(struct rcu_head *head)
+{
+   struct inode *inode = container_of(head, struct inode, i_rcu);
+   kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode));
+}
+
+void f2fs_destroy_inode(struct inode *inode)
+{
+   call_rcu(>i_rcu, f2fs_i_callback);
+}
+
+static void f2fs_put_super(struct super_block *sb)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+
+#ifdef CONFIG_F2FS_STAT_FS
+   if (sbi->s_proc) {
+   f2fs_stat_exit(sbi);
+   remove_proc_entry(sb->s_id, f2fs_proc_root);
+   }
+#endif
+   stop_gc_thread(sbi);
+
+   write_checkpoint(sbi, false, true);
+
+   iput(sbi->node_inode);
+   iput(sbi->meta_inode);
+
+   /* destroy f2fs internal modules */
+   destroy_gc_manager(sbi);
+   destroy_node_manager(sbi);
+   destroy_segment_manager(sbi);
+
+   kfree(sbi->ckpt);
+
+   sb->s_fs_info = NULL;
+   brelse(sbi->raw_super_buf);
+   kfree(sbi);
+}
+
+int f2fs_sync_fs(struct super_block *sb, int sync)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   int ret = 0;
+
+   if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
+   return 0;
+
+   if (sync)
+   write_checkpoint(sbi, false, false);
+
+   return ret;
+}
+
+static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
+{
+   struct super_block *sb = dentry->d_sb;
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   block_t total_count, user_block_count, start_count, ovp_count;
+
+   total_count = le64_to_cpu(sbi->raw_super->block_count);
+   user_block_count = sbi->user_block_count;
+   start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr);
+   ovp_count = sbi->gc_info->overp_segment_count
+   << sbi->log_blocks_per_seg;
+   buf->f_type = F2FS_SUPER_MAGIC;
+   buf->f_bsize = sbi->blocksize;
+
+   buf->f_blocks = total_count - start_count;
+   buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count;
+   buf->f_bavail = user_block_count - valid_user_blocks(sbi);
+
+   buf->f_files = valid_inode_count(sbi);
+   buf->f_ffree = sbi->total_node_count - valid_node_count(sbi);
+
+   buf->f_namelen = F2FS_MAX_NAME_LEN;
+
+   return 0;
+}
+
+static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb);
+
+   if (test_opt(sbi, BG_GC))
+   seq_puts(seq, 

[PATCH 02/16 v2] f2fs: add on-disk layout

2012-10-22 Thread Jaegeuk Kim
This adds a header file describing the on-disk layout of f2fs.

Signed-off-by: Changman Lee 
Signed-off-by: Chul Lee 
Signed-off-by: Jaegeuk Kim 
---
 include/linux/f2fs_fs.h |  362 +++
 1 file changed, 362 insertions(+)
 create mode 100644 include/linux/f2fs_fs.h

diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
new file mode 100644
index 000..bd9c217
--- /dev/null
+++ b/include/linux/f2fs_fs.h
@@ -0,0 +1,362 @@
+/**
+ * include/linux/f2fs_fs.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _LINUX_F2FS_FS_H
+#define _LINUX_F2FS_FS_H
+
+#include 
+#include 
+
+#define F2FS_SUPER_MAGIC   0xF2F52010
+#define F2FS_SUPER_OFFSET  0   /* start sector # for sb */
+#define F2FS_BLKSIZE   4096
+#define F2FS_MAX_EXTENSION 64
+
+#define NULL_ADDR  0x0U
+#define NEW_ADDR   -1U
+
+#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
+#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
+#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
+
+#define GFP_F2FS_MOVABLE   (__GFP_WAIT | __GFP_IO | __GFP_ZERO)
+
+#define MAX_ACTIVE_LOGS16
+#define MAX_ACTIVE_NODE_LOGS   8
+#define MAX_ACTIVE_DATA_LOGS   8
+
+/*
+ * For superblock
+ */
+struct f2fs_super_block {
+   __le32 magic;   /* Magic Number */
+   __le16 major_ver;   /* Major Version */
+   __le16 minor_ver;   /* Minor Version */
+   __le32 log_sectorsize;  /* log2 (Sector size in bytes) */
+   __le32 log_sectors_per_block;   /* log2 (Number of sectors per block */
+   __le32 log_blocksize;   /* log2 (Block size in bytes) */
+   __le32 log_blocks_per_seg; /* log2 (Number of blocks per segment) */
+   __le32 segs_per_sec;/* Number of segments per section */
+   __le32 secs_per_zone;   /* Number of sections per zone */
+   __le32 checksum_offset; /* Checksum position in this super block */
+   __le64 block_count; /* Total number of blocks */
+   __le32 section_count;   /* Total number of sections */
+   __le32 segment_count;   /* Total number of segments */
+   __le32 segment_count_ckpt; /* Total number of segments
+ in Checkpoint area */
+   __le32 segment_count_sit; /* Total number of segments
+in Segment information table */
+   __le32 segment_count_nat; /* Total number of segments
+in Node address table */
+   /*Total number of segments in Segment summary area */
+   __le32 segment_count_ssa;
+   /* Total number of segments in Main area */
+   __le32 segment_count_main;
+   __le32 failure_safe_block_distance;
+   __le32 segment0_blkaddr;/* Start block address of Segment 0 */
+   __le32 start_segment_checkpoint; /* Start block address of ckpt */
+   __le32 sit_blkaddr; /* Start block address of SIT */
+   __le32 nat_blkaddr; /* Start block address of NAT */
+   __le32 ssa_blkaddr; /* Start block address of SSA */
+   __le32 main_blkaddr;/* Start block address of Main area */
+   __le32 root_ino;/* Root directory inode number */
+   __le32 node_ino;/* node inode number */
+   __le32 meta_ino;/* meta inode number */
+   __le32 volume_serial_number;/* VSN is optional field */
+   __le16 volume_name[512];/* Volume Name */
+   __le32 extension_count;
+   __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
+} __packed;
+
+/*
+ * For checkpoint
+ */
+struct f2fs_checkpoint {
+   __le64 checkpoint_ver;  /* Checkpoint block version number */
+   __le64 user_block_count;/* # of user blocks */
+   __le64 valid_block_count;   /* # of valid blocks in Main area */
+   __le32 rsvd_segment_count;  /* # of reserved segments for gc */
+   __le32 overprov_segment_count;  /* # of overprovision segments */
+   __le32 free_segment_count;  /* # of free segments in Main area */
+
+   /* information of current node segments */
+   __le32 cur_node_segno[MAX_ACTIVE_NODE_LOGS];
+   __le16 cur_node_blkoff[MAX_ACTIVE_NODE_LOGS];
+   __le16 nat_upd_blkoff[MAX_ACTIVE_NODE_LOGS];
+   /* information of current data segments */
+   __le32 cur_data_segno[MAX_ACTIVE_DATA_LOGS];
+   __le16 cur_data_blkoff[MAX_ACTIVE_DATA_LOGS];
+   __le32 ckpt_flags;  /* Flags : umount and journal_present */
+   __le32 cp_pack_total_block_count;
+   __le32 cp_pack_start_sum;   /* start block number of data summary */
+   __le32 valid_node_count;/* Total number of valid nodes */
+   __le32 

[PATCH 01/16 v2] f2fs: add document

2012-10-22 Thread Jaegeuk Kim
This adds a document describing the mount options, proc entries, usage, and
design of Flash-Friendly File System, namely F2FS.

Signed-off-by: Jaegeuk Kim 
---
 Documentation/filesystems/00-INDEX |2 +
 Documentation/filesystems/f2fs.txt |  404 
 2 files changed, 406 insertions(+)
 create mode 100644 Documentation/filesystems/f2fs.txt

diff --git a/Documentation/filesystems/00-INDEX 
b/Documentation/filesystems/00-INDEX
index 8c624a1..ce5fd46 100644
--- a/Documentation/filesystems/00-INDEX
+++ b/Documentation/filesystems/00-INDEX
@@ -48,6 +48,8 @@ ext4.txt
- info, mount options and specifications for the Ext4 filesystem.
 files.txt
- info on file management in the Linux kernel.
+f2fs.txt
+   - info and mount options for the F2FS filesystem.
 fuse.txt
- info on the Filesystem in User SpacE including mount options.
 gfs2.txt
diff --git a/Documentation/filesystems/f2fs.txt 
b/Documentation/filesystems/f2fs.txt
new file mode 100644
index 000..f2b4fde
--- /dev/null
+++ b/Documentation/filesystems/f2fs.txt
@@ -0,0 +1,404 @@
+
+WHAT IS Flash-Friendly File System (F2FS)?
+
+
+NAND flash memory-based storage devices, such as SSD, eMMC, and SD cards, have
+been widely being used for storage ranging from mobile to server systems. Since
+they are known to have different characteristics from the conventional rotating
+disks, a file system, an upper layer to the storage device, should adapt to the
+changes from the sketch in the design level.
+
+F2FS is a file system exploiting NAND flash memory-based storage devices, which
+is based on Log-structured File System (LFS). The design has been focused on
+addressing the fundamental issues in LFS, which are snowball effect of 
wandering
+tree and high cleaning overhead.
+
+Since a NAND flash memory-based storage device shows different characteristic
+according to its internal geometry or flash memory management scheme, namely 
FTL,
+F2FS and its tools support various parameters not only for configuring on-disk
+layout, but also for selecting allocation and cleaning algorithms.
+
+The file system formatting tool, "mkfs.f2fs", is available from the following
+download page: http://sourceforge.net/projects/f2fs-tools/
+
+
+BACKGROUND AND DESIGN ISSUES
+
+
+Log-structured File System (LFS)
+
+"A log-structured file system writes all modifications to disk sequentially in
+a log-like structure, thereby speeding up  both file writing and crash 
recovery.
+The log is the only structure on disk; it contains indexing information so that
+files can be read back from the log efficiently. In order to maintain large 
free
+areas on disk for fast writing, we divide  the log into segments and use a
+segment cleaner to compress the live information from heavily fragmented
+segments." from Rosenblum, M. and Ousterhout, J. K., 1992, "The design and
+implementation of a log-structured file system", ACM Trans. Computer Systems
+10, 1, 26–52.
+
+Wandering Tree Problem
+--
+In LFS, when a file data is updated and written to the end of log, its direct
+pointer block is updated due to the changed location. Then the indirect pointer
+block is also updated due to the direct pointer block update. In this manner,
+the upper index structures such as inode, inode map, and checkpoint block are
+also updated recursively. This problem is called as wandering tree problem [1],
+and in order to enhance the performance, it should eliminate or relax the 
update
+propagation as much as possible.
+
+[1] Bityutskiy, A. 2005. JFFS3 design issues. 
http://www.linux-mtd.infradead.org/
+
+Cleaning Overhead
+-
+Since LFS is based on out-of-place writes, it produces so many obsolete blocks
+scattered across the whole storage. In order to serve new empty log space, it
+needs to reclaim these obsolete blocks seamlessly to users. This job is called
+as a cleaning process.
+
+The process consists of three operations as follows.
+1. A victim segment is selected through referencing segment usage table.
+2. It loads parent index structures of all the data in the victim identified by
+   segment summary blocks.
+3. It checks the cross-reference between the data and its parent index 
structure.
+4. It moves valid data selectively.
+
+This cleaning job may cause unexpected long delays, so the most important goal
+is to hide the latencies to users. And also definitely, it should reduce the
+amount of valid data to be moved, and move them quickly as well.
+
+
+KEY FEATURES

RE: [PATCH net-next 1/2] r8169: enable ALDPS for power saving

2012-10-22 Thread hayeswang
 Francois Romieu [mailto:rom...@fr.zoreil.com] 
> Sent: Tuesday, October 23, 2012 3:28 AM
> To: Hayeswang
> Cc: net...@vger.kernel.org; linux-kernel@vger.kernel.org; 
> j...@google.com
> Subject: Re: [PATCH net-next 1/2] r8169: enable ALDPS for power saving
> 
[...]
> > @@ -687,6 +687,7 @@ enum features {
> > RTL_FEATURE_WOL = (1 << 0),
> > RTL_FEATURE_MSI = (1 << 1),
> > RTL_FEATURE_GMII= (1 << 2),
> > +   RTL_FEATURE_EXTENDED= (1 << 3),
> 
> Is there a specific reason why it is not named RTL_FEATURE_ALDPS ?
> 
> RTL_FEATURE_EXTENDED is anything but enlightning.
> 

The flag is determined if the firmware is loaded. It doesn't mean to enable
ALDPS. Besides ALDPS, the firmware includes the other features about power
saving, performance, hw behavior, and so on. Thus, I think it  is the extended
feature. Any suggestion?

[...]
> > @@ -6391,6 +6433,8 @@ static void 
> rtl8169_net_suspend(struct net_device *dev)
> >  {
> > struct rtl8169_private *tp = netdev_priv(dev);
> >  
> > +   tp->features &= ~RTL_FEATURE_EXTENDED;
> > +
> 
> The commit message does not explain this part.
> 
> What are you trying to achieve ?

I don't sure if the firmware code still exists and works after hibernation. I
clear the flag for safe. It would be set again after loading firmware. It is
used to make sure to enable ALDPS with firmware.

> 
> After this patch the driver would look like:
> 1. disable ALDPS before setting firmware (unmodified by patch)
>RTL_GIGA_MAC_VER_29 "RTL8105e"
>RTL_GIGA_MAC_VER_30 "RTL8105e"
>RTL_GIGA_MAC_VER_37 "RTL8402"
>RTL_GIGA_MAC_VER_39 "RTL8106e"
> 
> 2. apply_firmware (unmodified by patch)
>RTL_GIGA_MAC_VER_25 "RTL8168d/8111d"
>RTL_GIGA_MAC_VER_26 "RTL8168d/8111d"
>RTL_GIGA_MAC_VER_29 "RTL8105e"
>RTL_GIGA_MAC_VER_30 "RTL8105e"
>RTL_GIGA_MAC_VER_32 "RTL8168e/8111e"
>RTL_GIGA_MAC_VER_33 "RTL8168e/8111e"
>RTL_GIGA_MAC_VER_34 "RTL8168evl/8111evl"
>RTL_GIGA_MAC_VER_35 "RTL8168f/8111f"
>RTL_GIGA_MAC_VER_36 "RTL8168f/8111f"
>RTL_GIGA_MAC_VER_37 "RTL8402"
>RTL_GIGA_MAC_VER_38 "RTL8411"
>RTL_GIGA_MAC_VER_39 "RTL8106e"
>RTL_GIGA_MAC_VER_40 "RTL8168g/8111g"
> 
> 3. enable ALDPS after firmware
>RTL_GIGA_MAC_VER_34 "RTL8168evl/8111evl"
>RTL_GIGA_MAC_VER_35 "RTL8168f/8111f"
>RTL_GIGA_MAC_VER_36 "RTL8168f/8111f"
>RTL_GIGA_MAC_VER_37 "RTL8402"
>RTL_GIGA_MAC_VER_38 "RTL8411"
>RTL_GIGA_MAC_VER_39 "RTL8106e"
>RTL_GIGA_MAC_VER_40 "RTL8168g/8111g"
> 
> The disable/enable ALDPS code is not trivially balanced.
> 
> Do we exactly perform the required ALDPS operations ? Nothing more,
> nothing less ?
> 

Because the different design between the giga nic and 10/100M nic, the behavior
would be different. For example, you couldn't disable the ALDPS of the giga nic
directly just like the 10/100M (8136 series) one. The giga nic would disable
ALDPS automatically when loading firmware, but the 8136 series wouldn't.

Best Regards,
Hayes

--
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 00/16 v2] f2fs: introduce flash-friendly file system

2012-10-22 Thread Jaegeuk Kim
Change log from v1:

 o Apply the recent user namespace changes [Eric]
 o Remove unnecessary condition check [Al]
 o Fix wrong description [Stefan]
 o Fix f2fs document [Randy]
 o Enlarge the volume label length to 256 unicodes [Martin]
 o Support time resolution to nano scale [Boaz]
 o Fix the wrong use of endian conversion [David]
 o Fix the use of mutex and spinlocks [David]
 o Remove the use of __GFP_NOFAIL, etc [Neil]
 o Change the flow for readability [Neil]
 o Reduce the lock contention in CP [Neil]
 o Support multiples of section size [Arnd]
 o Support configurable extension list [Arnd]
 o Support configurable active log numbers [Arnd]

[Future works]
 o Aware of file access pattern
 o Erase block indirect
 o Sub-page write avoidance
 o In-line data
 o Xattr optimization/in-line xattrs

I really appreciate the valuable comments from all of you in community.

Note)
Due to the change of on-disk layout, please download f2fs-tools-1.1.0.tar.gz.



This is a new patch set for the f2fs file system.

What is F2FS?
=

NAND flash memory-based storage devices, such as SSD, eMMC, and SD cards, have
been widely being used for ranging from mobile to server systems. Since they are
known to have different characteristics from the conventional rotational disks,
a file system, an upper layer to the storage device, should adapt to the changes
from the sketch.

F2FS is a new file system carefully designed for the NAND flash memory-based 
storage
devices. We chose a log structure file system approach, but we tried to adapt it
to the new form of storage. Also we remedy some known issues of the very old log
structured file system, such as snowball effect of wandering tree and high 
cleaning
overhead.

Because a NAND-based storage device shows different characteristics according to
its internal geometry or flash memory management scheme aka FTL, we add various
parameters not only for configuring on-disk layout, but also for selecting 
allocation
and cleaning algorithms.

Patch set
=

The patch #1 adds a document to Documentation/filesystems/.
The patch #2 adds a header file of on-disk layout to include/linux/.
The patches #3-#15 adds f2fs source files to fs/f2fs/.
The Last patch, patch #16, updates Makefile and Kconfig.

mkfs.f2fs
=

The file system formatting tool, "mkfs.f2fs", is available from the following
download page:  http://sourceforge.net/projects/f2fs-tools/

Usage
=

If you'd like to experience f2fs, simply:
 # mkfs.f2fs /dev/sdb1
 # mount -t f2fs /dev/sdb1 /mnt/f2fs

Short log
=

Jaegeuk Kim (16):
  f2fs: add document
  f2fs: add on-disk layout
  f2fs: add superblock and major in-memory structure
  f2fs: add super block operations
  f2fs: add checkpoint operations
  f2fs: add node operations
  f2fs: add segment operations
  f2fs: add file operations
  f2fs: add address space operations for data
  f2fs: add core inode operations
  f2fs: add inode operations for special inodes
  f2fs: add core directory operations
  f2fs: add xattr and acl functionalities
  f2fs: add garbage collection functions
  f2fs: add recovery routines for roll-forward
  f2fs: update Kconfig and Makefile

 Documentation/filesystems/00-INDEX |2 +
 Documentation/filesystems/f2fs.txt |  404 
 fs/Kconfig |1 +
 fs/Makefile|1 +
 fs/f2fs/Kconfig|   55 ++
 fs/f2fs/Makefile   |6 +
 fs/f2fs/acl.c  |  465 ++
 fs/f2fs/acl.h  |   57 ++
 fs/f2fs/checkpoint.c   |  795 
 fs/f2fs/data.c |  701 ++
 fs/f2fs/dir.c  |  657 +
 fs/f2fs/f2fs.h |  982 
 fs/f2fs/file.c |  640 +
 fs/f2fs/gc.c   | 1139 +++
 fs/f2fs/gc.h   |  203 
 fs/f2fs/hash.c |   98 ++
 fs/f2fs/inode.c|  262 ++
 fs/f2fs/namei.c|  494 ++
 fs/f2fs/node.c | 1782 +++
 fs/f2fs/node.h |  330 +++
 fs/f2fs/recovery.c |  375 
 fs/f2fs/segment.c  | 1795 
 fs/f2fs/segment.h  |  594 
 fs/f2fs/super.c|  590 
 fs/f2fs/xattr.c|  389 
 fs/f2fs/xattr.h|  145 +++
 include/linux/f2fs_fs.h|  362 
 27 files changed, 13324 insertions(+)
 create mode 100644 Documentation/filesystems/f2fs.txt
 create mode 100644 fs/f2fs/Kconfig
 create mode 100644 fs/f2fs/Makefile
 create mode 100644 fs/f2fs/acl.c
 create mode 100644 fs/f2fs/acl.h
 create mode 100644 fs/f2fs/checkpoint.c

Re: [GIT PULL] Linux KVM tool for v3.7-rc0

2012-10-22 Thread Asias He
On Mon, Oct 22, 2012 at 6:16 PM, Gleb Natapov  wrote:
> On Mon, Oct 22, 2012 at 11:24:19AM +0200, Avi Kivity wrote:
>> On 10/21/2012 05:39 PM, Pekka Enberg wrote:
>> >
>> > On Sun, Oct 21, 2012 at 5:02 PM, richard -rw- weinberger
>> >  wrote:
>> >> qemu supports all these features.
>> >> E.g. to access the host fs use:
>> >> qemu ... \
>> >>   -fsdev 
>> >> local,security_model=passthrough,id=fsdev-root,path=/your/root/,readonly
>> >> \
>> >>   -device virtio-9p-pci,id=fs-root,fsdev=fsdev-root,mount_tag=rootshare
>> >
>> > IIRC, QEMU uses SLIRP non-root zero-config networking which is much
>> > more limited than what LKVM offers out of the box.
>>
>> Curious, what are the differences?
>>
> Me too, especially as we discussed replacing SLIRP with lkvm code for
> userspace networking and decided (for reasons I do not remember) that it
> lacks futures SLIRP has. Was it host port redirection?

Yes.  Currently, there is no host to guest port forward support in lkvm.
However, it's faster than slirp.
e.g. tcp bandwidth in a 100Mb/s environment
lkvm's userspace networking ~90Mb/s  v.s qemu's slirp  ~10Mb/s

-- 
Asias He
--
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: [RESEND PATCH 2/4] asm-generic: io: don't perform swab during {in,out} string functions

2012-10-22 Thread Benjamin Herrenschmidt
On Thu, 2012-10-18 at 07:48 +0200, Geert Uytterhoeven wrote:

> So assume you have the bytestream "Hello, world!\n" in memory on the
> PCI device.I.e.
> 
>   48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 21 0a|Hello, world!.|
> 
> You want to copy it to system RAM using readsl(), which does:
> 
>u32 *buf = buffer;
>do {
>u32 x = __raw_readl(addr + PCI_IOBASE);
>*buf++ = x;
> } while (--count);
> 
> On little endian, the first __raw_readl() should return "0x6c6c6548", so
> it is stored correctly by "*buf = x ".

Right.

> On big endian, the first __raw_readl() should return "0x48656c6c" instead,
> else it's stored incorrectly by "*buf = x ".
> But the PCI bus is little endian, so I expect __raw_readl() would return
> "0x6c6c6548", and thus needs swapping?

No. The PCI bus will return 0x48656c6c.

This is due to how the PCI bus is wired to the CPU bus, which is called
"byte address invariant". When doing a read of your byte 0, the CPU will
effectively read 0 with byte enables picking 48. Since the CPU wants
the first byte in the MSB, the bus must be wired up to the CPU such that
the MSB is the first byte in address order.

This is how a BE CPU is normally wired to a LE bus. The fact that a
register needs to be swapped comes from the fact that the device will
put the MSB in the higher address byte, which then corresponds to the
LSB on the BE CPU -> needs swapping.

But for a byte stream, as you can see, no swapping is required.

To some extent, it looks as if the wiring is byte swapped, in order to
provide the byte address invariance (and thus causes registers to look
byteswapped) but it's really not, it's just a convention.

> On m68k (classic with MMU), the situation is a bit more complicated, as some 
> ISA
> (or PCMCIA) busses are physically wired swapped. But inw() and insw() always 
> do
> either both swapping, or both no swapping. The state of support for ISA 
> drivers
> is a bit vague, though.

Then something is horribly wrong in those m68k setups :-) Either in the
way the busses are wired or in your implementation of either inw or
insw.

> Now, on m68k without MMU, inw() doesn't do swapping, but insw() does.
> This agrees more or less with you and Will, except that the bus seems to be
> physically swapped?

Yeah that's possible. In the early days people incorrectly thought it
would be smart to do that, thus avoiding a byteswap for register
accesses  and causing all data (DMA or FIFO) to be all backward.

That's for example why the disks in the Tivo are byteswapped 16-bit by
16-bit on the platter (ie, all the data is).

I wouldn't be surprised if some 68k suffered from similar HW designer
stupidity.

But the "proper" generic rule is byte address invariance, and that
implies swap on register access and no swap on byte streams.

Cheers,
Ben.


> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" 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/


Re: [PATCH v1] Support Elan Touchscreen eKTF product.

2012-10-22 Thread Jian-Jhong Ding
Dmitry Torokhov  writes:
> On Mon, Oct 22, 2012 at 11:47:42AM +0800, Jian-Jhong Ding wrote:
>> With Benjamin's i2c-hid implimentation, is it possible to make
>> hid-multitouch not depend on USBHID and reuse it to drive this device?
>
> Exactly. Before looking any further - is this the same part that Tom Lin
> posted a driver for earlier this summer?

No.  Tom's driver was only for trackpads, this is probably for some
touch panel.  The controller ICs may have some similarities, but the
firmware is developed independently, though both somewhat conform to the
HID over I2C protocol.

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


Re: [PATCH] staging: csr: fix coding style

2012-10-22 Thread SeongJae Park
Hello,


Thank you very much for your kindness, Greg.

I tried to reply to email-list when I received Lauri's email, but I
coudln't because my gmail service has some problems.

I'm still newbie, sorry.

I will send new patch that removes whole struct, as soon as
possible(maybe 4~5 hours later).


Thanks and Regards.
SeongJae Park.
--
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: perf: header: Regression

2012-10-22 Thread Namhyung Kim
Hi Andrew,

On Mon, 22 Oct 2012 15:11:42 +0200, Andrew Jones wrote:
> The patch series that contains 7e94cfcc9d20 regresses the
> header output. Below is a diff of info from before and
> after the series
>
> 58,64c58,59
> < # node1 meminfo  : total = 16777216 kB, free = 15712440 kB
> < # node1 cpu list : 2,6,10,14,18,22,26,30
> < # node2 meminfo  : total = 16777216 kB, free = 16299132 kB
> < # node2 cpu list : 1,5,9,13,17,21,25,29
> < # node3 meminfo  : total = 16777216 kB, free = 16217192 kB
> < # node3 cpu list : 3,7,11,15,19,23,27,31
> < # pmu mappings: cpu = 4, software = 1, tracepoint = 2, uncore_bbox_0 =
> 15, uncore_bbox_1 = 16, uncore_cbox_0 = 7, uncore_cbox_1 = 8,
> uncore_cbox_2 = 9, uncore_cbox_3 = 10, uncore_cbox_4 = 11, uncore_cbox_5 =
> 12, uncore_cbox_6 = 13, uncore_cbox_7 = 14, uncore_mbox_0 = 19,
> uncore_mbox_1 = 20, uncore_rbox_0 = 21, uncore_rbox_1 = 22, uncore_sbox_0
> = 17, uncore_sbox_1 = 18, breakpoint = 5, uncore_ubox = 6, uncore_wbox =
> 23
> ---
>> # numa topology : not available
>> # pmu mappings: cpu = 4, software = 1, tracepoint = 2, uncore_bbox_0 =
> 15, uncore_bbox_1 = 16, uncore_cbox_0 = 7, uncore_cbox_1 = 8,
> uncore_cbox_2 = 9, uncore_cbox_3 = 10, uncore_cbox_4 = 11, uncore_cbox_5 =
> 12, uncore_cbox_6 = 13, uncore_cbox_7 = 14, uncore_mbox_0 = 19# pmu
> mappings: unable to read
>
> As can be seen in the diff, before the series we had complete
> numa info and pmu mappings info. After we get 
>
> "# numa topology : not available" and "# pmu
> mappings: unable to read"

Hmm.. I couldn't reproduce on my system:

# node0 meminfo  : total = 33505624 kB, free = 25213528 kB
# node0 cpu list : 0-11
# pmu mappings: cpu = 4, software = 1, uncore_pcu = 13, tracepoint = 2,
uncore_imc_0 = 15, uncore_imc_1 = 16, uncore_imc_2 = 17, uncore_imc_3
= 18, uncore_qpi_0 = 19, u = 20, uncore_cbox_0 = 7, uncore_cbox_1 = 8,
uncore_cbox_2 = 9, uncore_cbox_3 = 10, uncore_cbox_4 = 11, un = 12,
uncore_ha = 14, uncore_r2pcie = 21, uncore_r3qpi_0 = 22,
uncore_r3qpi_1 = 23, breakpoint = 5, uncore_ubox = 6 

I don't have a NUMA machine.  Could you send your perf.data file or a
link via private mail?

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


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-10-22 Thread Rusty Russell
"Michael Kerrisk (man-pages)"  writes:
>> FIX: add flags arg to sys_finit_module()
>>
>> Thanks to Michael Kerrisk for keeping us honest.
>
> w00t! Thanks, Rusty ;-).
>
> Acked-by: Michael Kerrisk 

Here's the version I ended up with when I added two flags.

Lucas, is this useful to you?

BTW Michael: why aren't the syscall man pages in the kernel source?

Thanks,
Rusty.

module: add flags arg to sys_finit_module()

Thanks to Michael Kerrisk for keeping us honest.  These flags are actually
useful for eliminating the only case where kmod has to mangle a module's
internals: for overriding module versioning.

Signed-off-by: Rusty Russell 

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 32bc035..8cf7b50 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -868,5 +868,5 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
 
 asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
 unsigned long idx1, unsigned long idx2);
-asmlinkage long sys_finit_module(int fd, const char __user *uargs);
+asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
 #endif
diff --git a/include/uapi/linux/module.h b/include/uapi/linux/module.h
new file mode 100644
index 000..38da425
--- /dev/null
+++ b/include/uapi/linux/module.h
@@ -0,0 +1,8 @@
+#ifndef _UAPI_LINUX_MODULE_H
+#define _UAPI_LINUX_MODULE_H
+
+/* Flags for sys_finit_module: */
+#define MODULE_INIT_IGNORE_MODVERSIONS 1
+#define MODULE_INIT_IGNORE_VERMAGIC2
+
+#endif /* _UAPI_LINUX_MODULE_H */
diff --git a/kernel/module.c b/kernel/module.c
index 261bf82..55b49cd 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "module-internal.h"
 
 #define CREATE_TRACE_POINTS
@@ -2569,7 +2570,7 @@ static void free_copy(struct load_info *info)
vfree(info->hdr);
 }
 
-static int rewrite_section_headers(struct load_info *info)
+static int rewrite_section_headers(struct load_info *info, int flags)
 {
unsigned int i;
 
@@ -2597,7 +2598,10 @@ static int rewrite_section_headers(struct load_info 
*info)
}
 
/* Track but don't keep modinfo and version sections. */
-   info->index.vers = find_sec(info, "__versions");
+   if (flags & MODULE_INIT_IGNORE_MODVERSIONS)
+   info->index.vers = 0; /* Pretend no __versions section! */
+   else
+   info->index.vers = find_sec(info, "__versions");
info->index.info = find_sec(info, ".modinfo");
info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC;
info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC;
@@ -2612,7 +2617,7 @@ static int rewrite_section_headers(struct load_info *info)
  * Return the temporary module pointer (we'll replace it with the final
  * one when we move the module sections around).
  */
-static struct module *setup_load_info(struct load_info *info)
+static struct module *setup_load_info(struct load_info *info, int flags)
 {
unsigned int i;
int err;
@@ -2623,7 +2628,7 @@ static struct module *setup_load_info(struct load_info 
*info)
info->secstrings = (void *)info->hdr
+ info->sechdrs[info->hdr->e_shstrndx].sh_offset;
 
-   err = rewrite_section_headers(info);
+   err = rewrite_section_headers(info, flags);
if (err)
return ERR_PTR(err);
 
@@ -2661,11 +2666,14 @@ static struct module *setup_load_info(struct load_info 
*info)
return mod;
 }
 
-static int check_modinfo(struct module *mod, struct load_info *info)
+static int check_modinfo(struct module *mod, struct load_info *info, int flags)
 {
const char *modmagic = get_modinfo(info, "vermagic");
int err;
 
+   if (flags & MODULE_INIT_IGNORE_VERMAGIC)
+   modmagic = NULL;
+
/* This is allowed: modprobe --force will invalidate it. */
if (!modmagic) {
err = try_to_force_load(mod, "bad vermagic");
@@ -2901,18 +2909,18 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
return 0;
 }
 
-static struct module *layout_and_allocate(struct load_info *info)
+static struct module *layout_and_allocate(struct load_info *info, int flags)
 {
/* Module within temporary copy. */
struct module *mod;
Elf_Shdr *pcpusec;
int err;
 
-   mod = setup_load_info(info);
+   mod = setup_load_info(info, flags);
if (IS_ERR(mod))
return mod;
 
-   err = check_modinfo(mod, info);
+   err = check_modinfo(mod, info, flags);
if (err)
return ERR_PTR(err);
 
@@ -3094,7 +3102,8 @@ static int may_init_module(void)
 
 /* Allocate and load the module: note that size of section 0 is always
zero, and we rely on this for optional sections. */
-static int load_module(struct load_info *info, const char __user *uargs)
+static int load_module(struct load_info *info, const char __user *uargs,
+   

Re: [PATCHv7 3/4] virtio_console: Merge struct buffer_token into struct port_buffer

2012-10-22 Thread Rusty Russell
sjur.brandel...@stericsson.com writes:
> From: Sjur Brændeland 
>
> Refactoring the splice functionality by unifying the approach for
> sending scatter-lists and regular buffers. This simplifies
> buffer handling and reduces code size. Splice will now allocate
> a port_buffer and send_buf() and free_buf() can always be used
> for any buffer.
>
> Signed-off-by: Sjur Brændeland 

This looks sensible; a couple of extra blank lines inserted though.

Amit?

> @@ -1033,6 +1008,8 @@ static const struct file_operations port_fops = {
>  static int put_chars(u32 vtermno, const char *buf, int count)
>  {
>   struct port *port;
> + struct scatterlist sg[1];
> +
>  
>   if (unlikely(early_put_chars))
>   return early_put_chars(vtermno, buf, count);
> @@ -1041,7 +1018,9 @@ static int put_chars(u32 vtermno, const char *buf, int 
> count)
>   if (!port)
>   return -EPIPE;
>  
> - return send_buf(port, (void *)buf, count, false);
> + sg_init_one(sg, buf, count);
> + return __send_to_port(port, sg, 1, count, (void *)buf, false);
> +
>  }
>  
>  /*

Cheers,
Rusty.
--
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] arch/tile: avoid build warnings from duplicate ELF_R_xxx #defines

2012-10-22 Thread Rusty Russell
Chris Metcalf  writes:

> These are now provided in , so clean up warning
> by not re-defining them in module.c.
>
> Signed-off-by: Chris Metcalf 

This change was in linux-next for quite a while, BTW, so there would
have been over a month of warnings...

Acked-by: Rusty Russell 

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


Re: [PATCHv7 2/4] virtio_console: Use kmalloc instead of kzalloc

2012-10-22 Thread Rusty Russell
sjur.brandel...@stericsson.com writes:

> From: Sjur Brændeland 
>
> Avoid the more cpu expensive kzalloc when allocating buffers.
> Originally kzalloc was intended for isolating the guest from
> the host by not sending random guest data to the host. But device
> isolation is not yet in place so kzalloc is not really needed.
>
> Signed-off-by: Sjur Brændeland 

This looks fine to me.  This is *why* the device gives us the length
which was written; we can trust that, even if we can't trust the
writer of data.

(In theory: noone has implemented such a system, yet).

Applied.
Rusty.

> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index c36b2f6..301d17e 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -349,7 +349,7 @@ static struct port_buffer *alloc_buf(size_t buf_size)
>   buf = kmalloc(sizeof(*buf), GFP_KERNEL);
>   if (!buf)
>   goto fail;
> - buf->buf = kzalloc(buf_size, GFP_KERNEL);
> + buf->buf = kmalloc(buf_size, GFP_KERNEL);
>   if (!buf->buf)
>   goto free_buf;
>   buf->len = 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: [PATCH v2 1/3] mm: highmem: export kmap_to_page for modules

2012-10-22 Thread Rusty Russell
Will Deacon  writes:

> Some virtio device drivers (9p) need to translate high virtual addresses
> to physical addresses, which are inserted into the virtqueue for
> processing by userspace.
>
> This patch exports the kmap_to_page symbol, so that the affected drivers
> can be compiled as modules.

Thanks Will!

I've applied these, and add cc:stable.  I'll push them to Linus after a
little time in linux-next.

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


Re: [PATCHv7 4/4] virtio_console: Add support for remoteproc serial

2012-10-22 Thread Rusty Russell
sjur.brandel...@stericsson.com writes:
> From: Sjur Brændeland 
>
> Add a simple serial connection driver called
> VIRTIO_ID_RPROC_SERIAL (11) for communicating with a
> remote processor in an asymmetric multi-processing
> configuration.
>
> This implementation reuses the existing virtio_console
> implementation, and adds support for DMA allocation
> of data buffers and disables use of tty console and
> the virtio control queue.
>
> Signed-off-by: Sjur Brændeland 

The free-outside-interrupt issue is usually dealt with by offloading to
a wq, but your variant works (and isn't too ugly).

> + /* dma_free_coherent requires interrupts to be enabled. */
> + if (!can_sleep) {
> + /* queue up dma-buffers to be freed later */
> + spin_lock_irqsave(_bufs_lock, flags);
> + list_add_tail(>list, _free_dma_bufs);
> + spin_unlock_irqrestore(_bufs_lock, flags);
> + return;
> + }
> + dma_free_coherent(buf->dev, buf->size, buf->buf, buf->dma);
> +
> + /* Release device refcnt and allow it to be freed */
> + put_device(buf->dev);

...

> +static void reclaim_dma_bufs(void)
> +{
> + unsigned long flags;
> + struct port_buffer *buf, *tmp;
> + LIST_HEAD(tmp_list);
> +
> + if (list_empty(_free_dma_bufs))
> + return;
> +
> + /* Create a copy of the pending_free_dma_bufs while holding the lock */
> + spin_lock_irqsave(_bufs_lock, flags);
> + list_cut_position(_list, _free_dma_bufs,
> +   pending_free_dma_bufs.prev);
> + spin_unlock_irqrestore(_bufs_lock, flags);
> +
> + /* Release the dma buffers, without irqs enabled */
> + list_for_each_entry_safe(buf, tmp, _list, list) {
> + list_del(>list);
> + free_buf(buf, true);
> + }
> +}

Looks like this should be an easy noop even if !is_rproc_serial.

> +
>  static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size,
>int pages)
>  {
>   struct port_buffer *buf;
>  
> + if (is_rproc_serial(vq->vdev))
> + reclaim_dma_bufs();
> +

...

> @@ -904,6 +1000,8 @@ static int port_fops_release(struct inode *inode, struct 
> file *filp)
>   reclaim_consumed_buffers(port);
>   spin_unlock_irq(>outvq_lock);
>  
> + if (is_rproc_serial(port->portdev->vdev))
> + reclaim_dma_bufs();

So these are redundant.

> @@ -1415,7 +1524,16 @@ static void remove_port_data(struct port *port)
>  
>   /* Remove buffers we queued up for the Host to send us data in. */
>   while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
> - free_buf(buf);
> + free_buf(buf, true);
> +
> + /*
> +  * Remove buffers from out queue for rproc-serial. We cannot afford
> +  * to leak any DMA mem, so reclaim this memory even if this might be
> +  * racy for the remote processor.
> +  */
> + if (is_rproc_serial(port->portdev->vdev))
> + while ((buf = virtqueue_detach_unused_buf(port->out_vq)))
> + free_buf(buf, true);
>  }

This seems wrong; either this is needed even if !is_rproc_serial(), or
it's not necessary as the out_vq is empty.

Every path I can see has the device reset (in which case the queues
should not be active), or we got a VIRTIO_CONSOLE_PORT_REMOVE event (in
which case, the same).

I think we can have non-blocking writes which could leave buffers in
out_vq: Amit?
>  static void __exit fini(void)
>  {
> + reclaim_dma_bufs();

Hmm, you didn't protect it here anyway...

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


Re: [PATCHv7 1/4] virtio_console: Free buffer if splice fails

2012-10-22 Thread Rusty Russell
sjur.brandel...@stericsson.com writes:
> From: Sjur Brændeland 
>
> Free the allocated scatter list if send_pages fails in function
> port_splice_write.
>
> Signed-off-by: Sjur Brændeland 

Didn't see Amit ack this, but applied anyway.

Thanks,
Rusty.
--
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 00/22] loop: Issue O_DIRECT aio using bio_vec

2012-10-22 Thread Dave Chinner
On Mon, Oct 22, 2012 at 07:53:40PM -0500, Dave Kleikamp wrote:
> On 10/22/2012 07:07 PM, Dave Chinner wrote:
> > On Mon, Oct 22, 2012 at 10:15:00AM -0500, Dave Kleikamp wrote:
> >> This is the current version of the patchset I presented at the LSF-MM
> >> Summit in San Francisco in April. I apologize for letting it go so
> >> long before re-submitting.
> >>
> >> This patchset was begun by Zach Brown and was originally submitted for
> >> review in October, 2009. Feedback was positive, and I have picked up
> >> where he left off, porting his patches to the latest mainline kernel
> >> and adding support more file systems.
> >>
> >> This patch series adds a kernel interface to fs/aio.c so that kernel code 
> >> can
> >> issue concurrent asynchronous IO to file systems.  It adds an aio command 
> >> and
> >> file system methods which specify io memory with pages instead of userspace
> >> addresses.
> >>
> >> This series was written to reduce the current overhead loop imposes by
> >> performing synchronus buffered file system IO from a kernel thread.  These
> >> patches turn loop into a light weight layer that translates bios into 
> >> iocbs.
> > 
> > I note that there is no support for XFS in this patch set. Is there
> > a particular problem that prevents XFS from being converted, or it
> > just hasn't been done?
> 
> It just hasn't been done. It wasn't one of the trivial ones so I put it
> off at first, and after that, it's an oversight. I'll follow up with an
> xfs patch for your review.

Thanks Shaggy, that's all I wanted to know. No extra work for me
(apart from review and testing) is fine by me. ;)

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.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/


Jitter

2012-10-22 Thread Uwaysi Bin Kareem

As those who have seen my posts on LKML, I am all about jitter.
10 years ago I said why not do an OpenGL desktop, and now we have wayland.
10 years ago, I said, don`t do excessive buffering, and now we have  
"fighting bufferbloat".
10 years ago, I talked about how responsive vintage computers was, without  
"OS".


And I have taken that further, and now work with low-jitter for the  
desktop. Low latency all the way, or atleast down to 0.2ms max latency and  
jitter.


In the mean time, the masses are unaware of jitter, unless it is very  
noticable such as recent discussions on "microstutter".
Most still advise to "not turn off services" in windows, yet show me  
benchmarks of "motherboards" with DPC latency of 50-300uS. I am already  
running at 5uS in windows here. And it is not "the motherboard". This is  
about OS-jitter.


And in linux, I am running with even less jitter, now trying rt-patch only  
at "low latency" preemption yet, but still. And even in the linuxcommunity  
many seem not to understand. Those who do are much higher then on windows  
though. And while many also make completely absurd statements and attack  
what I am doing, I am very happily running what feels like a high  
performance computer. With a lot of activity being there on the next  
frame, and ultrasmooth framerates in OpenGL. Indeed optimizing and  
removing jitter, seeing improvements on what goes on, on the highest  
performing bus in the computer, seems to improve general desktop computing.


I think I have tried most things now, and unless you want to wait 10 years  
for people to catch on, you should consider low-jitter aswell.


And I am also interested in any patches that currently are not mainline. -  
Please repost in this thread if you have any. Or any other information, or  
ongoing development. If it is not all in the RT patch, that is.


Peace Be With You.
--
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-10-22-17-08 uploaded (printk build errors)

2012-10-22 Thread Joe Perches
On Mon, 2012-10-22 at 18:22 -0700, Randy Dunlap wrote:
> On 10/22/2012 05:09 PM, a...@linux-foundation.org wrote:

Hi Randy.

> on i386, when CONFIG_PRINTK is not enabled:
[]
> case 1.  CONFIG_TTY_PRINTK=y, CONFIG_EARLY_PRINTK=y
> 
> see config-r8272

[]

> case 2.  CONFIG_TTY_PRINTK=n, CONFIG_EARLY_PRINTK=n
> 
> see config-r8274

Where do I see these configs?

I've built it here defconfig and CONFIG_PRINTK=n without warning.


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


Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6

2012-10-22 Thread Benjamin Herrenschmidt
On Mon, 2012-10-22 at 17:53 +0200, Michael Kerrisk (man-pages) wrote:

> This is all seems to make an awful muck of the API...

 .../...

> There seems to be a reasonable argument here for an mmap3() with a
> 64-bit flags argument...

I tend to agree. There's a similar issue happening when we try to shovel
things into protection bits, like we do with SAO (strong access
ordering) and want to do with per-page endian on embedded.

It think we need a pile of additional flag space.

Cheers,
Ben.

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


Re: [PATCH 3/3] workqueue: remove unused argument of wq_worker_waking_up()

2012-10-22 Thread JoonSoo Kim
2012/10/21 Tejun Heo :
> On Sun, Oct 21, 2012 at 01:30:07AM +0900, Joonsoo Kim wrote:
>> Commit 63d95a91 ('workqueue: use @pool instead of @gcwq or @cpu where
>> applicable') changes an approach to access nr_running.
>> Thus, wq_worker_waking_up() doesn't use @cpu anymore.
>> Remove it and remove comment related to it.
>>
>> Signed-off-by: Joonsoo Kim 
>
> I'm not sure whether I wanna remove or add WARN_ON_ONCE() on it.  That
> part has gone through some changes and seen some bugs.  Can we please
> do the following instead at least for now?
>
> if (!(worker->flags & WORKER_NOT_RUNNING)) {
> WARN_ON_ONCE(worker->pool->gcwq->cpu != cpu);
> atomic_inc(get_pool_nr_running(worker->pool));
> }
>

I have no objection to do this for now.
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: [ 02/37] lockd: use rpc clients cl_nodename for id encoding

2012-10-22 Thread Ben Hutchings
On Mon, 2012-10-22 at 17:02 +, Myklebust, Trond wrote:
> On Sun, 2012-10-21 at 09:26 -0700, Greg Kroah-Hartman wrote:
> > On Sat, Oct 20, 2012 at 12:15:18AM +0100, Ben Hutchings wrote:
> > > On Thu, Oct 18, 2012 at 08:16:25PM -0700, Greg Kroah-Hartman wrote:
> > > > 3.0-stable review patch.  If anyone has any objections, please let me 
> > > > know.
> > > > 
> > > > --
> > > > 
> > > > From: Stanislav Kinsbursky 
> > > > 
> > > > commit 303a7ce92064c285a04c870f2dc0192fdb2968cb upstream.
> > > > 
> > > > Taking hostname from uts namespace if not safe, because this cuold be
> > > > performind during umount operation on child reaper death. And in this 
> > > > case
> > > > current->nsproxy is NULL already.
> > >  
> > > In this case (3.0.y) you haven't included the following change
> > > (commit cb7323fffa85 'lockd: create and use per-net NSM RPC clients on
> > > MON/UNMON requests') that makes lockd actually use cl_nodename.  I
> > > think this patch alone won't fix the bug, as nsm_args::nodename can
> > > end up pointing to freed memory.
> > > 
> > > (I also wonder whether clients should really be per-net or per UTS
> > > namespace, and whether those should be orthogonal namespaces at all.)
> > 
> > Hm, Trond, should I also include the other commit above in the next
> > 3.0-stable release?
> > 
> > Or should this one be dropped?
> 
> Hi Greg,
> 
> Applying this patch shouldn't be harmful, but since it isn't actually
> fixing a problem (there being no net-namespace code in Linux-3.0), I'd
> suggest just dropping it.

If I understand rightly:
1. Prior to introduction of the per-netns clients, nsm_monitor() and
nsm_unmonitor() are called from a kthread which runs in the initial net
and utsname namespace.
2. Therefore, in nsm_mon_unmon(), current->nsproxy always refers to the
initial namespaces and is never NULL.
3. The per-netns clients were introduced in 3.5, so only 3.6.y needed
fixing.
4. However, this one change is harmless for earlier versions.

(I think that point 1 is not quite true in that nsm_unmonitor() can also
be called on module removal, potentially in something other than the
initial utsname namespace.  But it still won't result in a crash, and
it's hardly worth worrying about.)

Ben.

-- 
Ben Hutchings
Humour is the best antidote to reality.


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


Re: [PATCH v2 1/2] Replace if statement with WARN_ON_ONCE() in cmci_rediscover().

2012-10-22 Thread Tang Chen

On 10/22/2012 06:14 PM, Borislav Petkov wrote:

On Mon, Oct 22, 2012 at 10:10:24AM +0800, Tang Chen wrote:

I don't why before we just jumped over it. But I think if we have an
online cpu == dying here, it must be wrong. So I think we should warn
it, not just jump over it.


Why do we need to warn? What good would that bring us?

AFAICT, the check in cmci_rediscover is there to make sure we absolutely
don't rediscover on the dying cpu. I think it is a safety precaution in
concurrency scenarios between cpu hotplug and mce code.


Hi Borislav,

As I said, cmci_rediscover() is only used to handle CPU_POST_DEAD event.
And is uses for_each_online_cpu to iterate all online cpus. If we get a
online cpu == dying, I think we are in a wrong situation. I think at
least, we should give a warning.

Thanks. :)



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/


[PATCH] ARM: Fix page counting in mem_init and show_mem

2012-10-22 Thread Michael Spang
The code in mem_init & show_mem to count page usage has two issues:

1. It assumes the memory map for a bank is contiguous. The sparsemem
   memory model partitions the memory map into sections, which may not
   be contiguous. They are usually contiguous due only to allocation
   order. Avoid this by using pfn_to_page for each page.

   If the memory map is not contiguous the pointer math works out
   badly and crashes the system.

2. A memory bank may have holes. Some regions may be removed using
   memblock_remove, and will not have valid page stucts. The code
   should not access the page structs for such pages. Avoid this by
   skipping pages that fail pfn_valid().

   If the memory map has holes, the free & total page counts are
   wrong.

Signed-off-by: Michael Spang 
---
 arch/arm/mm/init.c |   40 ++--
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c21d06c..97d811a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -101,16 +101,19 @@ void show_mem(unsigned int filter)
 
for_each_bank (i, mi) {
struct membank *bank = >bank[i];
-   unsigned int pfn1, pfn2;
-   struct page *page, *end;
+   unsigned int start, end, pfn;
 
-   pfn1 = bank_pfn_start(bank);
-   pfn2 = bank_pfn_end(bank);
+   start = bank_pfn_start(bank);
+   end = bank_pfn_end(bank);
 
-   page = pfn_to_page(pfn1);
-   end  = pfn_to_page(pfn2 - 1) + 1;
+   for (pfn = start; pfn < end; pfn++) {
+   struct page *page;
+
+   if (!pfn_valid(pfn))
+   continue;
+
+   page = pfn_to_page(pfn);
 
-   do {
total++;
if (PageReserved(page))
reserved++;
@@ -122,8 +125,7 @@ void show_mem(unsigned int filter)
free++;
else
shared += page_count(page) - 1;
-   page++;
-   } while (page < end);
+   }
}
 
printk("%d pages of RAM\n", total);
@@ -619,22 +621,24 @@ void __init mem_init(void)
 
for_each_bank(i, ) {
struct membank *bank = [i];
-   unsigned int pfn1, pfn2;
-   struct page *page, *end;
+   unsigned int start, end, pfn;
 
-   pfn1 = bank_pfn_start(bank);
-   pfn2 = bank_pfn_end(bank);
+   start = bank_pfn_start(bank);
+   end = bank_pfn_end(bank);
 
-   page = pfn_to_page(pfn1);
-   end  = pfn_to_page(pfn2 - 1) + 1;
+   for (pfn = start; pfn < end; pfn++) {
+   struct page *page;
+
+   if (!pfn_valid(pfn))
+   continue;
+
+   page = pfn_to_page(pfn);
 
-   do {
if (PageReserved(page))
reserved_pages++;
else if (!page_count(page))
free_pages++;
-   page++;
-   } while (page < end);
+   }
}
 
/*
-- 
1.7.7.3

--
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: Heads-up: 3.6.2 / 3.6.3 NFS server panic: 3.6.2+ regression?

2012-10-22 Thread J. Bruce Fields
On Mon, Oct 22, 2012 at 05:17:04PM +0100, Nix wrote:
> I just had a panic/oops on upgrading from 3.6.1 to 3.6.3, after weeks of
> smooth operation on 3.6.1: one of the NFS changes that went into one of
> the two latest stable kernels appears to be lethal after around half an
> hour of uptime. The oops came from NFSv4, IIRC (relying on memory since
> my camera was recharging and there is no netconsole from that box
> because it is where the netconsole logs go, so I'll have to reproduce it
> later today). The machine is an NFSv3 server only at present, with no
> NFSv4 running (though NFSv4 is built in).

Note recent clients may try to negotiate NFSv4 by default, so it's
possible to use it without knowing.

You didn't change anything else about your server or clients recently?

> This is just a heads-up, not intended to be sufficient to track it down
> unless it is instantly obvious: more later, including a .config dump and
> proper oops report if it turns out to be reproducible. I just have to
> recover from the usual panic-induced fs corruption and take a backup
> first.

Thanks.

I don't see an obvious candidate on a quick skim of v3.6.1..v3.6.3
commits, but of course I could be missing something.

--b.
--
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] kbuild: fix xargs error on make distclean

2012-10-22 Thread Fengguang Wu
/usr/bin/xargs: unmatched single quote; by default quotes are special to xargs 
unless you use the -0 option

Signed-off-by: Fengguang Wu 
---
 Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index bb9fff2..e5a64cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1033,7 +1033,7 @@ distclean: mrproper
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-   -type f -print | xargs rm -f
+   -type f -print0 | xargs -0 rm -f
 
 
 # Packaging of the kernel to various formats
-- 
1.7.10

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


Re: [PATCH v2 2/2] Do not change worker's running cpu in cmci_rediscover().

2012-10-22 Thread Tang Chen

On 10/22/2012 06:18 PM, Borislav Petkov wrote:

On Mon, Oct 22, 2012 at 11:33:16AM +0800, Tang Chen wrote:

I have 2 nodes, node0 and node1. node1 could be hotpluged.
node0 has cpu0 ~ cpu15, node1 has cpu16 ~ cpu31.

I online all the cpus on node1, and hot-remove node1 directly.


Hold on, I need to ask here: you soft-online all cores on node1 and
*then* you *hot* *remove* it? So with all cores online you physically
take out the processor from the socket? Am I reading this correctly?


Hi Borislav,

No, it's not like that. I'm sorry to make you confused.

Firstly, let me do a little explanation here. :)

I was doing ACPI based hotplug. In a container device, it contains
cpus and memories and so on. I didn't physically remove cpus from
hardware. I emulated a SCI with my own test module, and the
container_notify_cb() was called, and it recursively remove all the
sub-devices.

The "remove" here doesn't mean "taking it away". And of course, when
the "remove" is done, you can physically take the whole system board
away.

Please refer to this url:
http://www.spinics.net/lists/linux-pci/msg17651.html
This is the module we are doing the SCI emulation.

In summary, the hotplug process could be like the following:

hot-add(SCI) -> online(softly) -> device working -> offline(softly) -> 
hot-remove(SCI)



Secondly, in kernel, before a container device is removed, all its
sub-devices will be offlined and removed first. So I have all the cpus
online, and hot-remove a container(which I think is a node, maybe not)
directly. This operation has no problem, I think.

Maybe I should not say container as a node. :)

And again, sorry for the confusion.

Thanks. :)




Thanks.



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


Re: [PATCH 1/2] Staging: android: binder: Fix memory leak on thread/process exit

2012-10-22 Thread Arve Hjønnevåg
On Mon, Oct 22, 2012 at 1:00 PM, Greg KH  wrote:
> On Tue, Oct 16, 2012 at 03:45:20PM -0700, Arve Hjønnevåg wrote:
>> On Tue, Oct 16, 2012 at 12:11 AM, Greg KH  wrote:
>> > On Mon, Oct 15, 2012 at 05:32:41PM -0700, Arve Hjønnevåg wrote:
>> >> If a thread or process exited while a reply, one-way transaction or
>> >> death notification was pending, the struct holding the pending work
>> >> was leaked.
>> >>
>> >> Change-Id: I2eaafaba1c0ecda3ec0872d449dc16d0721c21e7
>> >
>> > What is this field?  Please don't include this in kernel patches, it
>> > forces me to edit the patch by hand :(
>> >
>>
>> It is a tag generated a git hook to uniquely identify a change through
>> multiple revisions of that change. If the tag does not already exist
>> the hook adds it. I removed it from the reposted patches as you
>> requested, but have you considered leaving it in? It is a useful
>> search token both for finding different revisions of a patch and for
>> finding which branch a change has been cherry-picked into.
>
> Sorry, I was being facetious, I knew what it really was, but the point
> was, why would I?
>

So you can use it. If, for instance, you want to see which branches
you cherry-picked this change into you can run "git rev-list --all
--grep I2eaafaba1c0ecda3ec0872d449dc16d0721c21e7 | xargs -rl git
branch -a --contains". If it was more widely used, it would also be
useful for finding mailing list discussion of multiple versions of
patches (even when the title of the patch changes).

> As has been stated before, you can include information like this in your
> patch, but you MUST reference it properly so that others can be able to
> figure out what you mean.  A random Change-Id value means nothing given
> that lots of different groups use gerrit.  You need a url, or a pointer
> to which gerrit instance this refers to before you can include it.
>

There is no single url. The tag was generated by a local git hook
before it was uploaded anywhere. While gerrit looks for this tag and
use it when it is there, the same change can be uploaded to different
gerrit instances. While it would be useful to also include urls to the
gerrit instance(s) that a patch was discussed on, the Change-Id is
useful by itself.

> Same goes for bugzilla entries, if you look in the kernel changelog, we
> reference lots of different ones, but we use urls to determine which one
> we are talking about (suse, red hat, kernel.org, etc.)
>

Those IDs appear to be local to a specific server, so the id without
the url would not be very useful.

-- 
Arve Hjønnevåg
--
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 00/22] loop: Issue O_DIRECT aio using bio_vec

2012-10-22 Thread Dave Kleikamp
On 10/22/2012 07:07 PM, Dave Chinner wrote:
> On Mon, Oct 22, 2012 at 10:15:00AM -0500, Dave Kleikamp wrote:
>> This is the current version of the patchset I presented at the LSF-MM
>> Summit in San Francisco in April. I apologize for letting it go so
>> long before re-submitting.
>>
>> This patchset was begun by Zach Brown and was originally submitted for
>> review in October, 2009. Feedback was positive, and I have picked up
>> where he left off, porting his patches to the latest mainline kernel
>> and adding support more file systems.
>>
>> This patch series adds a kernel interface to fs/aio.c so that kernel code can
>> issue concurrent asynchronous IO to file systems.  It adds an aio command and
>> file system methods which specify io memory with pages instead of userspace
>> addresses.
>>
>> This series was written to reduce the current overhead loop imposes by
>> performing synchronus buffered file system IO from a kernel thread.  These
>> patches turn loop into a light weight layer that translates bios into iocbs.
> 
> I note that there is no support for XFS in this patch set. Is there
> a particular problem that prevents XFS from being converted, or it
> just hasn't been done?

It just hasn't been done. It wasn't one of the trivial ones so I put it
off at first, and after that, it's an oversight. I'll follow up with an
xfs patch for your review.

Thanks,
Shaggy

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


Re: [PATCH 2/2] slab: move kmem_cache_free to common code

2012-10-22 Thread JoonSoo Kim
Hello, Glauber.

2012/10/23 Glauber Costa :
> On 10/22/2012 06:45 PM, Christoph Lameter wrote:
>> On Mon, 22 Oct 2012, Glauber Costa wrote:
>>
>>> + * kmem_cache_free - Deallocate an object
>>> + * @cachep: The cache the allocation was from.
>>> + * @objp: The previously allocated object.
>>> + *
>>> + * Free an object which was previously allocated from this
>>> + * cache.
>>> + */
>>> +void kmem_cache_free(struct kmem_cache *s, void *x)
>>> +{
>>> +__kmem_cache_free(s, x);
>>> +trace_kmem_cache_free(_RET_IP_, x);
>>> +}
>>> +EXPORT_SYMBOL(kmem_cache_free);
>>> +
>>
>> This results in an additional indirection if tracing is off. Wonder if
>> there is a performance impact?
>>
> if tracing is on, you mean?
>
> Tracing already incurs overhead, not sure how much a function call would
> add to the tracing overhead.
>
> I would not be concerned with this, but I can measure, if you have any
> specific workload in mind.

With this patch, kmem_cache_free() invokes __kmem_cache_free(),
that is, it add one more "call instruction" than before.

I think that Christoph's comment means above fact.

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


Re: [PATCH v1 2/2] x86, apic: Disable BSP if boot cpu is AP

2012-10-22 Thread H. Peter Anvin

On 10/22/2012 02:29 PM, Eric W. Biederman wrote:


As I said, I thought Fenghua tried that but it didn't work, experimentally.


Fair enough.  You described the problem with clearing bit 8 in a weird
way.

If the best we can muster are fuzzy memories it may be worth revisiting.
Perhaps it works on enough cpu models to be interesting.



It isn't fuzzy memories... this was done as late as 1-2 months ago.  I 
just don't know the details.


Fenghua, could you help fill us in?

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--
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: Drivers: hv

2012-10-22 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Monday, October 22, 2012 7:58 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; de...@linuxdriverproject.org; 
> o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: Drivers: hv
> 
> On Mon, Oct 22, 2012 at 05:12:04PM -0700, K. Y. Srinivasan wrote:
> > Greg,
> >
> > Over the last several weeks I have sent you a few patches.
> > This includes the new balloon driver for Hyper-V.
> > As far as I know, I think I have addressed all the review
> > comments I have received. I just want to make sure that you are
> > not waiting for me to address some pending issues on these patches.
> > I am now  starting some new work and I would rather
> > first address all the pending issues, if any, before submitting
> > more new patches. Let me know if I should resubmit these patches.
> 
> I have yet to get through my pending patches for 3.8 that have
> accumulated over the past weeks, so I really have no idea, sorry.
> 
> Give me a week or so.

Ok; I will wait another week before pinging you again.
> 
> When in doubt, resend.  Don't expect me to remember the status of your
> specific patches in my 1000+ patch queue at the moment.

I obviously don't want to flood your already "packed" inbox. I  am hoping you 
have not dropped
any of these patches since these were either resends that addressed review 
comments or patches that
have had no issues that have been reported. In any event, I will wait a week 
and then see if I should
resend them.

Regards,

K. Y


--
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] ledtrig-cpu: use spin_lock to replace mutex lock

2012-10-22 Thread Rafael J. Wysocki
On Monday 22 of October 2012 16:15:58 Bryan Wu wrote:
> On Mon, Oct 22, 2012 at 3:38 PM, Rafael J. Wysocki  wrote:
> > On Monday 22 of October 2012 11:59:19 Bryan Wu wrote:
> >> Hiya,
> >>
> >> Can I get some Acked or Tested-by from Rafael or Miles before I put it
> >> in my linux-leds tree?
> >
> > Well, I just explained why the current code didn't work. :-)
> >
> > Anyway, please feel free to add
> >
> > Acked-by: Rafael J. Wysocki 
> >
> 
> I was just reminded by Nathan Lynch  most of
> led-trigger API like register/unregister/event are potentially sleep.
> They should not be used in atomic context. Any suggestion to fix it?

Well, design ledtrig_cpu_syscore_suspend() so that it can be called from
atomic context?  You can use the observation that no locking is necessary
in that routine to simplify it, perhaps.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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: tools/vm build fails

2012-10-22 Thread Fengguang Wu
Hi Daniel,

On Mon, Oct 22, 2012 at 08:00:56PM -0400, Daniel Hazelton wrote:
> After doing any build in the kernel (last attempt was an
> allmodconfig) I've tried to build the 'vm' tool in tools/vm and the
> build fails - looks to be fallout from the uapi header work.
> 
> [madman@localhost tools]$ make V=1 vm
> make -C vm/
> make[1]: Entering directory `/home/madman/sources/linux-2.6/tools/vm'
> gcc -Wall -Wextra -o page-types page-types.c
> In file included from page-types.c:38:0:
> ../../include/linux/kernel-page-flags.h:4:42: fatal error:
> uapi/linux/kernel-page-flags.h: No such file or directory
> compilation terminated.
> make[1]: *** [page-types] Error 1
> make[1]: Leaving directory `/home/madman/sources/linux-2.6/tools/vm'
> make: *** [vm] Error 2

That must be related to:

commit 607ca46e97a1b6594b29647d98a32d545c24bdff
Author: David Howells 

UAPI: (Scripted) Disintegrate include/linux


It should be trivially fixable in several ways, and David must know
the best way. :)

Thanks,
Fengguang
--
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] serial: 8250 check iir rdi in interrupt

2012-10-22 Thread Min Zhang
The patch works around two UART interrupt bugs when the serial console is 
flooded with inputs:

1. syslog shows "serial8250: too much works for irq"
2. serial console stops responding to key stroke

serial8250_handle_irq() checks UART_IIR_RDI before reading receive fifo
and clears bogus interrupt UART_IIR_RDI without accompanying UART_LSR_DR,
otherwise RDI interrupt could freeze or too many unhandled RDI interrupts.

Added module parameter skip_rdi_check to opt out this workaround.

Tested on Radisys ATCA 46XX which uses FPGA 16550-compatible and
other generic 16550 UART. It takes from an hour to days to reproduce by
pumping inputs to serial console continously using TeraTerm script:

---
 drivers/tty/serial/8250/8250.c |   55 
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 3ba4234..838dd22 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -64,6 +64,7 @@ static int serial_index(struct uart_port *port)
 }

 static unsigned int skip_txen_test; /* force skip of txen test at init time */
+static unsigned int skip_rdi_check; /* skip of IIR RDI check in interrupt */

 /*
  * Debugging.
@@ -1479,6 +1480,51 @@ unsigned int serial8250_modem_status(struct 
uart_8250_port *up)
 EXPORT_SYMBOL_GPL(serial8250_modem_status);

 /*
+ * Check if status UART_LSR_RD accompanies with interrupt UART_IIR_RDI.
+ * If they are mismatch, massage the status or interupt cause accordingly:
+ *
+ * Return a cleared UART_LSR_RD status if there is no accompanying
+ * UART_IIR_RDI. Hopefully the new status is used by interrupt handler
+ * to skip reading receive FIFO. Otherwise some UART controller stops
+ * generating RDI interrupt after this unnotified FIFO read, until other
+ * interrupts maybe transmit interrupt reads UART_LSR again.
+ *
+ * Or clear interrupt cause UART_IIR_RDI without UART_LSR_RD. The UART sets
+ * UART_IIR_RDI *even* if the received data has been read out from the FIFO
+ * before the timeout occurs.  To clear UART_IIR_RDI, read receive buffer
+ * register. Reading it also clears timeout interrupt for 16550+. Otherwise
+ * the uncleared UART_IIR_RDI will keep triggering IRQ but interrupt
+ * handler finds nothing to do.
+ *
+ * Skip this workaround if interrupt is not expected, such as backup timer,
+ * so that handler can still solely rely on original status register.
+ */
+static unsigned char serial8250_iir_rdi_check(struct uart_8250_port *up,
+unsigned char status,
+unsigned int iir)
+{
+   unsigned int ier, rdi_stat, rdi_intr;
+
+   /* skip for handler without interrupt */
+   if (!up->port.irq)
+   return status;
+
+   /* skip for polling handler such as backup timer */
+   ier = serial_in(up, UART_IER);
+   if (!(ier & UART_IER_RDI))
+   return status;
+
+   rdi_stat = status & UART_LSR_DR;
+   rdi_intr = iir & UART_IIR_RDI;
+
+   if (rdi_stat && !rdi_intr)
+   status &= ~UART_LSR_DR;
+   else if (!rdi_stat && rdi_intr)
+   serial_in(up, UART_RX);
+   return status;
+}
+
+/*
  * This handles the interrupt from one port.
  */
 int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
@@ -1497,6 +1543,12 @@ int serial8250_handle_irq(struct uart_port *port, 
unsigned int iir)

DEBUG_INTR("status = %x...", status);

+   /* Some UART controller has mismatched UART_IIR_RDI and UART_LSR_DR,
+  which causes either too many interrupts or interrupt freeze
+*/
+   if (!skip_rdi_check)
+   status = serial8250_iir_rdi_check(up, status, iir);
+
if (status & (UART_LSR_DR | UART_LSR_BI))
status = serial8250_rx_chars(up, status);
serial8250_modem_status(up);
@@ -3338,6 +3390,9 @@ MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. 
(1-" __MODULE_STR
 module_param(skip_txen_test, uint, 0644);
 MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init 
time");

+module_param(skip_rdi_check, uint, 0644);
+MODULE_PARM_DESC(skip_rdi_check, "Skip checking IIR RDI bug in interrupt");
+
 #ifdef CONFIG_SERIAL_8250_RSA
 module_param_array(probe_rsa, ulong, _rsa_count, 0444);
 MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
--
1.7.7.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/


[git pull] drm fixes

2012-10-22 Thread Dave Airlie

Hi Linus,

fixes for intel and nouveau mainly.

intel: disable HSW by default, sdvo fixes, link train regression fix
nouveau: acpi rom loading regression fix, with a few other fixes from the 
rework
core: just other minor fixes and race fixes for ttm.

Dave.

The following changes since commit 6f0c0580b70c89094b3422ba81118c7b959c7556:

  Linux 3.7-rc2 (2012-10-20 12:11:32 -0700)

are available in the git repository at:
  git://people.freedesktop.org/~airlied/linux drm-fixes

Ben Skeggs (4):
  drm/nouveau/bios: fetch full 4KiB block to determine ACPI ROM image size
  drm/nv41/vm: don't init hw pciegart on boards with agp bridge
  drm/nouveau/fb: fix reporting of memory type on GF8+ IGPs
  drm/nouveau/clock: fix missing pll type/addr when matching default entry

Chris Wilson (2):
  drm/i915: Add no-lvds quirk for Supermicro X7SPA-H
  drm/i915: Initialize obj->pages before use by 
i915_gem_object_do_bit17_swizzle()

Daniel Vetter (2):
  Revert "drm/i915: Try harder to complete DP training pattern 1"
  drm/i915: shut up spurious WARN in the gtt fault handler

Dave Airlie (2):
  Merge branch 'drm-intel-fixes' of 
git://people.freedesktop.org/~danvet/drm-intel into drm-fixes
  Merge branch 'drm-nouveau-fixes' of 
git://git.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes

Egbert Eich (4):
  DRM/i915: Don't delete DPLL Multiplier during DAC init.
  DRM/i915: Add QUIRK_INVERT_BRIGHTNESS for NCR machines.
  DRM/i915: Don't clone SDVO LVDS with analog.
  DRM/i915: Restore sdvo_flags after dtd->mode->dtd Roundrtrip.

Marcin Slusarz (5):
  drm/nouveau: handle same-fb page flips
  drm/nouveau: fix nouveau_mm/nouveau_mm_node leak
  drm/nouveau: warn when trying to free mm which is still in use
  drm/nouveau: validate vbios size
  drm/debugfs: remove redundant info from gem_names

Martin Peres (1):
  drm/nouveau/bios: improve error handling when reading the vbios from ACPI

Rodrigo Vivi (1):
  drm/i915: Insert i915_preliminary_hw_support variable.

Thierry Reding (3):
  drm: fb: cma: Fix typo in debug message
  drm: fb: cma: Fail gracefully on allocation failure
  drm: platform: Don't initialize driver-private data

Thomas Hellstrom (2):
  drm/ttm: Fix a theoretical race
  drm/ttm: Fix a theoretical race in ttm_bo_cleanup_refs()

 drivers/gpu/drm/drm_fb_cma_helper.c |4 +-
 drivers/gpu/drm/drm_info.c  |2 -
 drivers/gpu/drm/drm_platform.c  |1 -
 drivers/gpu/drm/i915/i915_drv.c |   13 +
 drivers/gpu/drm/i915/i915_drv.h |1 +
 drivers/gpu/drm/i915/i915_gem.c |7 +++-
 drivers/gpu/drm/i915/intel_crt.c|   15 +--
 drivers/gpu/drm/i915/intel_display.c|   32 +++
 drivers/gpu/drm/i915/intel_dp.c |   15 +++---
 drivers/gpu/drm/i915/intel_lvds.c   |8 +
 drivers/gpu/drm/i915/intel_sdvo.c   |   14 +++---
 drivers/gpu/drm/nouveau/core/core/gpuobj.c  |5 +++
 drivers/gpu/drm/nouveau/core/core/mm.c  |2 +-
 drivers/gpu/drm/nouveau/core/subdev/bios/base.c |   30 -
 drivers/gpu/drm/nouveau/core/subdev/bios/pll.c  |   10 +++
 drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c   |1 +
 drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c   |3 +-
 drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c   |3 +-
 drivers/gpu/drm/nouveau/nouveau_display.c   |   14 ++---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c|   12 +++-
 drivers/gpu/drm/ttm/ttm_bo.c|   24 ++---
 21 files changed, 148 insertions(+), 68 deletions(-)
--
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/


mmotm 2012-10-22-17-08 uploaded

2012-10-22 Thread akpm
The mm-of-the-moment snapshot 2012-10-22-17-08 has been uploaded to

   http://www.ozlabs.org/~akpm/mmotm/

mmotm-readme.txt says

README for mm-of-the-moment:

http://www.ozlabs.org/~akpm/mmotm/

This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
more than once a week.

You will need quilt to apply these patches to the latest Linus release (3.x
or 3.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
http://ozlabs.org/~akpm/mmotm/series

The file broken-out.tar.gz contains two datestamp files: .DATE and
.DATE--mm-dd-hh-mm-ss.  Both contain the string -mm-dd-hh-mm-ss,
followed by the base kernel version against which this patch series is to
be applied.

This tree is partially included in linux-next.  To see which patches are
included in linux-next, consult the `series' file.  Only the patches
within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in
linux-next.

A git tree which contains the memory management portion of this tree is
maintained at git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git
by Michal Hocko.  It contains the patches which are between the
"#NEXT_PATCHES_START mm" and "#NEXT_PATCHES_END" markers, from the series
file, http://www.ozlabs.org/~akpm/mmotm/series.


A full copy of the full kernel tree with the linux-next and mmotm patches
already applied is available through git within an hour of the mmotm
release.  Individual mmotm releases are tagged.  The master branch always
points to the latest release, so it's constantly rebasing.

http://git.cmpxchg.org/?p=linux-mmotm.git;a=summary

To develop on top of mmotm git:

  $ git remote add mmotm 
git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git
  $ git remote update mmotm
  $ git checkout -b topic mmotm/master
  
  $ git send-email mmotm/master.. [...]

To rebase a branch with older patches to a new mmotm release:

  $ git remote update mmotm
  $ git rebase --onto mmotm/master  topic




The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second)
contains daily snapshots of the -mm tree.  It is updated more frequently
than mmotm, and is untested.

A git copy of this tree is available at

http://git.cmpxchg.org/?p=linux-mmots.git;a=summary

and use of this tree is similar to
http://git.cmpxchg.org/?p=linux-mmotm.git, described above.


This mmotm tree contains the following patches against 3.7-rc2:
(patches marked "*" will be included in linux-next)

  origin.patch
  mm-fix-xfs-oops-due-to-dirty-pages-without-buffers-on-s390.patch
  cgroup-fix-invalid-rcu-dereference.patch
  device_cgroup-rename-deny_all-to-behavior.patch
  device_cgroup-stop-using-simple_strtoul.patch
  device_cgroup-add-proper-checking-when-changing-default-behavior.patch
  backlight-ili9320-add-missing-spi-dependency.patch
  revert-epoll-support-for-disabling-items-and-a-self-test-app.patch
  linux-next.patch
  linux-next-git-rejects.patch
  i-need-old-gcc.patch
  arch-alpha-kernel-systblss-remove-debug-check.patch
* 
mm-vmscan-scale-number-of-pages-reclaimed-by-reclaim-compaction-only-in-direct-reclaim.patch
* proc-check-vma-vm_file-before-dereferencing.patch
* memstick-remove-unused-field-from-state-struct.patch
* memstick-ms_block-fix-complile-issue.patch
* memstick-use-after-free-in-msb_disk_release.patch
* memstick-memory-leak-on-error-in-msb_ftl_scan.patch
* cris-fix-i-o-macros.patch
* selinux-fix-sel_netnode_insert-suspicious-rcu-dereference.patch
* vfs-d_obtain_alias-needs-to-use-as-default-name.patch
* cpu_hotplug-unmap-cpu2node-when-the-cpu-is-hotremoved.patch
* cpu_hotplug-unmap-cpu2node-when-the-cpu-is-hotremoved-fix.patch
* 
acpi_memhotplugc-fix-memory-leak-when-memory-device-is-unbound-from-the-module-acpi_memhotplug.patch
* acpi_memhotplugc-free-memory-device-if-acpi_memory_enable_device-failed.patch
* acpi_memhotplugc-remove-memory-info-from-list-before-freeing-it.patch
* 
acpi_memhotplugc-dont-allow-to-eject-the-memory-device-if-it-is-being-used.patch
* acpi_memhotplugc-bind-the-memory-device-when-the-driver-is-being-loaded.patch
* 
acpi_memhotplugc-auto-bind-the-memory-device-which-is-hotplugged-before-the-driver-is-loaded.patch
* 
arch-x86-platform-iris-irisc-register-a-platform-device-and-a-platform-driver.patch
* x86-numa-dont-check-if-node-is-numa_no_node.patch
* arch-x86-tools-insn_sanityc-identify-source-of-messages.patch
* uv-fix-incorrect-tlb-flush-all-issue.patch
* olpc-fix-olpc-xo1-scic-build-errors.patch
* fs-debugsfs-remove-unnecessary-inode-i_private-initialization.patch
* pcmcia-move-unbind-rebind-into-dev_pm_opscomplete.patch
* drm-i915-optimize-div_round_closest-call.patch
  cyber2000fb-avoid-palette-corruption-at-higher-clocks.patch
* timeconstpl-remove-deprecated-defined-array.patch
* time-dont-inline-export_symbol-functions.patch
* h8300-select-generic-atomic64_t-support.patch
* cciss-cleanup-bitops-usage.patch
* cciss-use-check_signature.patch
* block-store-partition_meta_infouuid-as-a-string.patch
* 

Re: [PATCH 2/5] ACPI: Reorder IPMI driver before any other ACPI drivers

2012-10-22 Thread Matthew Garrett
On Mon, Oct 22, 2012 at 05:07:03PM -0700, Andrew Morton wrote:
> On Tue, 23 Oct 2012 01:00:34 +0100
> Matthew Garrett  wrote:
> > Not really - some of this code can be built as modules, so it's mostly 
> > module_init rather than anything from the initcall family.
> > 
> 
> hm.  So the ACPI code has found a way to defeat depmod? 

We don't express dependencies between available operation regions and 
the code that supports them. Most are set up in the core ACPI code and 
so the problem is avoided, but the IPMI code is a separate chunk.

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


  1   2   3   4   5   6   7   8   9   10   >