Re: 4.4-rc5: ugly warn on: 5 W+X pages found

2015-12-14 Thread Pavel Machek
On Mon 2015-12-14 13:24:08, Arjan van de Ven wrote:
> 
> >That's weird.  The only API to do that seems to be manually setting
> >kmap_prot to _PAGE_KERNEL_EXEC, and nothing does that.  (Why is
> >kmap_prot a variable on x86 at all?  It has exactly one writer, and
> >that's the code that initializes it in the first place.  Shouldn't we
> >#define kmap_prot _PAGE_KERNEL?
> 
> iirc it changes based on runtime detection of NX capability

Huh. Is it possible that core duo is so old that it has no NX?

processor  : 1
vendor_id  : GenuineIntel
cpu family : 6
model: 14
model name   : Genuine Intel(R) CPU   T2400  @ 1.83GHz
stepping : 8
microcode: 0x39
...
wp   : yes
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr
pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx
constant_tsc arch_perfmon bts aperfmperf pni monitor vmx est tm2 xtpr
pdcm dtherm

No, it lists nx in flags. Linus asked me about trying without
CONFIG_EFI. I should have no EFI here, but I'll try it.

I turned off CONFIG_EFI, but CONFIG_UEFI_CPER can't seem to be
disabled easily.

Still:

[3.269750] WARNING: CPU: 1 PID: 1 at
arch/x86/mm/dump_pagetables.c:225 note_page+0x5ec/0x790()
[3.271999] x86/mm: Found insecure W+X mapping at address
ffe69000/0xffe69000

pavel@duo:~$ zcat /proc/config.gz  | grep EFI
# CONFIG_EFI_PARTITION is not set
# CONFIG_EFI is not set
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
CONFIG_UEFI_CPER=y
pavel@duo:~$

Ok, I managed to turn off even CONFIG_UEFI_CPER after some fight, but
result is the same.

(Hmm... I'll probably regret it, but... I guess config.gz does contain
some information useful for the attacker. How long till some "hardened
distro" chmods it to 600?)

Best regards,

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.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 08/11] KVM: MMU: use page track for non-leaf shadow pages

2015-12-14 Thread Kai Huang



On 12/01/2015 02:26 AM, Xiao Guangrong wrote:

non-leaf shadow pages are always write protected, it can be the user
of page track

Signed-off-by: Xiao Guangrong 
---
  arch/x86/include/asm/kvm_page_track.h |  8 +
  arch/x86/kvm/mmu.c| 26 +---
  arch/x86/kvm/page_track.c | 58 +++
  3 files changed, 67 insertions(+), 25 deletions(-)

diff --git a/arch/x86/include/asm/kvm_page_track.h 
b/arch/x86/include/asm/kvm_page_track.h
index 6744234..3447dac 100644
--- a/arch/x86/include/asm/kvm_page_track.h
+++ b/arch/x86/include/asm/kvm_page_track.h
@@ -41,8 +41,16 @@ int kvm_page_track_create_memslot(struct kvm_memory_slot 
*slot,
  void kvm_page_track_free_memslot(struct kvm_memory_slot *free,
 struct kvm_memory_slot *dont);
  
+void

+kvm_slot_page_track_add_page_nolock(struct kvm *kvm,
+   struct kvm_memory_slot *slot, gfn_t gfn,
+   enum kvm_page_track_mode mode);
  void kvm_page_track_add_page(struct kvm *kvm, gfn_t gfn,
 enum kvm_page_track_mode mode);
+void kvm_slot_page_track_remove_page_nolock(struct kvm *kvm,
+   struct kvm_memory_slot *slot,
+   gfn_t gfn,
+   enum kvm_page_track_mode mode);
  void kvm_page_track_remove_page(struct kvm *kvm, gfn_t gfn,
enum kvm_page_track_mode mode);
  bool kvm_page_track_check_mode(struct kvm_vcpu *vcpu, gfn_t gfn,
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b23f9fc..5a2ca73 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -806,11 +806,17 @@ static void account_shadowed(struct kvm *kvm, struct 
kvm_mmu_page *sp)
struct kvm_memory_slot *slot;
gfn_t gfn;
  
+	kvm->arch.indirect_shadow_pages++;

gfn = sp->gfn;
slots = kvm_memslots_for_spte_role(kvm, sp->role);
slot = __gfn_to_memslot(slots, gfn);
+
+   /* the non-leaf shadow pages are keeping readonly. */
+   if (sp->role.level > PT_PAGE_TABLE_LEVEL)
+   return kvm_slot_page_track_add_page_nolock(kvm, slot, gfn,
+   KVM_PAGE_TRACK_WRITE);
+
kvm_mmu_gfn_disallow_lpage(slot, gfn);
-   kvm->arch.indirect_shadow_pages++;
  }
  
  static void unaccount_shadowed(struct kvm *kvm, struct kvm_mmu_page *sp)

@@ -819,11 +825,15 @@ static void unaccount_shadowed(struct kvm *kvm, struct 
kvm_mmu_page *sp)
struct kvm_memory_slot *slot;
gfn_t gfn;
  
+	kvm->arch.indirect_shadow_pages--;

gfn = sp->gfn;
slots = kvm_memslots_for_spte_role(kvm, sp->role);
slot = __gfn_to_memslot(slots, gfn);
+   if (sp->role.level > PT_PAGE_TABLE_LEVEL)
+   return kvm_slot_page_track_remove_page_nolock(kvm, slot, gfn,
+   KVM_PAGE_TRACK_WRITE);
+
kvm_mmu_gfn_allow_lpage(slot, gfn);
-   kvm->arch.indirect_shadow_pages--;
  }
  
  static bool __mmu_gfn_lpage_is_disallowed(gfn_t gfn, int level,

@@ -2140,12 +2150,18 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct 
kvm_vcpu *vcpu,
hlist_add_head(>hash_link,
>kvm->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)]);
if (!direct) {
-   if (rmap_write_protect(vcpu, gfn))
+   /*
+* we should do write protection before syncing pages
+* otherwise the content of the synced shadow page may
+* be inconsistent with guest page table.
+*/
+   account_shadowed(vcpu->kvm, sp);
+
+   if (level == PT_PAGE_TABLE_LEVEL &&
+ rmap_write_protect(vcpu, gfn))
kvm_flush_remote_tlbs(vcpu->kvm);
I think your modification is good but I am little bit confused here. In 
account_shadowed, if sp->role.level > PT_PAGE_TABLE_LEVEL, the sp->gfn 
is write protected, and this is reasonable. So why write protecting the 
gfn of PT_PAGE_TABLE_LEVEL here?



if (level > PT_PAGE_TABLE_LEVEL && need_sync)
kvm_sync_pages(vcpu, gfn);
-
-   account_shadowed(vcpu->kvm, sp);
}
sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen;
init_shadow_page_table(sp);
diff --git a/arch/x86/kvm/page_track.c b/arch/x86/kvm/page_track.c
index 84420df..87554d3 100644
--- a/arch/x86/kvm/page_track.c
+++ b/arch/x86/kvm/page_track.c
@@ -77,6 +77,26 @@ static void update_gfn_track(struct kvm_memory_slot *slot, 
gfn_t gfn,
WARN_ON(val < 0);
  }
  
+void

+kvm_slot_page_track_add_page_nolock(struct kvm *kvm,
+   struct kvm_memory_slot *slot, gfn_t gfn,
+   enum kvm_page_track_mode mode)
+{
+   WARN_ON(!check_mode(mode));
+
+ 

Re: [LKP] [lkp] [x86/irq] 4c24cee6b2: IP-Config: Auto-configuration of network failed

2015-12-14 Thread Jiang Liu
On 2015/12/14 17:54, Borislav Petkov wrote:
> On Mon, Dec 14, 2015 at 02:54:02PM +0800, Huang, Ying wrote:
>> No, there are no other systems reporting the same issue. I will queue
>> more tests for make sure this is not a false positive.
> 
> I can trigger this too with my guest here.
> 
> I have these two ontop of rc5:
> 
> cc22b9b83f6a x86/irq: Enhance __assign_irq_vector() to rollback in case of 
> failure
> 45dd79e03e1e x86/irq: Do not reuse struct apic_chip_data.old_domain as 
> temporary buffer
> 9f9499ae8e64 Linux 4.4-rc5
> 
> and my guest stalls while booting.
> 
> The new thing I see in dmesg is this:
> 
>  ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
> +..MP-BIOS bug: 8254 timer not connected to IO-APIC
> +...trying to set up timer (IRQ0) through the 8259A ...
> +. (found apic 0 pin 2) ...
> +... failed.
> +...trying to set up timer as Virtual Wire IRQ...
> +. failed.
> +...trying to set up timer as ExtINT IRQ...
> +. works.
> +APIC calibration not consistent with PM-Timer: 111ms instead of 100ms
> +APIC delta adjusted to PM-Timer: 6248393 (6997337)
> 
> which leads to boot stalling and timeoutting when loading the hdd
> driver:
Hi Boris and Ying,
Aha, found a possible regression. Could you please help to
apply the attached bugfix patch ontop of "cc22b9b83f6a x86/irq:
Enhance __assign_irq_vector() to rollback in case of failure"?
Hi Ying, I have push this patch to github so it should reach
0day test farm soon:)
Thanks,
Gerry

> 
> ...
> [3.973447] console [netcon0] enabled
> [3.976099] netconsole: network logging started
> [3.979604] rtc_cmos 00:00: setting system clock to 2015-12-14 10:45:35 
> UTC (1450089935)
> [3.985348] PM: Checking hibernation image partition /dev/sdb1
> [6.600706] usb 1-1: New USB device found, idVendor=0627, idProduct=0001
> [6.613651] usb 1-1: New USB device strings: Mfr=1, Product=3, 
> SerialNumber=5
> [6.636905] usb 1-1: Product: QEMU USB Tablet
> [6.642248] usb 1-1: Manufacturer: QEMU
> [6.647109] usb 1-1: SerialNumber: 42
> [7.580995] ata2.00: qc timeout (cmd 0xa0)
> [7.589300] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [7.750715] ata2.01: NODEV after polling detection
> [7.759605] ata2.00: configured for MWDMA2
> [8.585691] input: QEMU QEMU USB Tablet as 
> /devices/pci:00/:00:01.2/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input1
> [8.602467] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v0.01 
> Pointer [QEMU QEMU USB Tablet] on usb-:00:01.2-1/input0
> [   12.760846] ata2.00: qc timeout (cmd 0xa0)
> [   12.786543] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [   12.796576] ata2.00: limiting speed to MWDMA2:PIO3
> [   12.958455] ata2.01: NODEV after polling detection
> [   12.969693] ata2.00: configured for MWDMA2
> [   17.972782] ata2.00: qc timeout (cmd 0xa0)
> [   17.978967] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [   17.983495] ata2.00: disabled
> [   17.986352] ata2: soft resetting link
> [   18.146586] ata2.01: NODEV after polling detection
> [   18.151413] ata2: EH complete
> [   32.745227] ata1: lost interrupt (Status 0x50)
> [   32.748470] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 
> frozen
> [   32.756586] ata1.00: failed command: READ DMA
> [   32.761251] ata1.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 dma 
> 4096 in
> [   32.761251]  res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 
> (timeout)
> [   32.773928] ata1.00: status: { DRDY }
> [   32.777028] ata1: soft resetting link
> [   32.934437] ata1.01: NODEV after polling detection
> [   32.946663] ata1.00: configured for MWDMA2
> [   32.949964] ata1.00: device reported invalid CHS sector 0
> [   32.953793] ata1: EH complete
> [   63.849089] ata1: lost interrupt (Status 0x50)
> [   63.857470] ata1.00: limiting speed to MWDMA1:PIO4
> [   63.860982] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 
> frozen
> [   63.865862] ata1.00: failed command: READ DMA
> [   63.883697] ata1.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 dma 
> 4096 in
> [   63.883697]  res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 
> (timeout)
> [   63.899573] ata1.00: status: { DRDY }
> [   63.902649] ata1: soft resetting link
> [   64.062580] ata1.01: NODEV after polling detection
> [   64.073800] ata1.00: configured for MWDMA1
> [   64.076813] ata1.00: device reported invalid CHS sector 0
> [   64.096188] ata1: EH complete
> 
>From c7c3cc3a048576fd1e196e67b11ae0193e7fba1e Mon Sep 17 00:00:00 2001
From: Jiang Liu 
Date: Tue, 15 Dec 2015 15:40:43 +0800
Subject: [PATCH]


Signed-off-by: Jiang Liu 
---
 arch/x86/kernel/apic/vector.c |   10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
index f03957e7c50d..fce2853f70d9 100644
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -116,14 +116,13 @@ static int __assign_irq_vector(int irq, 

Re: [PATCH] perf tests: Fix false TEST_OK result for 'perf test hist'

2015-12-14 Thread Namhyung Kim
Hi,

On Tue, Dec 15, 2015 at 04:18:44AM +, Wang Nan wrote:
> Commit 71d6de64feddd4b45326fba2111b3006d9e0 ('perf test: Fix hist
> testcases when kptr_restrict is on') solves a double free problem when
> 'perf test hist' calling setup_fake_machine(). However, the result is
> still incorrect. For example:
> 
>  $ ./perf test -v 'filtering hist entries'
>  25: Test filtering hist entries  :
>  --- start ---
>  test child forked, pid 4186
>  Cannot create kernel maps
>  test child finished with 0
>   end 
>  Test filtering hist entries: Ok
> 
> In this case the body of this test is not get executed at all, but the
> result is 'Ok'. I think 'Skip' should be better.

Right, I missed this part.

But on second thought, I think it should not create real kernel maps.
What setup_fake_machine() does is to create/insert fake
dso/mmap/symbols for testing hist functions.  So it has to use the
predefined info not real ones.


> 
> The reason is that *ALL* hists test cases forget to reset err after
> using it to hold an error code.
> 
> This patch ensure err is reset.
> 
> In case when kptr_restrict prevent normal user get kernel address, this
> test should be skipped, not fail. This patch uses linux/err.h to store
> error code in return value of setup_fake_machine(), and let 'EACCES' to
> indicate this problem.

Please just remove the machine__create_kernel_maps() in
setup_fake_machine() and simply return TEST_FAIL if there's an error.

Thanks,
Namhyung


> 
> Signed-off-by: Wang Nan 
> Cc: Arnaldo Carvalho de Melo 
> Cc: Jiri Olsa 
> Cc: Masami Hiramatsu 
> Cc: Namhyung Kim 
> ---
>  tools/perf/tests/hists_common.c   | 12 +---
>  tools/perf/tests/hists_common.h   |  1 +
>  tools/perf/tests/hists_cumulate.c |  6 +-
>  tools/perf/tests/hists_filter.c   |  6 +-
>  tools/perf/tests/hists_link.c |  6 +-
>  tools/perf/tests/hists_output.c   |  6 +-
>  6 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
> index bcfd081..2eca1b2 100644
> --- a/tools/perf/tests/hists_common.c
> +++ b/tools/perf/tests/hists_common.c
> @@ -81,15 +81,20 @@ struct machine *setup_fake_machine(struct machines 
> *machines)
>  {
>   struct machine *machine = machines__find(machines, HOST_KERNEL_ID);
>   size_t i;
> + int err = -ENOMEM;
>  
>   if (machine == NULL) {
>   pr_debug("Not enough memory for machine setup\n");
> - return NULL;
> + return ERR_PTR(-ENOMEM);
>   }
>  
>   if (machine__create_kernel_maps(machine)) {
>   pr_debug("Cannot create kernel maps\n");
> - return NULL;
> + if (symbol_conf.kptr_restrict) {
> + pr_debug("Hint: Check 
> /proc/sys/kernel/kptr_restrict.\n");
> + err = -EACCES;
> + }
> + return ERR_PTR(err);
>   }
>  
>   for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
> @@ -155,7 +160,8 @@ struct machine *setup_fake_machine(struct machines 
> *machines)
>  out:
>   pr_debug("Not enough memory for machine setup\n");
>   machine__delete_threads(machine);
> - return NULL;
> + machine__exit(machine);
> + return ERR_PTR(err);
>  }
>  
>  void print_hists_in(struct hists *hists)
> diff --git a/tools/perf/tests/hists_common.h b/tools/perf/tests/hists_common.h
> index 888254e..0252eae 100644
> --- a/tools/perf/tests/hists_common.h
> +++ b/tools/perf/tests/hists_common.h
> @@ -1,5 +1,6 @@
>  #ifndef __PERF_TESTS__HISTS_COMMON_H__
>  #define __PERF_TESTS__HISTS_COMMON_H__
> +#include 
>  
>  struct machine;
>  struct machines;
> diff --git a/tools/perf/tests/hists_cumulate.c 
> b/tools/perf/tests/hists_cumulate.c
> index 8292948..c211075 100644
> --- a/tools/perf/tests/hists_cumulate.c
> +++ b/tools/perf/tests/hists_cumulate.c
> @@ -706,13 +706,17 @@ int test__hists_cumulate(int subtest __maybe_unused)
>   err = parse_events(evlist, "cpu-clock", NULL);
>   if (err)
>   goto out;
> + err = TEST_FAIL;
>  
>   machines__init();
>  
>   /* setup threads/dso/map/symbols also */
>   machine = setup_fake_machine();
> - if (!machine)
> + if (IS_ERR(machine)) {
> + if (PTR_ERR(machine) == -EACCES)
> + err = TEST_SKIP;
>   goto out;
> + }
>  
>   if (verbose > 1)
>   machine__fprintf(machine, stderr);
> diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
> index ccb5b49..795a04d 100644
> --- a/tools/perf/tests/hists_filter.c
> +++ b/tools/perf/tests/hists_filter.c
> @@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused)
>   err = parse_events(evlist, "task-clock", NULL);
>   if (err)
>   goto out;
> + err = TEST_FAIL;
>  
>   /* default sort order (comm,dso,sym) will be used */
>   if (setup_sorting() < 0)
> @@ -129,8 +130,11 @@ 

Re: [lkp] [mtd] e0460264db: BUG: unable to handle kernel NULL pointer dereference at 000005c4

2015-12-14 Thread Boris Brezillon
On Tue, 15 Dec 2015 08:55:16 +0800
kernel test robot  wrote:

> FYI, we noticed the below changes on
> 
> https://github.com/bbrezillon/linux-0day nand/ecclayout-squashed
> commit e0460264db239f81a05a0f116efc84b9c650e0df ("mtd: use mtd_eccpos() and 
> mtd_oobfree() where appropriate")

Should be fixed now. Sorry for the inconvenience.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mtd: onenand: omap2: Convert to use dmaengine for memcpy

2015-12-14 Thread Peter Ujfalusi
Do not use the legacy and deprecated omap-dma interface for setting up the
memcpy.

Signed-off-by: Peter Ujfalusi 
---

Hi,

this patch depends on the dma setup simplification patch:
https://www.mail-archive.com/linux-omap@vger.kernel.org/msg122375.html

We could try to enable the DMA memcpy without condition I believe, but I have
decided to not do it since the code had comments regarding to PM (?) when using
DMA.

Regards,
Peter


 drivers/mtd/onenand/omap2.c | 84 ++---
 1 file changed, 41 insertions(+), 43 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 58576c9babb0..b747217d5e73 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,8 +41,6 @@
 #include 
 #include 
 
-#include 
-
 #define DRIVER_NAME "omap2-onenand"
 
 #define ONENAND_BUFRAM_SIZE(1024 * 5)
@@ -56,18 +55,16 @@ struct omap2_onenand {
struct onenand_chip onenand;
struct completion irq_done;
struct completion dma_done;
-   int dma_channel;
+   struct dma_chan *dma_chan;
int freq;
int (*setup)(void __iomem *base, int *freq_ptr);
struct regulator *regulator;
u8 flags;
 };
 
-static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data)
+static void omap2_onenand_dma_complete_func(void *completion)
 {
-   struct omap2_onenand *c = data;
-
-   complete(>dma_done);
+   complete(completion);
 }
 
 static irqreturn_t omap2_onenand_interrupt(int irq, void *dev_id)
@@ -295,23 +292,33 @@ static inline int omap2_onenand_dma_transfer(struct 
omap2_onenand *c,
 dma_addr_t src, dma_addr_t dst,
 size_t count)
 {
-   int data_type = __ffs((src | dst | count));
+   struct dma_device *dma_dev = c->dma_chan->device;
+   struct dma_async_tx_descriptor *tx = NULL;
+   dma_cookie_t cookie;
 
-   if (data_type > OMAP_DMA_DATA_TYPE_S32)
-   data_type = OMAP_DMA_DATA_TYPE_S32;
-
-   omap_set_dma_transfer_params(c->dma_channel, OMAP_DMA_DATA_TYPE_S32,
-count / BIT(data_type), 1, 0, 0, 0);
-   omap_set_dma_src_params(c->dma_channel, 0, OMAP_DMA_AMODE_POST_INC,
-   src, 0, 0);
-   omap_set_dma_dest_params(c->dma_channel, 0, OMAP_DMA_AMODE_POST_INC,
-dst, 0, 0);
+   tx = dma_dev->device_prep_dma_memcpy(c->dma_chan, dst, src, count, 0);
+   if (!tx) {
+   dev_err(>pdev->dev, "Failed to prepare DMA memcpy\n");
+   return -EIO;
+   }
 
reinit_completion(>dma_done);
-   omap_start_dma(c->dma_channel);
+   tx->callback = omap2_onenand_dma_complete_func;
+   tx->callback_param = >dma_done;
+
+   cookie = tx->tx_submit(tx);
+   if (dma_submit_error(cookie)) {
+   dev_err(>pdev->dev, "Failed to do DMA tx_submit\n");
+   return -EIO;
+   }
+
+   dma_async_issue_pending(c->dma_chan);
+
if (wait_for_completion_timeout(>dma_done, msecs_to_jiffies(20)))
return -ETIMEDOUT;
 
+   dmaengine_terminate_all(c->dma_chan);
+
return 0;
 }
 
@@ -465,7 +472,7 @@ static int omap2_onenand_read_bufferram(struct mtd_info 
*mtd, int area,
 
bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
/* DMA is not used.  Revisit PM requirements before enabling it. */
-   if (1 || (c->dma_channel < 0) ||
+   if (1 || !c->dma_chan ||
((void *) buffer >= (void *) high_memory) || (bram_offset & 3) ||
(((unsigned int) buffer) & 3) || (count < 1024) || (count & 3)) {
memcpy(buffer, (__force void *)(this->base + bram_offset),
@@ -503,7 +510,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info 
*mtd, int area,
 
bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
/* DMA is not used.  Revisit PM requirements before enabling it. */
-   if (1 || (c->dma_channel < 0) ||
+   if (1 || !c->dma_chan ||
((void *) buffer >= (void *) high_memory) || (bram_offset & 3) ||
(((unsigned int) buffer) & 3) || (count < 1024) || (count & 3)) {
memcpy((__force void *)(this->base + bram_offset), buffer,
@@ -608,8 +615,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
c->flags = pdata->flags;
c->gpmc_cs = pdata->cs;
c->gpio_irq = pdata->gpio_irq;
-   c->dma_channel = pdata->dma_channel;
-   if (c->dma_channel < 0) {
+   if (pdata->dma_channel < 0) {
/* if -1, don't use DMA */
c->gpio_irq = 0;
}
@@ -661,25 +667,17 @@ static int omap2_onenand_probe(struct platform_device 
*pdev)
goto err_release_gpio;
}
 
-   

Re: Linux 4.3.3

2015-12-14 Thread Greg KH
diff --git a/Makefile b/Makefile
index 1a4953b3e10f..2070d16bb5a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 3
-SUBLEVEL = 2
+SUBLEVEL = 3
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/block/blk-merge.c b/block/blk-merge.c
index c4e9c37f3e38..0e5f4fc12449 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -91,7 +91,7 @@ static struct bio *blk_bio_segment_split(struct request_queue 
*q,
 
seg_size += bv.bv_len;
bvprv = bv;
-   bvprvp = 
+   bvprvp = 
sectors += bv.bv_len >> 9;
continue;
}
@@ -101,7 +101,7 @@ new_segment:
 
nsegs++;
bvprv = bv;
-   bvprvp = 
+   bvprvp = 
seg_size = bv.bv_len;
sectors += bv.bv_len >> 9;
}
diff --git a/certs/.gitignore b/certs/.gitignore
new file mode 100644
index ..f51aea4a71ec
--- /dev/null
+++ b/certs/.gitignore
@@ -0,0 +1,4 @@
+#
+# Generated files
+#
+x509_certificate_list
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 128e7df5b807..8630a77ea462 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3444,6 +3444,7 @@ static void rbd_queue_workfn(struct work_struct *work)
goto err_rq;
}
img_request->rq = rq;
+   snapc = NULL; /* img_request consumes a ref */
 
if (op_type == OBJ_OP_DISCARD)
result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index f51d376d10ba..c2f5117fd8cb 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3675,6 +3675,11 @@ static int pci_probe(struct pci_dev *dev,
 
reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
+   /* JMicron JMB38x often shows 0 at first read, just ignore it */
+   if (!ohci->it_context_support) {
+   ohci_notice(ohci, "overriding IsoXmitIntMask\n");
+   ohci->it_context_support = 0xf;
+   }
reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
ohci->it_context_mask = ohci->it_context_support;
ohci->n_it = hweight32(ohci->it_context_mask);
diff --git a/drivers/media/pci/cobalt/Kconfig b/drivers/media/pci/cobalt/Kconfig
index 1f88ccc174da..a01f0cc745cc 100644
--- a/drivers/media/pci/cobalt/Kconfig
+++ b/drivers/media/pci/cobalt/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_COBALT
tristate "Cisco Cobalt support"
-   depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER
+   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
depends on PCI_MSI && MTD_COMPLEX_MAPPINGS
depends on GPIOLIB || COMPILE_TEST
depends on SND
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c 
b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index a9377727c11c..7f709cbdcd87 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1583,8 +1583,14 @@ err_disable_device:
 static void nicvf_remove(struct pci_dev *pdev)
 {
struct net_device *netdev = pci_get_drvdata(pdev);
-   struct nicvf *nic = netdev_priv(netdev);
-   struct net_device *pnetdev = nic->pnicvf->netdev;
+   struct nicvf *nic;
+   struct net_device *pnetdev;
+
+   if (!netdev)
+   return;
+
+   nic = netdev_priv(netdev);
+   pnetdev = nic->pnicvf->netdev;
 
/* Check if this Qset is assigned to different VF.
 * If yes, clean primary and all secondary Qsets.
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c 
b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 731423ca575d..8bead97373ab 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4934,26 +4934,41 @@ static void rem_slave_counters(struct mlx4_dev *dev, 
int slave)
struct res_counter *counter;
struct res_counter *tmp;
int err;
-   int index;
+   int *counters_arr = NULL;
+   int i, j;
 
err = move_all_busy(dev, slave, RES_COUNTER);
if (err)
mlx4_warn(dev, "rem_slave_counters: Could not move all counters 
- too busy for slave %d\n",
  slave);
 
-   spin_lock_irq(mlx4_tlock(dev));
-   list_for_each_entry_safe(counter, tmp, counter_list, com.list) {
-   if (counter->com.owner == slave) {
-   index = counter->com.res_id;
-   rb_erase(>com.node,
->res_tree[RES_COUNTER]);
-   list_del(>com.list);
-   kfree(counter);
-   __mlx4_counter_free(dev, index);
+   counters_arr = kmalloc_array(dev->caps.max_counters,
+

Linux 4.3.3

2015-12-14 Thread Greg KH
I'm announcing the release of the 4.3.3 kernel.

All users of the 4.3 kernel series must upgrade.

The updated 4.3.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.3.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 block/blk-merge.c |4 
 certs/.gitignore  |4 
 drivers/block/rbd.c   |1 
 drivers/firewire/ohci.c   |5 
 drivers/media/pci/cobalt/Kconfig  |2 
 drivers/net/ethernet/cavium/thunder/nicvf_main.c  |   10 
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |   39 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   56 +++
 drivers/net/ethernet/realtek/r8169.c  |6 
 drivers/net/phy/broadcom.c|2 
 drivers/net/usb/qmi_wwan.c|1 
 drivers/net/vrf.c |   15 
 fs/btrfs/ctree.h  |4 
 fs/btrfs/delayed-ref.c|  139 +++-
 fs/btrfs/delayed-ref.h|7 
 fs/btrfs/extent-tree.c|   59 +--
 fs/btrfs/file.c   |   36 +-
 fs/btrfs/inode.c  |   96 --
 fs/btrfs/ioctl.c  |  257 +---
 fs/btrfs/relocation.c |   16 -
 fs/btrfs/send.c   |   10 
 fs/btrfs/tree-log.c   |2 
 fs/btrfs/xattr.c  |4 
 fs/ceph/mds_client.c  |2 
 fs/debugfs/inode.c|6 
 fs/ext4/crypto.c  |   23 +
 fs/ext4/ext4_jbd2.c   |6 
 fs/ext4/extents.c |3 
 fs/ext4/page-io.c |5 
 fs/ext4/super.c   |   12 
 fs/jbd2/journal.c |6 
 fs/nfs/inode.c|6 
 fs/nfs/nfs4client.c   |2 
 fs/nfs/pnfs.c |   56 +--
 fs/nfsd/nfs4state.c   |  127 +++
 fs/nfsd/state.h   |   19 -
 fs/ocfs2/namei.c  |2 
 include/linux/ipv6.h  |2 
 include/linux/jbd2.h  |1 
 include/linux/mlx5/mlx5_ifc.h |   24 -
 include/net/af_unix.h |1 
 include/net/ip6_fib.h |3 
 include/net/ip6_tunnel.h  |3 
 include/net/ip_tunnels.h  |3 
 include/net/ipv6.h|   22 +
 include/net/ndisc.h   |3 
 include/net/sch_generic.h |3 
 include/net/switchdev.h   |2 
 kernel/.gitignore |1 
 kernel/bpf/arraymap.c |2 
 net/core/neighbour.c  |4 
 net/core/scm.c|2 
 net/dccp/ipv6.c   |   33 +-
 net/ipv4/ipmr.c   |   15 
 net/ipv4/tcp_input.c  |   23 +
 net/ipv4/tcp_ipv4.c   |3 
 net/ipv4/tcp_timer.c  |   12 
 net/ipv6/addrconf.c   |2 
 net/ipv6/af_inet6.c   |   13 
 net/ipv6/datagram.c   |4 
 net/ipv6/exthdrs.c|3 
 net/ipv6/inet6_connection_sock.c  |   11 
 net/ipv6/ip6_tunnel.c |2 
 net/ipv6/ip6mr.c  |   15 
 net/ipv6/ipv6_sockglue.c  |   33 +-
 net/ipv6/mcast.c  |2 
 net/ipv6/ndisc.c  |   10 
 net/ipv6/netfilter/nf_conntrack_reasm.c   |5 
 net/ipv6/raw.c|8 
 net/ipv6/reassembly.c |   10 
 net/ipv6/route.c   

[PATCH 1/1] Support for CMedia CM6533 HID audio jack controls.

2015-12-14 Thread Ben Chen
Signed-off-by: Ben Chen 
---
 drivers/hid/Kconfig  |   6 ++
 drivers/hid/Makefile |   1 +
 drivers/hid/hid-cm6533.c | 168 +++
 drivers/hid/hid-core.c   |   1 +
 drivers/hid/hid-ids.h|   1 +
 5 files changed, 177 insertions(+)
 create mode 100644 drivers/hid/hid-cm6533.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 513a16c..4e0ca39 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -196,6 +196,12 @@ config HID_PRODIKEYS
  multimedia keyboard, but will lack support for the musical keyboard
  and some additional multimedia keys.
 
+config HID_CM6533
+   tristate "CMedia CM6533 HID audio jack controls"
+   depends on HID
+   ---help---
+   Support for CMedia CM6533 HID audio jack controls.
+
 config HID_CP2112
tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support"
depends on USB_HID && I2C && GPIOLIB
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 00011fe..63f99bd 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_HID_BELKIN)  += hid-belkin.o
 obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
 obj-$(CONFIG_HID_CHERRY)   += hid-cherry.o
 obj-$(CONFIG_HID_CHICONY)  += hid-chicony.o
+obj-$(CONFIG_HID_CM6533)   += hid-cm6533.o
 obj-$(CONFIG_HID_CORSAIR)  += hid-corsair.o
 obj-$(CONFIG_HID_CP2112)   += hid-cp2112.o
 obj-$(CONFIG_HID_CYPRESS)  += hid-cypress.o
diff --git a/drivers/hid/hid-cm6533.c b/drivers/hid/hid-cm6533.c
new file mode 100644
index 000..a097f8b
--- /dev/null
+++ b/drivers/hid/hid-cm6533.c
@@ -0,0 +1,168 @@
+/*
+ * HID driver for CMedia CM6533 audio jack controls
+ *
+ * Copyright (C) 2015 Ben Chen 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include "hid-ids.h"
+
+MODULE_AUTHOR("Ben Chen");
+MODULE_DESCRIPTION("CM6533 HID jack controls");
+MODULE_LICENSE("GPL");
+
+#define CM6533_JD_TYPE_COUNT  1
+#define CM6533_JD_RAWEV_LEN 16
+#define CM6533_JD_SFX_OFFSET 8
+
+/*
+*
+*CM6533 audio jack HID raw events:
+*
+*Plug in:
+*01000600 002083xx 080008c0 1000
+*about 3 seconds later...
+*01000a00 002083xx 08000380 1000
+*01000600 002083xx 08000380 1000
+*
+*Plug out:
+*01000400 002083xx 080008c0 x000
+*/
+
+static const u8 ji_sfx[] = { 0x08, 0x00, 0x08, 0xc0 };
+static const u8 ji_in[]  = { 0x01, 0x00, 0x06, 0x00 };
+static const u8 ji_out[] = { 0x01, 0x00, 0x04, 0x00 };
+
+static int jack_switch_types[CM6533_JD_TYPE_COUNT] = {
+   SW_HEADPHONE_INSERT,
+};
+
+struct cmhid {
+   struct input_dev *input_dev;
+   struct hid_device *hid;
+   unsigned short switch_map[CM6533_JD_TYPE_COUNT];
+};
+
+static void hp_ev(struct hid_device *hid, struct cmhid *cm, int value)
+{
+   input_report_switch(cm->input_dev, SW_HEADPHONE_INSERT, value);
+   input_sync(cm->input_dev);
+}
+
+static int cmhid_raw_event(struct hid_device *hid, struct hid_report *report,
+u8 *data, int len)
+{
+   struct cmhid *cm = hid_get_drvdata(hid);
+
+   if (len != CM6533_JD_RAWEV_LEN)
+   goto out;
+   if (memcmp(data+CM6533_JD_SFX_OFFSET, ji_sfx, sizeof(ji_sfx)))
+   goto out;
+
+   if (!memcmp(data, ji_out, sizeof(ji_out))) {
+   hp_ev(hid, cm, 0);
+   goto out;
+   }
+   if (!memcmp(data, ji_in, sizeof(ji_in))) {
+   hp_ev(hid, cm, 1);
+   goto out;
+   }
+
+out:
+   return 0;
+}
+
+static void cmhid_input_configured(struct hid_device *hid,
+   struct hid_input *hidinput)
+{
+   struct input_dev *input_dev = hidinput->input;
+   struct cmhid *cm = hid_get_drvdata(hid);
+   int i;
+
+   hid_info(hid, "cmhid_input_configured\n");
+   cm->input_dev = input_dev;
+   memcpy(cm->switch_map, jack_switch_types, sizeof(cm->switch_map));
+   input_dev->evbit[0] = BIT(EV_SW);
+   for (i = 0; i < CM6533_JD_TYPE_COUNT; i++)
+   input_set_capability(cm->input_dev,
+   EV_SW, jack_switch_types[i]);
+}
+
+static int cmhid_input_mapping(struct hid_device *hid,
+   struct hid_input *hi, struct hid_field *field,
+   struct hid_usage *usage, unsigned long **bit, int *max)
+{
+   return -1;
+}
+
+static int cmhid_probe(struct hid_device *hid, const struct hid_device_id *id)
+{
+   int ret;
+   struct cmhid *cm;
+
+   cm = kzalloc(sizeof(struct cmhid), GFP_KERNEL);
+   if (!cm) {
+   

Re: [PATCH 2/4] doc: efi-stub.txt: Fix arm64 paths

2015-12-14 Thread Ard Biesheuvel
On 14 December 2015 at 19:26, Matt Fleming  wrote:
> From: Alan Ott 
>
> Update documented paths for arm64 files to match current tree.
>
> Signed-off-by: Alan Ott 
> Cc: Roy Franz 
> Cc: Jonathan Corbet 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Signed-off-by: Matt Fleming 

Acked-by: Ard Biesheuvel 


> ---
>  Documentation/efi-stub.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/efi-stub.txt b/Documentation/efi-stub.txt
> index 7747024d3bb7..e15746988261 100644
> --- a/Documentation/efi-stub.txt
> +++ b/Documentation/efi-stub.txt
> @@ -10,12 +10,12 @@ arch/x86/boot/header.S and 
> arch/x86/boot/compressed/eboot.c,
>  respectively. For ARM the EFI stub is implemented in
>  arch/arm/boot/compressed/efi-header.S and
>  arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared
> -between architectures is in drivers/firmware/efi/efi-stub-helper.c.
> +between architectures is in drivers/firmware/efi/libstub.
>
>  For arm64, there is no compressed kernel support, so the Image itself
>  masquerades as a PE/COFF image and the EFI stub is linked into the
>  kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S
> -and arch/arm64/kernel/efi-stub.c.
> +and drivers/firmware/efi/libstub/arm64-stub.c.
>
>  By using the EFI boot stub it's possible to boot a Linux kernel
>  without the use of a conventional EFI boot loader, such as grub or
> --
> 2.6.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] i2c: mediatek: fix i2c multi transfer issue in high speed mode

2015-12-14 Thread Liguo Zhang
For mt8173 platform with auto restart support, when doing i2c multi
transfer in high speed, we should ignore the first restart irq after
the master code, otherwise the first transfer will be discarded.

Signed-off-by: Liguo Zhang 
Reviewed-by: Eddie Huang 
---
Change in v3:
ignore the first restart irq after the master code when doing
i2c multi transfer in high speed.

change in v2:
fix i2c checkpatch error.

---
 drivers/i2c/busses/i2c-mt65xx.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index dc4aac6..aec8e6c 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -155,6 +155,7 @@ struct mtk_i2c {
u16 timing_reg;
u16 high_speed_reg;
unsigned char auto_restart;
+   bool ignore_restart_irq;
const struct mtk_i2c_compatible *dev_comp;
 };
 
@@ -539,6 +540,14 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
}
}
 
+   if (i2c->auto_restart && num >= 2 && i2c->speed_hz > MAX_FS_MODE_SPEED)
+   /* ignore the first restart irq after the master code,
+* otherwise the first transfer will be discarded.
+*/
+   i2c->ignore_restart_irq = true;
+   else
+   i2c->ignore_restart_irq = false;
+
while (left_num--) {
if (!msgs->buf) {
dev_dbg(i2c->dev, "data buffer is NULL.\n");
@@ -592,8 +601,16 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
 * i2c->irq_stat need keep the two interrupt value.
 */
i2c->irq_stat |= intr_stat;
-   if (i2c->irq_stat & (I2C_TRANSAC_COMP | restart_flag))
-   complete(>msg_complete);
+
+   if (i2c->ignore_restart_irq && (i2c->irq_stat & restart_flag)) {
+   i2c->ignore_restart_irq = false;
+   i2c->irq_stat = 0;
+   writew(I2C_RS_MUL_CNFG | I2C_RS_MUL_TRIG | I2C_TRANSAC_START,
+  i2c->base + OFFSET_START);
+   } else {
+   if (i2c->irq_stat & (I2C_TRANSAC_COMP | restart_flag))
+   complete(>msg_complete);
+   }
 
return IRQ_HANDLED;
 }
-- 
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 05/11] KVM: page track: introduce kvm_page_track_{add,remove}_page

2015-12-14 Thread Kai Huang



On 12/01/2015 02:26 AM, Xiao Guangrong wrote:

These two functions are the user APIs:
- kvm_page_track_add_page(): add the page to the tracking pool after
   that later specified access on that page will be tracked

- kvm_page_track_remove_page(): remove the page from the tracking pool,
   the specified access on the page is not tracked after the last user is
   gone

Both of these are called under the protection of kvm->srcu or
kvm->slots_lock

Signed-off-by: Xiao Guangrong 
---
  arch/x86/include/asm/kvm_page_track.h |  5 ++
  arch/x86/kvm/page_track.c | 95 +++
  2 files changed, 100 insertions(+)

diff --git a/arch/x86/include/asm/kvm_page_track.h 
b/arch/x86/include/asm/kvm_page_track.h
index 347d5c9..9cc17c6 100644
--- a/arch/x86/include/asm/kvm_page_track.h
+++ b/arch/x86/include/asm/kvm_page_track.h
@@ -10,4 +10,9 @@ int kvm_page_track_create_memslot(struct kvm_memory_slot 
*slot,
  unsigned long npages);
  void kvm_page_track_free_memslot(struct kvm_memory_slot *free,
 struct kvm_memory_slot *dont);
+
+void kvm_page_track_add_page(struct kvm *kvm, gfn_t gfn,
+enum kvm_page_track_mode mode);
+void kvm_page_track_remove_page(struct kvm *kvm, gfn_t gfn,
+   enum kvm_page_track_mode mode);
  #endif
diff --git a/arch/x86/kvm/page_track.c b/arch/x86/kvm/page_track.c
index 0338d36..ad510db 100644
--- a/arch/x86/kvm/page_track.c
+++ b/arch/x86/kvm/page_track.c
@@ -56,3 +56,98 @@ void kvm_page_track_free_memslot(struct kvm_memory_slot 
*free,
if (!dont || free->arch.gfn_track != dont->arch.gfn_track)
page_track_slot_free(free);
  }
+
+static bool check_mode(enum kvm_page_track_mode mode)
+{
+   if (mode < 0 || mode >= KVM_PAGE_TRACK_MAX)
+   return false;
+
+   return true;
+}
+
+static void update_gfn_track(struct kvm_memory_slot *slot, gfn_t gfn,
+enum kvm_page_track_mode mode, int count)
+{
+   int index, val;
+
+   index = gfn_to_index(gfn, slot->base_gfn, PT_PAGE_TABLE_LEVEL);
+
+   slot->arch.gfn_track[mode][index] += count;
+   val = slot->arch.gfn_track[mode][index];
+   WARN_ON(val < 0);
+}
+
+/*
+ * add guest page to the tracking pool so that corresponding access on that
+ * page will be intercepted.
+ *
+ * It should be called under the protection of kvm->srcu or kvm->slots_lock
+ *
+ * @kvm: the guest instance we are interested in.
+ * @gfn: the guest page.
+ * @mode: tracking mode, currently only write track is supported.
+ */
+void kvm_page_track_add_page(struct kvm *kvm, gfn_t gfn,
+enum kvm_page_track_mode mode)
+{
+   struct kvm_memslots *slots;
+   struct kvm_memory_slot *slot;
+   int i;
+
+   WARN_ON(!check_mode(mode));
+
+   for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
+   slots = __kvm_memslots(kvm, i);
+   slot = __gfn_to_memslot(slots, gfn);
+
+   spin_lock(>mmu_lock);
+   update_gfn_track(slot, gfn, mode, 1);
+
+   /*
+* new track stops large page mapping for the
+* tracked page.
+*/
+   kvm_mmu_gfn_disallow_lpage(slot, gfn);
Where is  kvm_mmu_gfn_disallow_lpage? Neither did I see it in your patch 
nor in my own latest KVM repo without your patch :)



+
+   if (mode == KVM_PAGE_TRACK_WRITE)
+   if (kvm_mmu_slot_gfn_write_protect(kvm, slot, gfn))
+   kvm_flush_remote_tlbs(kvm);

Neither can I find kvm_mmu_slot_gfn_write_protect. Did I miss something?

Thanks,
-Kai

+   spin_unlock(>mmu_lock);
+   }
+}
+
+/*
+ * remove the guest page from the tracking pool which stops the interception
+ * of corresponding access on that page. It is the opposed operation of
+ * kvm_page_track_add_page().
+ *
+ * It should be called under the protection of kvm->srcu or kvm->slots_lock
+ *
+ * @kvm: the guest instance we are interested in.
+ * @gfn: the guest page.
+ * @mode: tracking mode, currently only write track is supported.
+ */
+void kvm_page_track_remove_page(struct kvm *kvm, gfn_t gfn,
+   enum kvm_page_track_mode mode)
+{
+   struct kvm_memslots *slots;
+   struct kvm_memory_slot *slot;
+   int i;
+
+   WARN_ON(!check_mode(mode));
+
+   for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
+   slots = __kvm_memslots(kvm, i);
+   slot = __gfn_to_memslot(slots, gfn);
+
+   spin_lock(>mmu_lock);
+   update_gfn_track(slot, gfn, mode, -1);
+
+   /*
+* allow large page mapping for the tracked page
+* after the tracker is gone.
+*/
+   kvm_mmu_gfn_allow_lpage(slot, gfn);
+   spin_unlock(>mmu_lock);
+   }
+}


--
To unsubscribe from 

Re: [PATCH v6 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2015-12-14 Thread Archit Taneja

Hi,

On 12/15/2015 09:00 AM, Jitao Shi wrote:

This patch adds drm_bridge driver for parade DSI to eDP bridge chip.

Signed-off-by: Jitao Shi 
---
Changes since v5
-fix compile errors when CONFIG_GPIOLIB=n
---
  drivers/gpu/drm/bridge/Kconfig |   10 +
  drivers/gpu/drm/bridge/Makefile|1 +
  drivers/gpu/drm/bridge/parade-ps8640.c |  472 
  3 files changed, 483 insertions(+)
  create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 639..dcfdbc9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -41,4 +41,14 @@ config DRM_PARADE_PS8622
---help---
  Parade eDP-LVDS bridge chip driver.

+config DRM_PARADE_PS8640
+   tristate "Parade PS8640 MIPI DSI to eDP Converter"
+   depends on OF
+   select DRM_KMS_HELPER
+   select DRM_PANEL
+   ---help---
+ Choose this option if you have PS8640 for display
+ The PS8640 is a high-performance and low-power
+ MIPI DSI to eDP converter
+
  endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d4e28be..272e3c01 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
  obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
  obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
  obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
b/drivers/gpu/drm/bridge/parade-ps8640.c
new file mode 100644
index 000..bf0c3c37
--- /dev/null
+++ b/drivers/gpu/drm/bridge/parade-ps8640.c
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 


This doesn't seem to be used at the moment.




+
+static int ps8640_probe(struct i2c_client *client,
+   const struct i2c_device_id *id)
+{
+   struct device *dev = >dev;
+   struct ps8640 *ps_bridge;
+   struct device_node *np = dev->of_node;
+   struct device_node *port, *out_ep;
+   struct device_node *panel_node = NULL;
+   int i, ret;
+
+   ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL);
+   if (!ps_bridge)
+   return -ENOMEM;
+
+   /* port@1 is ps8640 output port */
+   port = of_graph_get_port_by_id(np, 1);
+   if (port) {
+   out_ep = of_get_child_by_name(port, "endpoint");
+   of_node_put(port);
+   if (out_ep) {
+   panel_node = of_graph_get_remote_port_parent(out_ep);
+   of_node_put(out_ep);
+   }
+   }
+   if (panel_node) {
+   ps_bridge->panel = of_drm_find_panel(panel_node);
+   of_node_put(panel_node);
+   if (!ps_bridge->panel)
+   return -EPROBE_DEFER;
+   }


The driver retrieves the panel from the output port via DT, but doesn't
retrieve the DSI host from the input port?

Wouldn't this driver need to call a "mipi_dsi_attach" at some point to
link with the DSI host (and pass parameters like number of lanes, color
format etc)?

I've been working on a patchset[1] which lets i2c drivers create mipi
dsi devices. I think this would be needed for the ps8640 driver too.

[1] https://lkml.org/lkml/2015/12/10/283

Archit


+
+   ps_bridge->page[0] = client;
+   for (i = 1; i < 6; i++)
+   ps_bridge->page[i] = i2c_new_dummy(client->adapter,
+  client->addr + i);
+
+   ps_bridge->pwr_3v3_supply = devm_regulator_get(dev, "vdd33");
+   if (IS_ERR(ps_bridge->pwr_3v3_supply)) {
+   ret = PTR_ERR(ps_bridge->pwr_3v3_supply);
+   dev_err(dev, "cannot get vdd33 supply: %d\n", ret);
+   return ret;
+   }
+
+   ps_bridge->pwr_1v2_supply = devm_regulator_get(dev, "vdd12");
+   if (IS_ERR(ps_bridge->pwr_1v2_supply)) {
+   ret = PTR_ERR(ps_bridge->pwr_1v2_supply);
+   dev_err(dev, "cannot get vdd12 supply: %d\n", ret);
+   return ret;
+   }
+
+   ps_bridge->gpio_mode_sel_n = devm_gpiod_get(>dev, "mode-sel",
+   GPIOD_OUT_HIGH);
+   

Re: [PATCH 8/9] tools/testing/libnvdimm: cleanup mock resource lookup

2015-12-14 Thread Dan Williams
On Mon, Dec 14, 2015 at 6:15 PM, Dan Williams  wrote:
> Push the locking around get_nfit_res() into get_nfit_res().
>
> Signed-off-by: Dan Williams 
> ---
>  tools/testing/nvdimm/test/iomap.c |   86 
> +
>  1 file changed, 39 insertions(+), 47 deletions(-)
>
> diff --git a/tools/testing/nvdimm/test/iomap.c 
> b/tools/testing/nvdimm/test/iomap.c
> index 802d3a173ccf..d9c6c5af67e8 100644
> --- a/tools/testing/nvdimm/test/iomap.c
> +++ b/tools/testing/nvdimm/test/iomap.c
[..]
> @@ -83,55 +89,55 @@ EXPORT_SYMBOL(__wrap_devm_ioremap_nocache);
>  void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
> size_t size, unsigned long flags)
>  {
> -   struct nfit_test_resource *nfit_res;
> +   struct nfit_test_resource *nfit_res = get_nfit_res(offset);
>
> -   rcu_read_lock();
> -   nfit_res = get_nfit_res(offset);
> -   rcu_read_unlock();
> if (nfit_res)
> return nfit_res->buf + offset - nfit_res->res->start;
> return devm_memremap(dev, offset, size, flags);
>  }
>  EXPORT_SYMBOL(__wrap_devm_memremap);
>
> -void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res)
> +#ifdef PFN_MAP
> +void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res,
> +   struct percpu_ref *ref, struct vmem_altmap *altmap)
>  {
> -   struct nfit_test_resource *nfit_res;
> resource_size_t offset = res->start;
> +   struct nfit_test_resource *nfit_res = get_nfit_res(offset);
>
> -   rcu_read_lock();
> -   nfit_res = get_nfit_res(offset);
> -   rcu_read_unlock();
> if (nfit_res)
> return nfit_res->buf + offset - nfit_res->res->start;
> -   return devm_memremap_pages(dev, res);
> +   return devm_memremap_pages(dev, res, ref, altmap);
>  }
>  EXPORT_SYMBOL(__wrap_devm_memremap_pages);
>
> -#ifdef PFN_MAP
>  pfn_t __wrap_phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
>  {
> -   struct nfit_test_resource *nfit_res;
> -
> -   rcu_read_lock();
> -   nfit_res = get_nfit_res(offset);
> -   rcu_read_unlock();
> +   struct nfit_test_resource *nfit_res = get_nfit_res(addr);
>
> if (nfit_res)
> flags &= ~PFN_MAP;
> -return phys_to_pfn_t(addr >> PAGE_SHIFT, flags);
> +return phys_to_pfn_t(addr, flags);
>  }
>  EXPORT_SYMBOL(__wrap_phys_to_pfn_t);
> +#else
> +/* to be removed post 4.5-rc1 */
> +void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res)
> +{
> +   resource_size_t offset = res->start;
> +   struct nfit_test_resource *nfit_res = get_nfit_res(offset);
> +
> +   if (nfit_res)
> +   return nfit_res->buf + offset - nfit_res->res->start;
> +   return devm_memremap_pages(dev, res);
> +}
> +EXPORT_SYMBOL(__wrap_devm_memremap_pages);
>  #endif

Whoops, the above hunk was meant to be folded into [PATCH 6/9]
libnvdimm, pfn: enable pfn sysfs interface unit testing
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 04/11] KVM: page track: add the framework of guest page tracking

2015-12-14 Thread Kai Huang

Hi Guangrong,

I am starting to review this series, and should have some comments or 
questions, you can determine whether they are valuable :)


See  below.

On 12/01/2015 02:26 AM, Xiao Guangrong wrote:

The array, gfn_track[mode][gfn], is introduced in memory slot for every
guest page, this is the tracking count for the gust page on different
modes. If the page is tracked then the count is increased, the page is
not tracked after the count reaches zero

Two callbacks, kvm_page_track_create_memslot() and
kvm_page_track_free_memslot() are implemented in this patch, they are
internally used to initialize and reclaim the memory of the array

Currently, only write track mode is supported

Signed-off-by: Xiao Guangrong 
---
  arch/x86/include/asm/kvm_host.h   |  2 ++
  arch/x86/include/asm/kvm_page_track.h | 13 
  arch/x86/kvm/Makefile |  3 +-
  arch/x86/kvm/page_track.c | 58 +++
  arch/x86/kvm/x86.c|  5 +++
  5 files changed, 80 insertions(+), 1 deletion(-)
  create mode 100644 arch/x86/include/asm/kvm_page_track.h
  create mode 100644 arch/x86/kvm/page_track.c

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 5aa2dcc..afff1f1 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -32,6 +32,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #define KVM_MAX_VCPUS 255

  #define KVM_SOFT_MAX_VCPUS 160
@@ -612,6 +613,7 @@ struct kvm_lpage_info {
  struct kvm_arch_memory_slot {
struct kvm_rmap_head *rmap[KVM_NR_PAGE_SIZES];
struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
+   int *gfn_track[KVM_PAGE_TRACK_MAX];
  };
  
  /*

diff --git a/arch/x86/include/asm/kvm_page_track.h 
b/arch/x86/include/asm/kvm_page_track.h
new file mode 100644
index 000..347d5c9
--- /dev/null
+++ b/arch/x86/include/asm/kvm_page_track.h
@@ -0,0 +1,13 @@
+#ifndef _ASM_X86_KVM_PAGE_TRACK_H
+#define _ASM_X86_KVM_PAGE_TRACK_H
+
+enum kvm_page_track_mode {
+   KVM_PAGE_TRACK_WRITE,
+   KVM_PAGE_TRACK_MAX,
+};
+
+int kvm_page_track_create_memslot(struct kvm_memory_slot *slot,
+ unsigned long npages);
+void kvm_page_track_free_memslot(struct kvm_memory_slot *free,
+struct kvm_memory_slot *dont);
+#endif
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index a1ff508..464fa47 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -13,9 +13,10 @@ kvm-$(CONFIG_KVM_ASYNC_PF)   += $(KVM)/async_pf.o
  
  kvm-y			+= x86.o mmu.o emulate.o i8259.o irq.o lapic.o \

   i8254.o ioapic.o irq_comm.o cpuid.o pmu.o mtrr.o \
-  hyperv.o
+  hyperv.o page_track.o
  
  kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT)	+= assigned-dev.o iommu.o

+
  kvm-intel-y   += vmx.o pmu_intel.o
  kvm-amd-y += svm.o pmu_amd.o
  
diff --git a/arch/x86/kvm/page_track.c b/arch/x86/kvm/page_track.c

new file mode 100644
index 000..0338d36
--- /dev/null
+++ b/arch/x86/kvm/page_track.c
@@ -0,0 +1,58 @@
+/*
+ * Support KVM gust page tracking
+ *
+ * This feature allows us to track page access in guest. Currently, only
+ * write access is tracked.
+ *
+ * Copyright(C) 2015 Intel Corporation.
+ *
+ * Author:
+ *   Xiao Guangrong 
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include 
+#include 
+#include 
+
+#include "mmu.h"
+
+static void page_track_slot_free(struct kvm_memory_slot *slot)
+{
+   int i;
+
+   for (i = 0; i < KVM_PAGE_TRACK_MAX; i++)
+   if (slot->arch.gfn_track[i]) {
+   kvfree(slot->arch.gfn_track[i]);
+   slot->arch.gfn_track[i] = NULL;
+   }
+}
+
+int kvm_page_track_create_memslot(struct kvm_memory_slot *slot,
+ unsigned long npages)
+{
+   int  i, pages = gfn_to_index(slot->base_gfn + npages - 1,
+ slot->base_gfn, PT_PAGE_TABLE_LEVEL) + 1;
+
+   for (i = 0; i < KVM_PAGE_TRACK_MAX; i++) {
+   slot->arch.gfn_track[i] = kvm_kvzalloc(pages *
+   sizeof(*slot->arch.gfn_track[i]));
+   if (!slot->arch.gfn_track[i])
+   goto track_free;
+   }
+
+   return 0;
+
+track_free:
+   page_track_slot_free(slot);
+   return -ENOMEM;
+}
Is it necessary to use the 'unsigned long npages' pareameter? In my 
understanding you are going to track all GFNs in the memory slot anyway, 
right? If you want to keep npages, I think it's better to add a base_gfn 
as well otherwise you are assuming you are going to track the npages GFN 
starting from slot->base_gfn.



+
+void kvm_page_track_free_memslot(struct kvm_memory_slot *free,
+struct kvm_memory_slot *dont)
+{
+   

Query regarding Coverity tool

2015-12-14 Thread pavi1729
Hi,
  May I know if the community uses the Coverity tool and, if yes where
can I find a repo of
Coverity scans of kernels and IGNORE LIST; cause there obviously be
false positives.

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


Re: [RFC PATCH v6 3/3] arm: fix a migrating irq bug when hotplug cpu

2015-12-14 Thread Yang Yingliang

Hi, Russell

On 2015/10/22 19:13, Russell King - ARM Linux wrote:

On Thu, Oct 22, 2015 at 06:56:29PM +0800, Yang Yingliang wrote:

I described it in v2 cover letter and kept the change history in v6
cover letter. There is no comment on the change when patch the was
reviewing in v2, so I thought it's ok and I kept the change in the
next versions.


Cover letters don't always get read, neither do changelogs.

However, there's a principle here: never mix moving code around with
changes to that code.  Always move code with as few changes as possible
in one patch, and then make changes in a subsequent patch.

The "few changes as possible" means that if you need to make changes
for it to end up building in its new location, such as removing a
'static' or adding an 'EXPORT_SYMBOL' then those are fine, but the
main body of the code should remain identical, even down to style.

Any changes (such as, in this case, replacing pr_debug with pr_warn)
should be done as a distinctly separate patch so that such changes
are immediately obvious to reviewers.


Need I send a patch to the Thomas branch to revert the change ?


I think wait for Thomas and Catalin to reply.  Your patch series is
currently merged into two different trees (Thomas' and Catalin's
trees) and what action is needed depends on how they want to handle
it.

The solutions are:
* A patch to restore the pr_debug() which Thomas applies, and Catalin
   and myself then pull Thomas' tree again, which potentially creates
   a messier history.

* Catalin drops the ARM64 change and Thomas' tree from the ARM64 tree,
   Thomas drops the original commit, and we start again doing it
   correctly.

Which is up to Catalin and Thomas.

I've dropped it from my tree as an easy way to fix the regression
on ARM for the time being, pending the outcome of deciding how to
fix this.



The regression had been fixed.
Do I need to put the patch in the patch system again ?

Regards,
Yang

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


Re: [PATCH v6 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2015-12-14 Thread Daniel Kurtz
On Tue, Dec 15, 2015 at 11:30 AM, Jitao Shi  wrote:
> This patch adds drm_bridge driver for parade DSI to eDP bridge chip.
>
> Signed-off-by: Jitao Shi 
> ---
> Changes since v5
> -fix compile errors when CONFIG_GPIOLIB=n
> ---
>  drivers/gpu/drm/bridge/Kconfig |   10 +
>  drivers/gpu/drm/bridge/Makefile|1 +
>  drivers/gpu/drm/bridge/parade-ps8640.c |  472 
> 
>  3 files changed, 483 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 639..dcfdbc9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -41,4 +41,14 @@ config DRM_PARADE_PS8622
> ---help---
>   Parade eDP-LVDS bridge chip driver.
>
> +config DRM_PARADE_PS8640
> +   tristate "Parade PS8640 MIPI DSI to eDP Converter"
> +   depends on OF
> +   select DRM_KMS_HELPER
> +   select DRM_PANEL
> +   ---help---
> + Choose this option if you have PS8640 for display
> + The PS8640 is a high-performance and low-power
> + MIPI DSI to eDP converter
> +
>  endmenu
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index d4e28be..272e3c01 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
>  obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
>  obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
>  obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
> +obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
> b/drivers/gpu/drm/bridge/parade-ps8640.c
> new file mode 100644
> index 000..bf0c3c37
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -0,0 +1,472 @@
> +/*
> + * Copyright (c) 2014 MediaTek Inc.
> + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define PAGE2_GPIO_L   0xa6
> +#define PAGE2_GPIO_H   0xa7
> +#define PS_GPIO9   BIT(1)
> +#define PAGE2_I2C_BYPASS   0xea
> +#define I2C_BYPASS_EN  0xd0
> +
> +#define PAGE3_SET_ADD  0xfe
> +#define PAGE3_SET_VAL  0xff
> +#define VDO_CTL_ADD0x13
> +#define VDO_DIS0x18
> +#define VDO_EN 0x1c
> +
> +#define PAGE4_REV_L0xf0
> +#define PAGE4_REV_H0xf1
> +#define PAGE4_CHIP_L   0xf2
> +#define PAGE4_CHIP_H   0xf3
> +
> +#define bridge_to_ps8640(e)container_of(e, struct ps8640, bridge)
> +#define connector_to_ps8640(e) container_of(e, struct ps8640, connector)
> +
> +struct ps8640 {
> +   struct drm_connector connector;
> +   struct drm_bridge bridge;
> +   struct i2c_client *page[6];
> +   struct ps8640_driver_data *driver_data;
> +   struct regulator *pwr_1v2_supply;
> +   struct regulator *pwr_3v3_supply;
> +   struct drm_panel *panel;
> +   struct gpio_desc *gpio_rst_n;
> +   struct gpio_desc *gpio_slp_n;
> +   struct gpio_desc *gpio_mode_sel_n;
> +   bool enabled;
> +};
> +
> +static int ps8640_regr(struct i2c_client *client, u8 reg, u8 *value)
> +{
> +   int ret;
> +
> +   ret = i2c_master_send(client, , 1);
> +   if (ret <= 0) {
> +   dev_err(>dev, "Failed to send i2c command, ret=%d\n",
> +   ret);
> +   return ret;
> +   }
> +
> +   ret = i2c_master_recv(client, value, 1);
> +   if (ret <= 0) {
> +   dev_err(>dev, "Failed to recv i2c data, ret=%d\n", 
> ret);
> +   return ret;
> +   }

i2c_transfer should be a bit more efficient for reading one byte.

> +
> +   return 0;
> +}
> +
> +static int ps8640_regw(struct i2c_client *client, u8 reg, u8 value)
> +{
> +   int ret;
> +   char buf[2];
> +
> +   buf[0] = reg;
> +   buf[1] = value;
> +   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
> +   if (ret <= 0) {
> +   dev_err(>dev, "Failed to send i2c command, ret=%d\n",
> +   ret);
> +   return ret;
> +   }
> +
> +   return 0;
> +}
> +
> +static bool ps8640_check_valid_id(struct ps8640 *ps_bridge)
> +{
> +   struct i2c_client *client = 

Re: [PATCH for-4.4] mtd: fix cmdlinepart parser, early naming for auto-filled MTD

2015-12-14 Thread Heiko Schocher

Hello Brian,

Am 14.12.2015 um 20:24 schrieb Brian Norris:

On Fri, Dec 11, 2015 at 09:39:18PM -0800, Brian Norris wrote:

On Sat, Dec 12, 2015 at 05:45:21AM +0100, Heiko Schocher wrote:

Am 12.12.2015 um 00:58 schrieb Brian Norris:

Commit 807f16d4db95 ("mtd: core: set some defaults when dev.parent is
set") attempted to provide some default settings for MTDs that
  (a) assign the parent device and
  (b) don't provide their own name or owner

However, this isn't a perfect drop-in replacement for the boilerplate
found in some drivers, because the MTD name is used by partition
parsers like cmdlinepart, but the name isn't set until add_mtd_device(),
after the parsing is completed. This means cmdlinepart sees a NULL name
and therefore will not work properly.

Fix this by moving the default name and owner assignment to be first in
the MTD registration process.

Fixes: 807f16d4db95 ("mtd: core: set some defaults when dev.parent is set")
Reported-by: Heiko Schocher 
Signed-off-by: Brian Norris 
Cc: Heiko Schocher 
Cc: Frans Klaver 
---
Heiko, can you provide testing feedback (e.g., 'Tested-by: ...')?


Sorry, does not work for me:

Based on:
pollux:linux hs [20151212] $ git describe master
v4.4-rc4-135-gb9d8545

and this patch, shows the same problem,


[...]


BTW, can you please include the relevant log snippets when replying in
the future?


Uh, Sorry for that, yes of course ...


Ugh, I see the problem. In nand_base.c, nand_get_flash_type():

if (!mtd->name)
mtd->name = type->name;


Specifically, I think we could hack around this with something like the
following additional patch. Untested:

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ece544efccc3..9f169566fba4 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct 
mtd_info *mtd,
if (!type)
type = nand_flash_ids;

+   if (!mtd->name && mtd->dev.parent)
+   mtd->name = dev_name(mtd->dev.parent);
+
for (; type->name != NULL; type++) {
if (is_full_id_nand(type)) {
if (find_full_id_nand(mtd, chip, type, id_data, ))



Sorry, I had not yet the time to look into the issue deeper, Thanks for
digging into it. I tried therefore your patch (automated with tbot see
below [1]) on linux "v4.4-rc5" and

your patch works!

bye,
Heiko

[1] automated test with tbot [2]
http://xeidos.ddns.net/buildbot/builders/mcx/builds/7/steps/shell/logs/tbotlog

as there is a lot of things done automatically, search for
"Micron MT29F4G16ABADAWP"

All you see in the log is done automatically with tbot. The mcx board
is in munich, while I am doing the test from hungary. In my testsetup
tbot is integrated into buildbot, which is used for the webserver
and triggering builds.

What is done:
- get linux code (if it is not already checked out)
- apply patches
  (I have also a testcase, which download all patches from patchwork,
   which are delegated to me (for u-boot), check them with checkpatch
   and apply it ... very helpful, if this is done in a nightly build,
   you have only to look in the morning, if all is green, and you know
   that all patches are checkpatch clean, apply celan, compile clean
   and do not break the boards you have in your nightly build ... also
   there is a testcase which starts a git bisect test [3] ...)

   As I did not mainlined the board yet, there are a bunch of checkpatch
   errors, so I disabled that the testcase fails, if there are errors.

- compile linux
- copy files to tftpdir
- boot them
- execute testcases
  for example check in dmesg some strings with:
  https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lx_dmesg_grep.py

  So detected our current bug ;-)

  check register settings with devmem2:
  https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lx_check_reg_file.py

  Thats very nice, as you can check for example complete pinmux register.
  see as an example [4]

last but not least, tbot (and buildbot incl. webserver) is running on a
raspberry pi at my home! So no expensive hw costs.

[2] https://github.com/hsdenx/tbot
[3] git bisect automated:
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_board_git_bisect.py
log as an example for U-Boot:

http://xeidos.ddns.net/buildbot/builders/tqm5200s/builds/3/steps/shell/logs/tbotlog
[4] register file
https://github.com/hsdenx/tbot/blob/master/src/files/ccu1_pinmux_scm.reg

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] powerpc: Enable UBSAN support

2015-12-14 Thread Daniel Axtens

>> Have you tried running with KVM?

OK, I ran a UBSAN kvm guest on a UBSAN host and I ran trinity inside the
guest. It all appears to work as usual.

I really don't have the knowledge to determine what we should exclude,
but I'm very very happy to respin with a greater list of excludes if you
think that's a good idea.

Regards,
Daniel


>>
>> I'm wondering if we should be excluding some of the KVM code that runs in 
>> real mode, eg:
>>
>>   arch/powerpc/kvm/book3s_hv_rm_mmu.c
>>   arch/powerpc/kvm/book3s_hv_rm_xics.c
>>
>> And maybe some other bits.
>>
>> Also the early setup code, a/p/k/setup*.c might be dicey.
>
> My philosphy was just to copy the GCOV excludes, although you're right
> that perhaps we want to be more aggressive in excluding here given that
> the UBSAN handlers print a bunch of stuff. I'm happy to respin with
> further exclusions - they're really easy to add.
>
>> In all of the above it's probably OK unless you actually hit a warning at the
>> wrong point, so testing will probably not find problems. Although I guess we
>> could add some deliberatly incorrect code at certain points and check we
>> survive the warning.
>
> Yep. I'll run a kvm guest on an instrumented kernel and let you know
> what happens!
>
>>
>> Is there an easy way to spot the calls to UBSAN in the generated code?
>
> Yes - because of the handler functions, they're *really* easy to spot.
> Here's some assembly for GregorianDay():
>
>
> c002924c:   6d 26 7e 48 bl  c080b8b8 
> <__ubsan_handle_mul_overflow+0x8>
> c0029250:   00 00 00 60 nop
> c0029254:   38 fe ff 4b b   c002908c 
> 
> c0029258:   8c ff 62 3c addis   r3,r2,-116
> c002925c:   01 00 a0 38 li  r5,1
> c0029260:   78 db 64 7f mr  r4,r27
> c0029264:   50 9c 63 38 addir3,r3,-25520
> c0029268:   41 26 7e 48 bl  c080b8a8 
> <__ubsan_handle_sub_overflow+0x8>
> c002926c:   00 00 00 60 nop
> c0029270:   44 fe ff 4b b   c00290b4 
> 
> c0029274:   8c ff 62 3c addis   r3,r2,-116
> c0029278:   78 d3 45 7f mr  r5,r26
> c002927c:   e0 9c 63 38 addir3,r3,-25376
> c0029280:   19 26 7e 48 bl  c080b898 
> <__ubsan_handle_add_overflow+0x8>
> c0029284:   00 00 00 60 nop
> c0029288:   94 fe ff 4b b   c002911c 
> 
> c002928c:   8c ff 62 3c addis   r3,r2,-116
> c0029290:   78 f3 c4 7f mr  r4,r30
> c0029294:   68 9c 63 38 addir3,r3,-25496
> c0029298:   b1 21 7e 48 bl  c080b448 
> <__ubsan_handle_out_of_bounds+0x8>
> c002929c:   00 00 00 60 nop
> c00292a0:   20 fe ff 4b b   c00290c0 
> 
> c00292a4:   14 4a 24 7d add r9,r4,r9
> c00292a8:   40 48 a4 7f cmpld   cr7,r4,r9
> c00292ac:   2c fe fd 41 bgt+cr7,c00290d8 
> 
>
> You can see that there are lots of calls to __ubsan_handle_blah_blah
> inserted.
>
> Regards,
> Daniel
>
>>
>> cheers
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/


signature.asc
Description: PGP signature


Re: linux-next: manual merge of the akpm-current tree with the powerpc tree

2015-12-14 Thread Stephen Rothwell
Hi Andrew,

On Tue, 15 Dec 2015 16:53:42 +1100 Stephen Rothwell  
wrote:
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash.h 
> b/arch/powerpc/include/asm/book3s/64/hash.h
> index 8b929e531758..4e69d9a273ed 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> @@ -48,9 +43,8 @@
>  /*
>   * set of bits not changed in pmd_modify.
>   */
> -#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS |\
> -  _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \
> -  _PAGE_THP_HUGE | _PAGE_PTE)
> +#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY |
   ^
I missed a backslash here which I fixed up in my tree.

> +  _PAGE_ACCESSED | _PAGE_THP_HUGE | _PAGE_PTE)
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] mm: change find_vma() function

2015-12-14 Thread yalin wang

> On Dec 15, 2015, at 05:11, Kirill A. Shutemov  wrote:
> 
> On Mon, Dec 14, 2015 at 06:55:09PM +0100, Oleg Nesterov wrote:
>> On 12/14, Kirill A. Shutemov wrote:
>>> 
>>> On Mon, Dec 14, 2015 at 07:02:25PM +0800, yalin wang wrote:
 change find_vma() to break ealier when found the adderss
 is not in any vma, don't need loop to search all vma.
 
 Signed-off-by: yalin wang 
 ---
 mm/mmap.c | 3 +++
 1 file changed, 3 insertions(+)
 
 diff --git a/mm/mmap.c b/mm/mmap.c
 index b513f20..8294c9b 100644
 --- a/mm/mmap.c
 +++ b/mm/mmap.c
 @@ -2064,6 +2064,9 @@ struct vm_area_struct *find_vma(struct mm_struct 
 *mm, unsigned long addr)
vma = tmp;
if (tmp->vm_start <= addr)
break;
 +  if (!tmp->vm_prev || tmp->vm_prev->vm_end <= addr)
 +  break;
 +
>>> 
>>> This 'break' would return 'tmp' as found vma.
>> 
>> But this would be right?
> 
> Hm. Right. Sorry for my tone.
> 
> I think the right condition is 'tmp->vm_prev->vm_end < addr', not '<=' as
> vm_end is the first byte after the vma. But it's equivalent in practice
> here.
> 
this should be <= here,
because vma’s effect address space doesn’t include vm_end add,
so if an address vm_end <= add , this means this addr don’t belong to this vma,

> Anyway, I don't think it's possible to gain anything measurable from this
> optimization.
> 
the advantage is that if addr don’t belong to any vma, we don’t need loop all 
vma,
we can break earlier if we found the most closest vma which vma->end_add > addr,
>> 
>> Not that I think this optimization makes sense, I simply do not know,
>> but to me this change looks technically correct at first glance...
>> 
>> But the changelog is wrong or I missed something. This change can stop
>> the main loop earlier; if "tmp" is the first vma,
> 
> For the first vma, we don't get anything comparing to what we have now:
> check for !rb_node on the next iteration would have the same trade off and
> effect as the proposed check.
Yes
> 
>> or if the previous one is below the address.
> 
> Yes, but would it compensate additional check on each 'tmp->vm_end > addr'
> iteration to the point? That's not obvious.
> 
>> Or perhaps I just misread that "not in any vma" note in the changelog.
>> 
>> No?
>> 
>> Oleg.
>> 

i have test it, it works fine. :)
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: Linux 4.2.8

2015-12-14 Thread Greg KH
diff --git a/Makefile b/Makefile
index f5014eaf2532..06b988951ccb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 2
-SUBLEVEL = 7
+SUBLEVEL = 8
 EXTRAVERSION =
 NAME = Hurr durr I'ma sheep
 
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 017b7d58ae06..55f8a6a706fc 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3439,6 +3439,7 @@ static void rbd_queue_workfn(struct work_struct *work)
goto err_rq;
}
img_request->rq = rq;
+   snapc = NULL; /* img_request consumes a ref */
 
if (op_type == OBJ_OP_DISCARD)
result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index f51d376d10ba..c2f5117fd8cb 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3675,6 +3675,11 @@ static int pci_probe(struct pci_dev *dev,
 
reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
+   /* JMicron JMB38x often shows 0 at first read, just ignore it */
+   if (!ohci->it_context_support) {
+   ohci_notice(ohci, "overriding IsoXmitIntMask\n");
+   ohci->it_context_support = 0xf;
+   }
reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
ohci->it_context_mask = ohci->it_context_support;
ohci->n_it = hweight32(ohci->it_context_mask);
diff --git a/drivers/media/pci/cobalt/Kconfig b/drivers/media/pci/cobalt/Kconfig
index 6a1c0089bb62..4ecf171d14a2 100644
--- a/drivers/media/pci/cobalt/Kconfig
+++ b/drivers/media/pci/cobalt/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_COBALT
tristate "Cisco Cobalt support"
-   depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER
+   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
depends on PCI_MSI && MTD_COMPLEX_MAPPINGS && GPIOLIB
depends on SND
select I2C_ALGOBIT
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c 
b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 3b90afb8c293..6f2a748524f3 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1325,7 +1325,12 @@ err_disable_device:
 static void nicvf_remove(struct pci_dev *pdev)
 {
struct net_device *netdev = pci_get_drvdata(pdev);
-   struct nicvf *nic = netdev_priv(netdev);
+   struct nicvf *nic;
+
+   if (!netdev)
+   return;
+
+   nic = netdev_priv(netdev);
 
unregister_netdev(netdev);
nicvf_unregister_interrupts(nic);
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c 
b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 731423ca575d..8bead97373ab 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4934,26 +4934,41 @@ static void rem_slave_counters(struct mlx4_dev *dev, 
int slave)
struct res_counter *counter;
struct res_counter *tmp;
int err;
-   int index;
+   int *counters_arr = NULL;
+   int i, j;
 
err = move_all_busy(dev, slave, RES_COUNTER);
if (err)
mlx4_warn(dev, "rem_slave_counters: Could not move all counters 
- too busy for slave %d\n",
  slave);
 
-   spin_lock_irq(mlx4_tlock(dev));
-   list_for_each_entry_safe(counter, tmp, counter_list, com.list) {
-   if (counter->com.owner == slave) {
-   index = counter->com.res_id;
-   rb_erase(>com.node,
->res_tree[RES_COUNTER]);
-   list_del(>com.list);
-   kfree(counter);
-   __mlx4_counter_free(dev, index);
+   counters_arr = kmalloc_array(dev->caps.max_counters,
+sizeof(*counters_arr), GFP_KERNEL);
+   if (!counters_arr)
+   return;
+
+   do {
+   i = 0;
+   j = 0;
+   spin_lock_irq(mlx4_tlock(dev));
+   list_for_each_entry_safe(counter, tmp, counter_list, com.list) {
+   if (counter->com.owner == slave) {
+   counters_arr[i++] = counter->com.res_id;
+   rb_erase(>com.node,
+>res_tree[RES_COUNTER]);
+   list_del(>com.list);
+   kfree(counter);
+   }
+   }
+   spin_unlock_irq(mlx4_tlock(dev));
+
+   while (j < i) {
+   __mlx4_counter_free(dev, counters_arr[j++]);
mlx4_release_resource(dev, slave, RES_COUNTER, 1, 0);
}
-   }
-   spin_unlock_irq(mlx4_tlock(dev));
+   } while (i);
+
+   kfree(counters_arr);
 }
 
 static void 

Linux 4.2.8

2015-12-14 Thread Greg KH
I'm announcing the release of the 4.2.8 kernel.

All users of the 4.2 kernel series must upgrade.

NOTE:  This is the LAST 4.2.y kernel to be released.  It is now
end-of-life.  Please move to the 4.3.y kernel series at this time.

The updated 4.2.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.2.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 drivers/block/rbd.c   |1 
 drivers/firewire/ohci.c   |5 
 drivers/media/pci/cobalt/Kconfig  |2 
 drivers/net/ethernet/cavium/thunder/nicvf_main.c  |7 
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |   39 +-
 drivers/net/ethernet/via/via-rhine.c  |3 
 drivers/net/phy/broadcom.c|2 
 drivers/net/usb/qmi_wwan.c|1 
 fs/btrfs/ctree.h  |4 
 fs/btrfs/delayed-ref.c|  139 +++-
 fs/btrfs/delayed-ref.h|7 
 fs/btrfs/extent-tree.c|   59 +--
 fs/btrfs/file.c   |   36 +-
 fs/btrfs/inode.c  |   96 --
 fs/btrfs/ioctl.c  |  257 +---
 fs/btrfs/relocation.c |   16 -
 fs/btrfs/send.c   |   10 
 fs/btrfs/tree-log.c   |2 
 fs/btrfs/xattr.c  |4 
 fs/ceph/mds_client.c  |2 
 fs/debugfs/inode.c|6 
 fs/ext4/crypto.c  |1 
 fs/ext4/crypto_fname.c|2 
 fs/ext4/crypto_key.c  |   16 -
 fs/ext4/crypto_policy.c   |3 
 fs/ext4/ext4_jbd2.c   |6 
 fs/ext4/page-io.c |5 
 fs/ext4/super.c   |   12 
 fs/jbd2/journal.c |6 
 fs/nfs/inode.c|6 
 fs/nfs/nfs4client.c   |2 
 fs/nfsd/nfs4state.c   |  127 +++
 fs/nfsd/state.h   |   19 -
 fs/ocfs2/namei.c  |2 
 include/linux/ipv6.h  |2 
 include/linux/jbd2.h  |1 
 include/net/af_unix.h |1 
 include/net/ip6_fib.h |3 
 include/net/ip6_tunnel.h  |3 
 include/net/ip_tunnels.h  |3 
 include/net/ipv6.h|   22 +
 include/net/sch_generic.h |3 
 include/net/switchdev.h   |2 
 kernel/bpf/arraymap.c |2 
 net/core/neighbour.c  |4 
 net/core/scm.c|2 
 net/dccp/ipv6.c   |   33 +-
 net/ipv4/ipmr.c   |   15 
 net/ipv4/tcp_input.c  |   23 +
 net/ipv4/tcp_ipv4.c   |3 
 net/ipv4/tcp_timer.c  |   12 
 net/ipv6/af_inet6.c   |   13 
 net/ipv6/datagram.c   |4 
 net/ipv6/exthdrs.c|3 
 net/ipv6/inet6_connection_sock.c  |   11 
 net/ipv6/ip6mr.c  |   15 
 net/ipv6/ipv6_sockglue.c  |   33 +-
 net/ipv6/mcast.c  |2 
 net/ipv6/netfilter/nf_conntrack_reasm.c   |5 
 net/ipv6/raw.c|8 
 net/ipv6/reassembly.c |   10 
 net/ipv6/route.c  |   22 +
 net/ipv6/syncookies.c |2 
 net/ipv6/tcp_ipv6.c   |   28 +
 net/ipv6/udp.c|8 
 net/l2tp/l2tp_ip6.c   |8 
 net/packet/af_packet.c|   86 ++---
 net/rds/connection.c  |6 
 net/rds/send.c   

Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Greg KH
Why is the "Re:" in the Subject?

Why is "Patch" in the subject"?

The Subject doesn't even make sense.

On Mon, Dec 14, 2015 at 08:58:30PM -0500, Sanidhya Solanki wrote:
> Patch contains the spacing fixes that led to checkpatch.pl warnings.
> 
> Signed-off-by: Sanidhya Solanki 
> ---
>  drivers/staging/dgnc/dgnc_cls.c|   4 +-
>  drivers/staging/dgnc/dgnc_driver.h |   8 --
>  drivers/staging/dgnc/dgnc_neo.c| 235
> -


Patch is line-wrapped and doesn't even apply :(

Please take a day, relax, and fix up all 3 of these and resend them
tomorrow.  There's no rush here.

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/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Amitoj Kaur Chawla
On Tue, Dec 15, 2015 at 7:28 AM, Sanidhya Solanki  wrote:
>
> Patch contains the spacing fixes that led to checkpatch.pl warnings.
>
> Signed-off-by: Sanidhya Solanki 
> ---
>  drivers/staging/dgnc/dgnc_cls.c|   4 +-
>  drivers/staging/dgnc/dgnc_driver.h |   8 --
>  drivers/staging/dgnc/dgnc_neo.c| 235
> -
> drivers/staging/dgnc/dgnc_neo.h|  22 ++--
> drivers/staging/dgnc/dgnc_pci.h|   1 -
> drivers/staging/dgnc/dgnc_sysfs.c  |  18 ++-
> drivers/staging/dgnc/dgnc_tty.c|  46 +---
> drivers/staging/dgnc/digi.h|  32 ++--- 8 files changed, 223
> insertions(+), 143 deletions(-)
>

Hi Sanidhya,

Just to help you out since you're struggling some.

Subject line should be something like "Fix checkpatch warnings".
Better yet would be a subject specifying what you fixed to silence
checkpatch warnings. For example, "Fixed comments formatting" or
"Removed unnecessary spaces"

And the commit message should not be vague like "Patch contains the
spacing fixes that led to checkpatch.pl warnings." You should write
what you did to fix the warnings.
For example: Fixed checkpatch warning *write warning here* by
correcting *whatever change you did*

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


[PATCH v2 05/12] mtd: nand: use new BBT API instead of old ones

2015-12-14 Thread Peter Pan
From: Brian Norris 

Use new BBT APIs (nand_bbt_*()) in NAND. Keep old APIs (nand_*_bbt())
exist temporarily.

Signed-off-by: Brian Norris 
[Peter: 1. use nand_bbt_markbad_factory() in docg4.c and implement
2. nand_create_factory_badblock_pattern(), nand_is_bad_bbm() and
nand_default_bbt() in nand_base.c
3. add NAND_BADBLOCK_PATTERN_ALLOC macro]
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/docg4.c |   6 +-
 drivers/mtd/nand/nand_base.c | 140 ---
 include/linux/mtd/nand.h |   9 ++-
 3 files changed, 143 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index da93d7f..1be7fa2 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -1037,7 +1037,7 @@ static int __init read_factory_bbt(struct mtd_info *mtd)
 * operation after device power-up.  The above read ensures it never is.
 * Ugly, I know.
 */
-   if (nand->bbt == NULL)  /* no memory-based bbt */
+   if (nand->nand_bbt == NULL)  /* no memory-based bbt */
goto exit;
 
if (mtd->ecc_stats.failed > eccfailed_stats) {
@@ -1064,8 +1064,8 @@ static int __init read_factory_bbt(struct mtd_info *mtd)
unsigned long bits = ~buf[i];
for_each_set_bit(bitnum, , 8) {
int badblock = block + 7 - bitnum;
-   nand->bbt[badblock / 4] |=
-   0x03 << ((badblock % 4) * 2);
+   nand_bbt_markbad_factory(nand->nand_bbt,
+   badblock << nand->bbt_erase_shift);
mtd->ecc_stats.badblocks++;
dev_notice(doc->dev, "factory-marked bad block: %d\n",
   badblock);
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5aec154..28d7a58 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -450,8 +450,8 @@ static int nand_block_markbad_lowlevel(struct mtd_info 
*mtd, loff_t ofs)
}
 
/* Mark block bad in BBT */
-   if (chip->bbt) {
-   res = nand_markbad_bbt(mtd, ofs);
+   if (chip->nand_bbt) {
+   res = nand_bbt_markbad(chip->nand_bbt, ofs);
if (!ret)
ret = res;
}
@@ -493,10 +493,10 @@ static int nand_block_isreserved(struct mtd_info *mtd, 
loff_t ofs)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
 
-   if (!chip->bbt)
+   if (!chip->nand_bbt)
return 0;
/* Return info from the table */
-   return nand_isreserved_bbt(mtd, ofs);
+   return nand_bbt_isreserved(chip->nand_bbt, ofs);
 }
 
 /**
@@ -513,12 +513,18 @@ static int nand_block_checkbad(struct mtd_info *mtd, 
loff_t ofs, int getchip,
   int allowbbt)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
+   struct nand_bbt *bbt = chip->nand_bbt;
 
-   if (!chip->bbt)
+   if (!bbt)
return chip->block_bad(mtd, ofs, getchip);
 
/* Return info from the table */
-   return nand_isbad_bbt(mtd, ofs, allowbbt);
+   if (nand_bbt_isbad(bbt, ofs))
+   return 1;
+   else if (allowbbt)
+   return 0;
+   else
+   return nand_bbt_isreserved(bbt, ofs);
 }
 
 /**
@@ -2982,6 +2988,122 @@ erase_exit:
return ret;
 }
 
+/* NAND BBT helper - erase a block, including reserved blocks */
+static int nand_bbt_erase_block(struct mtd_info *mtd, loff_t addr)
+{
+   struct erase_info einfo;
+   struct nand_chip *chip = mtd->priv;
+
+   memset(, 0, sizeof(einfo));
+   einfo.mtd = mtd;
+   einfo.addr = addr;
+   einfo.len = 1ULL << chip->phys_erase_shift;
+
+   return nand_erase_nand(mtd, , 1);
+}
+
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+#define BADBLOCK_SCAN_MASK (~NAND_BBT_NO_OOB)
+/**
+ * nand_create_factory_badblock_pattern - [INTERN] Creates a BBT descriptor
+ * structure for factory bad block marker
+ * @chip: NAND chip to create descriptor for
+ *
+ * This function allocates and initializes a badblock_pattern for factory bad
+ * block marker based on the properties of @chip when chip.badblock_pattern
+ * is NULL.
+ */
+static int nand_create_factory_badblock_pattern(struct nand_chip *chip)
+{
+   struct nand_bbt_descr *bd;
+
+   if (chip->badblock_pattern) {
+   pr_warn("Bad block pattern already allocated; not replacing\n");
+   return -EINVAL;
+   }
+   bd = kzalloc(sizeof(*bd), GFP_KERNEL);
+   if (!bd)
+   return -ENOMEM;
+   bd->options = chip->bbt_options & BADBLOCK_SCAN_MASK;
+   bd->offs = chip->badblockpos;
+   bd->len = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1;
+   bd->pattern = scan_ff_pattern;
+   bd->options |= NAND_BADBLOCK_PATTERN_ALLOC;
+   chip->badblock_pattern = bd;
+
+   return 

[PATCH v2 09/12] mtd: nand_bbt: remove old API definitions

2015-12-14 Thread Peter Pan
From: Brian Norris 

remove old BBT APIs

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_bbt.c | 110 +---
 include/linux/mtd/nand.h|   3 --
 2 files changed, 22 insertions(+), 91 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index b46b4ae..22861a1 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1166,13 +1166,14 @@ static struct nand_bbt_descr bbt_mirror_no_oob_descr = {
 };
 
 /**
- * nand_default_bbt - [NAND Interface] Select a default bad block table for 
the device
+ * nand_bbt_init - [NAND BBT Interface] Initialize and locate/create a bad 
block
+ * table
  * @bbt: NAND BBT structure
  *
  * This function selects the default bad block table support for the device and
- * calls the nand_scan_bbt function.
+ * scans for an existing table, or else creates one.
  */
-int nand_default_bbt(struct nand_bbt *bbt)
+int nand_bbt_init(struct nand_bbt *bbt)
 {
/* Is a flash based bad block table requested? */
if (bbt->bbt_options & NAND_BBT_USE_FLASH) {
@@ -1193,46 +1194,54 @@ int nand_default_bbt(struct nand_bbt *bbt)
 
return nand_scan_bbt(bbt);
 }
+EXPORT_SYMBOL(nand_bbt_init);
+
+void nand_bbt_release(struct nand_bbt *bbt)
+{
+   kfree(bbt->bbt);
+}
+EXPORT_SYMBOL(nand_bbt_release);
 
 /**
- * nand_isreserved_bbt - [NAND Interface] Check if a block is reserved
+ * nand_bbt_isreserved - [NAND BBT Interface] Check if a block is reserved
  * @bbt: NAND BBT structure
  * @offs: offset in the device
  */
-int nand_isreserved_bbt(struct nand_bbt *bbt, loff_t offs)
+int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs)
 {
int block;
 
block = (int)(offs >> bbt->bbt_erase_shift);
return bbt_get_entry(bbt, block) == BBT_BLOCK_RESERVED;
 }
+EXPORT_SYMBOL(nand_bbt_isreserved);
 
 /**
- * nand_isbad_bbt - [NAND Interface] Check if a block is bad
+ * nand_bbt_isbad - [NAND BBT Interface] Check if a block is bad
  * @bbt: NAND BBT structure
  * @offs: offset in the device
- * @allowbbt: allow access to bad block table region
  */
-int nand_isbad_bbt(struct nand_bbt *bbt, loff_t offs, int allowbbt)
+int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs)
 {
int block, res;
 
block = (int)(offs >> bbt->bbt_erase_shift);
res = bbt_get_entry(bbt, block);
 
-   pr_debug("nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 
0x%02x\n",
+   pr_debug("nand_bbt_isbad(): bbt info for offs 0x%08x: (block %d) 
0x%02x\n",
 (unsigned int)offs, block, res);
 
switch (res) {
case BBT_BLOCK_GOOD:
+   case BBT_BLOCK_RESERVED:
return 0;
case BBT_BLOCK_WORN:
+   case BBT_BLOCK_FACTORY_BAD:
+   default:
return 1;
-   case BBT_BLOCK_RESERVED:
-   return allowbbt ? 0 : 1;
}
-   return 1;
 }
+EXPORT_SYMBOL(nand_bbt_isbad);
 
 /**
  * nand_bbt_update_mark - update mark in the BBT
@@ -1257,84 +1266,13 @@ static int nand_bbt_update_mark(struct nand_bbt *bbt, 
loff_t offs, uint8_t mark)
 }
 
 /**
- * nand_markbad_bbt - [NAND Interface] Mark a block bad in the BBT
- * @bbt: NAND BBT structure
- * @offs: offset of the bad block
- */
-int nand_markbad_bbt(struct nand_bbt *bbt, loff_t offs)
-{
-   return nand_bbt_update_mark(bbt, offs, BBT_BLOCK_WORN);
-}
-EXPORT_SYMBOL(nand_scan_bbt);
-
-/**
- * nand_bbt_init - [NAND BBT Interface] Initialize and locate/create a bad 
block
- * table
- * @bbt: NAND BBT structure
- *
- * This function selects the default bad block table support for the device and
- * scans for an existing table, or else creates one.
- */
-int nand_bbt_init(struct nand_bbt *bbt)
-{
-   /*
-* FIXME: For now, we call nand_default_bbt() directly. It will change
-* when we use struct nand_bbt instead of struct nand_chip.
-*/
-   return nand_default_bbt(bbt);
-}
-EXPORT_SYMBOL(nand_bbt_init);
-
-void nand_bbt_release(struct nand_bbt *bbt)
-{
-   kfree(bbt->bbt);
-}
-EXPORT_SYMBOL(nand_bbt_release);
-
-/**
- * nand_bbt_isreserved - [NAND BBT Interface] Check if a block is reserved
- * @bbt: NAND BBT structure
- * @offs: offset in the device
- */
-int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs)
-{
-   /*
-* FIXME: For now, we call nand_isreserved_bbt() directly. It will
-* change when we use struct nand_bbt instead of struct nand_chip.
-*/
-   return nand_isreserved_bbt(bbt, offs);
-}
-EXPORT_SYMBOL(nand_bbt_isreserved);
-
-/**
- * nand_bbt_isbad - [NAND BBT Interface] Check if a block is bad
- * @bbt: NAND BBT structure
- * @offs: offset in the device
- */
-int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs)
-{
-   /*
-* FIXME: For now, we call nand_isbad_bbt() directly. It will change
-* when we use struct nand_bbt instead of struct nand_chip.
-* Since we already have nand_bbt_isreserved(), 

Re: Commit 81a43adae3b9 (locking/mutex: Use acquire/release semantics) causing failures on arm64 (ThunderX)

2015-12-14 Thread Paul E. McKenney
On Mon, Dec 14, 2015 at 06:49:31PM +, One Thousand Gnomes wrote:
> On Fri, 11 Dec 2015 14:35:40 -0800
> "Paul E. McKenney"  wrote:
> 
> > On Fri, Dec 11, 2015 at 02:48:03PM +0100, Peter Zijlstra wrote:
> > > On Fri, Dec 11, 2015 at 01:33:14PM +, Will Deacon wrote:
> > > > On Fri, Dec 11, 2015 at 01:26:47PM +0100, Peter Zijlstra wrote:
> > > 
> > > > > While we're there, the acquire in osq_wait_next() seems somewhat ill
> > > > > documented too.
> > > > > 
> > > > > I _think_ we need ACQUIRE semantics there because we want to strictly
> > > > > order the lock-unqueue A,B,C steps and we get that with:
> > > > > 
> > > > >  A: SC
> > > > >  B: ACQ
> > > > >  C: Relaxed
> > > > > 
> > > > > Similarly for unlock we want the WRITE_ONCE to happen after
> > > > > osq_wait_next, but in that case we can even rely on the control
> > > > > dependency there.
> > > > 
> > > > Even for the lock-unqueue case, isn't B->C ordered by a control 
> > > > dependency
> > > > because C consists only of stores?
> > > 
> > > Hmm, indeed. So we could go fully relaxed on it I suppose, since the
> > > same is true for the unlock site.
> > 
> > I am probably missing quite a bit on this thread, but don't x86 MMIO
> > accesses to frame buffers need to interact with something more heavyweight
> > than an x86 release store or acquire load in order to remain confined
> > to the resulting critical section?
> 
> Depends upon the device and the mapping. There are also CPU errata
> related to write combining on older CPUs (notably Pentium Pro era) which
> result in ordering errors with write combining unless deliberately fenced.
> 
> Any PCI access isn't constrained to the critical section unless a PCI
> read from the same device is done and completes before exiting. Even then
> on processors with a separate APIC bus (PPro, PII I think) interrupts are
> asynchronous on their own bus.
> 
> The PCI posting rules also apply to DMA.
> 
> Finally we run the IDT WinChip in out-of-order store mode not full x86
> compatibility which while uniprocessor does mean the correct fences
> matter.
> 
> Just to ensure total confusion some video cards have MMIO areas that are
> not in fact memory but a FIFO rigged to look like a block of RAM for
> speed of writing. In those cases the rules are a bit card dependant.

Sounds like the usual fun and excitement!  ;-)

> But seriously are there any cases we actually care about this for osq ?

Apparently not, given Peter's email.

Thanx, Paul

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


[PATCH v2 02/12] mtd: nand_bbt: introduce struct nand_bbt

2015-12-14 Thread Peter Pan
From: Brian Norris 

Currently nand_bbt.c is tied with struct nand_chip, and it makes other
NAND family chips hard to use nand_bbt.c. Maybe it's the reason why
onenand has own bbt(onenand_bbt.c).

Separate struct nand_chip from BBT code can make current BBT shareable.
We create struct nand_bbt to take place of nand_chip in nand_bbt.c

Below is mtd folder structure we want:
mtd
├── Kconfig
├── Makefile
├── ...
├── nand_bbt.c
├── nand
│   ├── Kconfig
│   ├── Makefile
│   ├── nand_base.c
│   ├── nand_ids.c
│   ├── ...
│   └── xway_nand.c
├── spi-nand
│   ├── Kconfig
│   ├── Makefile
│   ├── spi-nand-base.c
│   ├── ...
│   └── spi-nand-device.c
└── ...

We put every information nand_bbt.c needed from outside into struct
nand_bbt, include:
@mtd:   pointer to MTD device structure
@is_bad_bbm:check if a block is factory bad block
@mark_bad_bbm:  imitate a block as factory bad block
@erase: erase block bypassing resvered checks
@bbt_options:   bad block specific options. All options used
here must come from nand_bbt.h.
@numchips:  number of physical chips, required for NAND_BBT_PERCHIP
@bbt_td:bad block table descriptor for flash lookup.
@bbt_md:bad block table mirror descriptor
@chipsize:  the size of one chip for multichip arrays
@chip_shift:number of address bits in one chip
@bbt_erase_shift:   number of address bits in a bbt entry
@page_shift:number of address bits in a page
@bbt:   bad block table pointer

Signed-off-by: Brian Norris 
[Peter: correct comment style]
Signed-off-by: Peter Pan 
---
 include/linux/mtd/nand_bbt.h | 59 
 1 file changed, 59 insertions(+)

diff --git a/include/linux/mtd/nand_bbt.h b/include/linux/mtd/nand_bbt.h
index 5a65230..e468571 100644
--- a/include/linux/mtd/nand_bbt.h
+++ b/include/linux/mtd/nand_bbt.h
@@ -18,6 +18,8 @@
 #ifndef __LINUX_MTD_NAND_BBT_H
 #define __LINUX_MTD_NAND_BBT_H
 
+struct mtd_info;
+
 /* The maximum number of NAND chips in an array */
 #define NAND_MAX_CHIPS 8
 
@@ -115,4 +117,61 @@ struct nand_bbt_descr {
 /* The maximum number of blocks to scan for a bbt */
 #define NAND_BBT_SCAN_MAXBLOCKS4
 
+/**
+ * struct nand_bbt - bad block table structure
+ * @mtd:   pointer to MTD device structure
+ * @is_bad_bbm:check if a block is factory bad block
+ * @mark_bad_bbm:  imitate a block as factory bad block
+ * @erase: erase block bypassing resvered checks
+ * @bbt_options:   bad block specific options. All options used
+ * here must come from nand_bbt.h.
+ * @numchips:  number of physical chips, required for NAND_BBT_PERCHIP
+ * @bbt_td:bad block table descriptor for flash lookup.
+ * @bbt_md:bad block table mirror descriptor
+ * @chipsize:  the size of one chip for multichip arrays
+ * @chip_shift:number of address bits in one chip
+ * @bbt_erase_shift:   number of address bits in a bbt entry
+ * @page_shift:number of address bits in a page
+ * @bbt:   bad block table pointer
+ *
+ */
+struct nand_bbt {
+   struct mtd_info *mtd;
+
+   /*
+* This is important to abstract out of nand_bbt.c and provide
+* separately in nand_base.c and spi-nand-base.c -- it's sort of
+* duplicated in nand_block_bad() (nand_base) and
+* scan_block_fast() (nand_bbt) right now
+*
+* Note that this also means nand_chip.badblock_pattern should
+* be removed from nand_bbt.c
+*/
+   int (*is_bad_bbm)(struct mtd_info *mtd, loff_t ofs);
+
+   /*
+* Only required if the driver wants to attempt to program new
+* bad block markers that imitate the factory-marked BBMs
+*/
+   int (*mark_bad_bbm)(struct mtd_info *mtd, loff_t ofs);
+
+   /* Erase a block, bypassing reserved checks */
+   int (*erase)(struct mtd_info *mtd, loff_t ofs);
+
+   unsigned int bbt_options;
+   int numchips;
+
+   /*
+* Discourage new custom usages here; suggest usage of the
+* relevant NAND_BBT_* options instead
+*/
+   struct nand_bbt_descr *bbt_td;
+   struct nand_bbt_descr *bbt_md;
+   u64 chipsize;
+   int chip_shift;
+   int bbt_erase_shift;
+   int page_shift;
+   u8 *bbt;
+};
+
 #endif /* __LINUX_MTD_NAND_BBT_H */
-- 
1.9.1

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


[PATCH v2 04/12] mtd: nand_bbt: add nand_bbt_markbad_factory() interface

2015-12-14 Thread Peter Pan
Some nand controller drivers(like docg4.c) mark factory bad block
mark by accessing bbt buffer directly, so create this API to avoid
breaking layer.

Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_bbt.c  | 32 +---
 include/linux/mtd/nand_bbt.h |  1 +
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 72aed20..f256be1 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1353,11 +1353,12 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, 
int allowbbt)
 }
 
 /**
- * nand_markbad_bbt - [NAND Interface] Mark a block bad in the BBT
+ * nand_bbt_update_mark - update mark in the BBT
  * @mtd: MTD device structure
  * @offs: offset of the bad block
+ * @mark: block type mark
  */
-int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
+static int nand_bbt_update_mark(struct mtd_info *mtd, loff_t offs, uint8_t 
mark)
 {
struct nand_chip *this = mtd_to_nand(mtd);
int block, ret = 0;
@@ -1365,7 +1366,7 @@ int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
block = (int)(offs >> this->bbt_erase_shift);
 
/* Mark bad block in memory */
-   bbt_mark_entry(this, block, BBT_BLOCK_WORN);
+   bbt_mark_entry(this, block, mark);
 
/* Update flash-based bad block table */
if (this->bbt_options & NAND_BBT_USE_FLASH)
@@ -1374,6 +1375,15 @@ int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
return ret;
 }
 
+/**
+ * nand_markbad_bbt - [NAND Interface] Mark a block bad in the BBT
+ * @mtd: MTD device structure
+ * @offs: offset of the bad block
+ */
+int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
+{
+   return nand_bbt_update_mark(mtd, offs, BBT_BLOCK_WORN);
+}
 EXPORT_SYMBOL(nand_scan_bbt);
 
 /**
@@ -1446,3 +1456,19 @@ int nand_bbt_markbad(struct nand_bbt *bbt, loff_t offs)
return nand_markbad_bbt(bbt->mtd, offs);
 }
 EXPORT_SYMBOL(nand_bbt_markbad);
+
+/**
+ * nand_bbt_markbad_factory - [NAND BBT Interface] Mark a block as factory bad
+ * in the BBT
+ * @bbt: NAND BBT structure
+ * @offs: offset of the bad block
+ */
+int nand_bbt_markbad_factory(struct nand_bbt *bbt, loff_t offs)
+{
+   /*
+* FIXME: For now, we call nand_markbad_bbt() directly. It will change
+* when we use struct nand_bbt instead of struct nand_chip.
+*/
+   return nand_bbt_update_mark(bbt->mtd, offs, BBT_BLOCK_FACTORY_BAD);
+}
+EXPORT_SYMBOL(nand_bbt_markbad_factory);
diff --git a/include/linux/mtd/nand_bbt.h b/include/linux/mtd/nand_bbt.h
index 150c49a..48a0620 100644
--- a/include/linux/mtd/nand_bbt.h
+++ b/include/linux/mtd/nand_bbt.h
@@ -179,5 +179,6 @@ void nand_bbt_release(struct nand_bbt *bbt);
 int nand_bbt_markbad(struct nand_bbt *bbt, loff_t offs);
 int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs);
 int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs);
+int nand_bbt_markbad_factory(struct nand_bbt *bbt, loff_t offs);
 
 #endif /* __LINUX_MTD_NAND_BBT_H */
-- 
1.9.1

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


[PATCH v2 00/12] mtd: nand_bbt: introduce independent nand BBT

2015-12-14 Thread Peter Pan
Currently nand_bbt.c is tied with struct nand_chip, and it makes other
NAND family chips hard to use nand_bbt.c. Maybe it's the reason why
onenand has own bbt(onenand_bbt.c).

Separate struct nand_chip from BBT code can make current BBT shareable.
We create struct nand_bbt to take place of nand_chip in nand_bbt.c.
Struct nand_bbt contains all the information BBT needed from outside and
it should be embedded into NAND family chip struct (such as struct nand_chip).
NAND family driver should allocate, initialize and free struct nand_bbt.

Below is mtd folder structure we want:
mtd
├── Kconfig
├── Makefile
├── ...
├── nand_bbt.c
├── nand
│   ├── Kconfig
│   ├── Makefile
│   ├── nand_base.c
│   ├── nand_ids.c
│   ├── ...
│   └── xway_nand.c
├── spi-nand
│   ├── Kconfig
│   ├── Makefile
│   ├── spi-nand-base.c
│   ├── ...
│   └── spi-nand-device.c
└── ...

Most of the patch is borrowed from Brian Norris .
http://git.infradead.org/users/norris/linux-mtd.git/shortlog/refs/heads/nand-bbt
Based on Brian's suggestion, I make my previous BBT patch into 12 independent
patches. Previous patch is http://patchwork.ozlabs.org/patch/492066/
Beside the patch split, I also moved nand_bbt.c to mtd folder, which didn't in
previous patch.

Patch 3, 7, 8, 9, 10 and 11 are totally borrowed from Brian's git tree. I just
test and split the code into independent patch. Patch 1, 2, 5 and 6 are partial
borrowed. I make some changes from Brian's git tree and the changes are recorded
in commit log. Patch 4 and 12 are written by me.

The patch is tested on Zed board.

v2 changes:
rebase patch series on master branch of l2-mtd.git

Brian Norris (10):
  mtd: nand_bbt: new header for nand family BBT
  mtd: nand_bbt: introduce struct nand_bbt
  mtd: nand_bbt: add new API definitions
  mtd: nand: use new BBT API instead of old ones
  mtd: nand_bbt: use erase() and is_bad_bbm() hook in BBT
  mtd: nand: make nand_erase_nand() static
  mtd: nand_bbt: remove struct nand_chip from nand_bbt.c
  mtd: nand_bbt: remove old API definitions
  mtd: nand_bbt: remove NAND_BBT_DYNAMICSTRUCT macro
  mtd: nand: remove nand_chip.bbt

Peter Pan (2):
  mtd: nand_bbt: add nand_bbt_markbad_factory() interface
  mtd: nand-bbt: move nand_bbt.c to mtd folder

 drivers/mtd/Kconfig   |   7 +
 drivers/mtd/Makefile  |   1 +
 drivers/mtd/nand/Kconfig  |   2 +-
 drivers/mtd/nand/Makefile |   2 +-
 drivers/mtd/nand/docg4.c  |   6 +-
 drivers/mtd/nand/nand_base.c  | 145 +-
 drivers/mtd/{nand => }/nand_bbt.c | 542 --
 include/linux/mtd/bbm.h   |  96 +--
 include/linux/mtd/nand.h  |  16 +-
 include/linux/mtd/nand_bbt.h  | 177 +
 10 files changed, 562 insertions(+), 432 deletions(-)
 rename drivers/mtd/{nand => }/nand_bbt.c (68%)
 create mode 100644 include/linux/mtd/nand_bbt.h

-- 
1.9.1

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


RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support

2015-12-14 Thread Chen, Yu C
Hi, Andy

> -Original Message-
> From: Andy Lutomirski [mailto:l...@amacapital.net]
> Sent: Tuesday, December 15, 2015 7:28 AM
> To: Zheng, Lv
> Cc: Wysocki, Rafael J; Brown, Len; Andy Lutomirski; Lv Zheng; linux-
> ker...@vger.kernel.org; Linux ACPI; Chen, Yu C
> Subject: Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support
> 
> On Wed, Dec 2, 2015 at 6:43 PM, Lv Zheng  wrote:
> > From: Chen Yu 
> >
> > This patch implements acpi_os_readable(). The function is used by
> > ACPICA AML debugger to validate user specified pointers for dumping
> > the memory as ACPICA descriptor objects.
> >
[cut]
> >
> > +bool __acpi_memory_readable(void *pointer, size_t length) {
> > +   unsigned long obj_start, obj_end;
> > +   unsigned long start_pfn, end_pfn;
> 
> What does "readable" mean in this context?
'readable' means :  the address provided by the user, 
is a dynamically allocated  virtual address -
because  the  acpi address space are allocated by 'kmalloc',
acpi debugger must check if this address is a valid 'kmalloc'
address before accessing it.

This function does the sanity check that, the vitual address is a:
1.   dynamically allocated address (beyond PAGE_OFFSET , but lower
than high_memory, VMALLOC_START, eg)
2.  besides, the physical address must be direct-mapped(so it would not be a 
hole).

Thanks,
yu

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 V3] Fix INT1 Recursion with unregistered breakpoints

2015-12-14 Thread Jeff Merkey
Please consider the attached patch.

SUMMARY

This patch corrects a hard lockup failure of the system kernel if the
operating system receives a breakpoint exception at a code execution
address which was not registered with the operating system.  The patch
allows kernel debuggers, application profiling and performance modules,
and external debugging tools to work better together at sharing the
breakpoint registers on the platform in a way that they do not cause
errors and system faults, and enables the full feature set in the
breakpoint API.  If a kernel application triggers a breakpoint
or programs one in error, this patch will catch the condition and report
it to the system log without the operating system experiencing a system
fault.  There are several consumers of the Linux Breakpoint API and all
of them can and sometimes do cause the condition this patch corrects.

CONDITIONS WHICH RESULT IN THIS SYSTEM FAULT

This system fault can be caused from several sources.  Any kernel code
can access the debug registers and trigger a breakpoint directly by
writing to these registers and trigger a hard system hang if no
breakpoint was registered via arch_install_hw_breakpoint().

kgdb/kdb and the perf event system both present garbage status in dr6
then subsequently write this status into the thread.debugreg6 variable,
then in some cases call hw_breakpoint_restore() which writes this
status back into the dr6 hardware register.

arch/x86/kernel/kgdb.c
static void kgdb_hw_overflow_handler(struct perf_event *event,
struct perf_sample_data *data, struct pt_regs *regs)
{
struct task_struct *tsk = current;
int i;

for (i = 0; i < 4; i++)
if (breakinfo[i].enabled)
tsk->thread.debugreg6 |= (DR_TRAP0 << i);
}

arch/x86/kernel/kgdb.c
static void kgdb_correct_hw_break(void)
{
... snip ...

if (!dbg_is_early)
hw_breakpoint_restore();

... snip ...
}

arch/x86/kernel/hw_breakpoint.c
void hw_breakpoint_restore(void)
{
set_debugreg(__this_cpu_read(cpu_debugreg[0]), 0);
set_debugreg(__this_cpu_read(cpu_debugreg[1]), 1);
set_debugreg(__this_cpu_read(cpu_debugreg[2]), 2);
set_debugreg(__this_cpu_read(cpu_debugreg[3]), 3);
set_debugreg(current->thread.debugreg6, 6);
set_debugreg(__this_cpu_read(cpu_dr7), 7);
}

The hardware only altars those bits that change, the rest of the altered
dr6 value remains in the register.

Upon the next int1 exception, dr6 presents this manufactured status to
the int1 handler in hw_breakpoint.c which calls the non-existent
breakpoint exceptions and any handlers which may have validly
registered, creating phantom events.  If other subsystems which call
the perf handlers also have breakpoints registered, this
manufactured status causes erroneous events to be signaled to the layers
above.

arch/x86/kernel/hw_breakpoint.c
static int hw_breakpoint_handler(struct die_args *args)
{
... snip ...

/* Handle all the breakpoints that were triggered */
for (i = 0; i < HBP_NUM; ++i) {
if (likely(!(dr6 & (DR_TRAP0 << i
continue;

... snip ...

perf_bp_event(bp, args->regs);

... snip ...
}

After a few iterations of this cycling through the system, the
thread.debugreg6 variable starts to resemble a random number generator
as far as to which breakpoint just occurred.

The perf handlers cause a different incarnation of this problem and
create the situation by triggering a stale breakpoint set in dr7 for
which the perf bp is NULL (not registered) or late and for which there
is a single code path that fails to set the resume flag and clear the
int1 exception status.

TESTING AND REVIEW PERFORMED

I have reviewed all the code that touches this patch and have
determined it will function and support all of the software that
depends on this handler properly.  I have compiled and tested this
patch with a test harness that tests the robustness of the linux
breakpoint API and handlers in the following ways:

1.  Setting multiple conditional breakpoints through
arch_install_hw_breakpoint API across four processors to test the rate
at which the interface can handle breakpoint exceptions

2.  Setting unregistered breakpoints to test the handlers robustness
in dealing with error handling conditions and errant or spurious
hardware conditions and to simulate actual "lazy debug register
switching" with null bp handlers to test the
robustness of the handlers.

3.  Clearing and setting breakpoints across multiple processors then
triggering concurrent exceptions in both interrupt and process
contexts.

This patch improves robustness in several ways in the linux kernel:

1.  Corrects bug in handling unregistered breakpoints.

2.  Provides hardware check of dr7 to determine source of breakpoint
if OS cannot ascertain the int1 source from its own state 

Re: [PATCH 2/2] iio: mma8452: add freefall detection for Freescale's accelerometers

2015-12-14 Thread Martin Kepplinger
Am 2015-12-12 um 16:34 schrieb Jonathan Cameron:
> On 08/12/15 16:21, Martin Kepplinger wrote:
>> This adds freefall event detection to the supported devices. It adds
>> the in_accel_x_mag_falling_en iio event attribute, which activates
>> freefall mode.
>>
>> In freefall mode, the current acceleration magnitude (AND combination
>> of all axis values) is compared to the specified threshold.
>> If it falls under the threshold (in_accel_mag_falling_value),
>> the appropriate IIO event code is generated.
>>
>> The values of rising and falling versions of various sysfs files are
>> shared, which is compliant to the IIO specification.
>>
>> This is what the sysfs "events" directory for these devices looks
>> like after this change:
>>
>> -rw-r--r--4096 Oct 23 08:45 in_accel_mag_falling_period
>> -rw-r--r--4096 Oct 23 08:45 in_accel_mag_falling_value
>> -rw-r--r--4096 Oct 23 08:45 in_accel_mag_rising_period
>> -rw-r--r--4096 Oct 23 08:45 in_accel_mag_rising_value
>> -r--r--r--4096 Oct 23 08:45 in_accel_scale
>> -rw-r--r--4096 Oct 23 08:45 in_accel_x_mag_falling_en
>> -rw-r--r--4096 Oct 23 08:45 in_accel_x_mag_rising_en
>> -rw-r--r--4096 Oct 23 08:45 in_accel_y_mag_rising_en
>> -rw-r--r--4096 Oct 23 08:45 in_accel_z_mag_rising_en
>>
>> Signed-off-by: Martin Kepplinger 
>> Signed-off-by: Christoph Muellner 
> I think the read back of other events being enabled is broken by this.
> Otherwise a few other minor bits and bobs.
> 
> Jonathan
>> ---
>> Other combinations (x, x or y) might be added later. This is the most
>> useful for freefall detection.
>>
>>
>>  drivers/iio/accel/mma8452.c | 156 
>> ++--
>>  1 file changed, 137 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
>> index 162bbef..c8ac88c 100644
>> --- a/drivers/iio/accel/mma8452.c
>> +++ b/drivers/iio/accel/mma8452.c
>> @@ -15,7 +15,7 @@
>>   *
>>   * 7-bit I2C slave address 0x1c/0x1d (pin selectable)
>>   *
>> - * TODO: orientation / freefall events, autosleep
>> + * TODO: orientation events, autosleep
>>   */
>>  
>>  #include 
>> @@ -143,6 +143,14 @@ struct mma_chip_info {
>>  u8 ev_count;
>>  };
>>  
>> +enum {
>> +idx_x,
>> +idx_y,
>> +idx_z,
>> +idx_ts,
>> +idx_xyz,
>> +};
> I would have slightly prefered the change to this enum to have been
> done as a precursor patch as it would have lead to an easily checked
> step 1 followed by the interesting stuff in step 2.

I guess you're right and it would be easier to read.

>> +
>>  static int mma8452_drdy(struct mma8452_data *data)
>>  {
>>  int tries = 150;
>> @@ -409,6 +417,46 @@ fail:
>>  return ret;
>>  }
>>  
>> +static int mma8452_freefall_mode_enabled(struct mma8452_data *data)
>> +{
>> +int val;
>> +const struct mma_chip_info *chip = data->chip_info;
>> +
>> +val = i2c_smbus_read_byte_data(data->client, chip->ev_cfg);
>> +if (val < 0)
>> +return val;
>> +
>> +return !(val & MMA8452_FF_MT_CFG_OAE);
>> +}
>> +
>> +static int mma8452_set_freefall_mode(struct mma8452_data *data, u8 state)
>> +{
>> +int val, ret;
>> +const struct mma_chip_info *chip = data->chip_info;
>> +
>> +val = i2c_smbus_read_byte_data(data->client, chip->ev_cfg);
>> +if (val < 0)
>> +return val;
>> +
>> +if (state && !(mma8452_freefall_mode_enabled(data))) {
>> +val |= BIT(idx_x + chip->ev_cfg_chan_shift);
>> +val |= BIT(idx_y + chip->ev_cfg_chan_shift);
>> +val |= BIT(idx_z + chip->ev_cfg_chan_shift);
>> +val &= ~MMA8452_FF_MT_CFG_OAE;
>> +} else if (!state && mma8452_freefall_mode_enabled(data)) {
>> +val &= ~BIT(idx_x + chip->ev_cfg_chan_shift);
>> +val &= ~BIT(idx_y + chip->ev_cfg_chan_shift);
>> +val &= ~BIT(idx_z + chip->ev_cfg_chan_shift);
>> +val |= MMA8452_FF_MT_CFG_OAE;
>> +}
>> +
>> +ret = mma8452_change_config(data, chip->ev_cfg, val);
>> +if (ret)
>> +return ret;
>> +
>> +return 0;
>> +}
>> +
>>  static int mma8452_set_hp_filter_frequency(struct mma8452_data *data,
>> int val, int val2)
>>  {
>> @@ -602,6 +650,11 @@ static int mma8452_read_event_config(struct iio_dev 
>> *indio_dev,
>>  const struct mma_chip_info *chip = data->chip_info;
>>  int ret;
>>  
>> +switch (chan->channel2) {
>> +case IIO_MOD_X_AND_Y_AND_Z:
>> +return mma8452_freefall_mode_enabled(data);
>> +}
>> +
>>  ret = i2c_smbus_read_byte_data(data->client,
>> data->chip_info->ev_cfg);
>>  if (ret < 0)
> I may have missed something here, but I think the check for the other events
> being enabled needs updating as well.  We are using the same bits in the
> register afterall.

we are using the same bits but reading is not broken. Freefall-mode is
defined by one bit. If the user wants 

Linux 4.1.15

2015-12-14 Thread Greg KH
I'm announcing the release of the 4.1.15 kernel.

All users of the 4.1 kernel series must upgrade.

The updated 4.1.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.1.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 drivers/block/rbd.c |1 
 drivers/firewire/ohci.c |5 
 drivers/net/phy/broadcom.c  |2 
 drivers/net/usb/qmi_wwan.c  |1 
 fs/btrfs/file.c |   16 +-
 fs/btrfs/inode.c|   92 ---
 fs/btrfs/ioctl.c|  195 
 fs/btrfs/xattr.c|4 
 fs/ceph/mds_client.c|2 
 fs/debugfs/inode.c  |6 
 fs/ext4/ext4_jbd2.c |6 
 fs/ext4/page-io.c   |5 
 fs/ext4/super.c |   12 +
 fs/jbd2/journal.c   |6 
 fs/nfs/inode.c  |6 
 fs/nfs/nfs4client.c |2 
 fs/nfsd/nfs4state.c |  127 ++--
 fs/nfsd/state.h |   19 +--
 fs/ocfs2/namei.c|2 
 include/linux/ipv6.h|2 
 include/linux/jbd2.h|1 
 include/net/af_unix.h   |1 
 include/net/ip6_tunnel.h|3 
 include/net/ip_tunnels.h|3 
 include/net/ipv6.h  |   22 +++
 include/net/sch_generic.h   |3 
 kernel/bpf/arraymap.c   |2 
 net/core/neighbour.c|4 
 net/core/scm.c  |2 
 net/dccp/ipv6.c |   33 +++--
 net/ipv4/ipmr.c |   15 +-
 net/ipv4/tcp_input.c|   23 +++
 net/ipv4/tcp_ipv4.c |3 
 net/ipv4/tcp_timer.c|   12 +
 net/ipv6/af_inet6.c |   13 +-
 net/ipv6/datagram.c |4 
 net/ipv6/exthdrs.c  |3 
 net/ipv6/inet6_connection_sock.c|   11 +
 net/ipv6/ip6mr.c|   15 +-
 net/ipv6/ipv6_sockglue.c|   33 +++--
 net/ipv6/mcast.c|2 
 net/ipv6/netfilter/nf_conntrack_reasm.c |5 
 net/ipv6/raw.c  |8 -
 net/ipv6/reassembly.c   |   10 +
 net/ipv6/syncookies.c   |2 
 net/ipv6/tcp_ipv6.c |   28 ++--
 net/ipv6/udp.c  |8 -
 net/l2tp/l2tp_ip6.c |8 -
 net/packet/af_packet.c  |   86 +++---
 net/rds/connection.c|6 
 net/rds/send.c  |4 
 net/sched/sch_api.c |   27 ++--
 net/sched/sch_generic.c |2 
 net/sched/sch_mq.c  |4 
 net/sched/sch_mqprio.c  |4 
 net/sctp/auth.c |4 
 net/sctp/socket.c   |9 +
 net/unix/af_unix.c  |  183 ++
 sound/pci/hda/patch_hdmi.c  |3 
 tools/net/Makefile  |7 -
 61 files changed, 857 insertions(+), 272 deletions(-)

Aaro Koskinen (1):
  broadcom: fix PHY_ID_BCM5481 entry in the id table

Andrew Elble (1):
  nfsd: eliminate sending duplicate and repeated delegations

Arnd Bergmann (1):
  ceph: fix message length computation

Benjamin Coddington (1):
  nfs4: start callback_ident at idr 1

Bjørn Mork (1):
  net: qmi_wwan: add XS Stick W100-2 from 4G Systems

Daeho Jeong (1):
  ext4, jbd2: ensure entering into panic after recording an error in 
superblock

Daniel Borkmann (8):
  packet: do skb_probe_transport_header when we actually have data
  packet: always probe for transport header
  packet: only allow extra vlan len on ethernet devices
  packet: infer protocol from ethernet header if unset
  packet: fix tpacket_snd max frame len
  net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds
  bpf, array: fix heap out-of-bounds access when updating elements
  debugfs: fix refcount imbalance in start_creating

Eric Dumazet (6):
  tcp: md5: fix lockdep annotation
  tcp: fix potential huge kmalloc() calls in TCP_REPAIR
  tcp: initialize tp->copied_seq in case of cross SYN connection
  ipv6: add complete rcu protection around np->opt
  ipv6: sctp: implement sctp_v6_destroy_sock()
  net_sched: fix qdisc_tree_decrease_qlen() races

Filipe Manana (5):
  Btrfs: fix file corruption and data 

[PATCH v2 07/12] mtd: nand: make nand_erase_nand() static

2015-12-14 Thread Peter Pan
From: Brian Norris 

nand_bbt.c doesn't need to call nand_erase_nand() any more.

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_base.c | 5 -
 include/linux/mtd/nand.h | 2 --
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 28d7a58..3058bb9 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -97,6 +97,9 @@ static int nand_get_device(struct mtd_info *mtd, int 
new_state);
 static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 struct mtd_oob_ops *ops);
 
+static int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
+  int allowbbt);
+
 /*
  * For devices which display every fart in the system on a separate LED. Is
  * compiled away when LED support is disabled.
@@ -2881,7 +2884,7 @@ static int nand_erase(struct mtd_info *mtd, struct 
erase_info *instr)
  *
  * Erase one ore more blocks.
  */
-int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
+static int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
int allowbbt)
 {
int page, status, pages_per_block, ret, chipnr;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 12c9c07..2051bd9 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -866,8 +866,6 @@ extern struct nand_manufacturers nand_manuf_ids[];
 extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
 extern int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
 extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
-extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
-  int allowbbt);
 extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, uint8_t *buf);
 
-- 
1.9.1

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


Re: [PATCH 3/3] staging: dgnc: Patch updates the TODO file

2015-12-14 Thread Sanidhya Solanki
Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/TODO | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
 * remove unnecessary comments
 * remove unnecessary error messages. Example kzalloc() has its
   own error message. Adding an extra one is useless.
-- 
2.5.0

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


Re: [PATCH 2/3] staging: dgnc: Patch includes CamelCase & Macro fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the CamelCase fixes & Macro fixes that led to
checkpatch.pl errors.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_driver.c |  56 -
 drivers/staging/dgnc/dgnc_driver.h |  25 ++--
 drivers/staging/dgnc/dgnc_mgmt.c   |  28 ++---
 drivers/staging/dgnc/dgnc_neo.c| 226 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 134 +-
 drivers/staging/dgnc/dgnc_tty.c| 197 
 drivers/staging/dgnc/digi.h|  20 ++--
 7 files changed, 367 insertions(+), 319 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index fc6d298..37fb8f9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -48,7 +48,7 @@ static void   dgnc_do_remap(struct dgnc_board *brd);
 /*
  * File operations permitted on Control/Management major.
  */
-static const struct file_operations dgnc_BoardFops = {
+static const struct file_operations dgnc_board_fops = {
.owner  =   THIS_MODULE,
.unlocked_ioctl =   dgnc_mgmt_ioctl,
.open   =   dgnc_mgmt_open,
@@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = {
 /*
  * Globals
  */
-uint   dgnc_NumBoards;
-struct dgnc_board  *dgnc_Board[MAXBOARDS];
+uint   dgnc_num_boards;
+struct dgnc_board  *dgnc_board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
 DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
-uint   dgnc_Major;
+uint   dgnc_major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
 /*
@@ -92,7 +92,7 @@ struct board_id {
unsigned int is_pci_express;
 };
 
-static struct board_id dgnc_Ids[] = {
+static struct board_id dgnc_ids[] = {
{   PCI_DEVICE_CLASSIC_4_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_4_422_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_8_PCI_NAME,  8,  0   },
@@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void)
 
dgnc_remove_driver_sysfiles(_driver);
 
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
class_destroy(dgnc_class);
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
 
-   for (i = 0; i < dgnc_NumBoards; ++i) {
-   dgnc_remove_ports_sysfiles(dgnc_Board[i]);
-   dgnc_tty_uninit(dgnc_Board[i]);
-   dgnc_cleanup_board(dgnc_Board[i]);
+   for (i = 0; i < dgnc_num_boards; ++i) {
+   dgnc_remove_ports_sysfiles(dgnc_board[i]);
+   dgnc_tty_uninit(dgnc_board[i]);
+   dgnc_cleanup_board(dgnc_board[i]);
}
 
dgnc_tty_post_uninit();
 
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
 }
 
@@ -187,7 +187,7 @@ static int __init dgnc_init_module(void)
 */
if (rc < 0) {
/* Only unregister if it was actually registered. */
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
else
pr_warn("WARNING: dgnc driver load failed.  No Digi Neo 
or Classic boards found.\n");
@@ -222,12 +222,12 @@ static int dgnc_start(void)
 *
 * Register management/dpa devices
 */
-   rc = register_chrdev(0, "dgnc", _BoardFops);
+   rc = register_chrdev(0, "dgnc", _board_fops);
if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
return rc;
}
-   dgnc_Major = rc;
+   dgnc_major = rc;
 
dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
if (IS_ERR(dgnc_class)) {
@@ -237,7 +237,7 @@ static int dgnc_start(void)
}
 
dev = device_create(dgnc_class, NULL,
-   MKDEV(dgnc_Major, 0),
+   MKDEV(dgnc_major, 0),
NULL, "dgnc_mgmt");
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
@@ -267,11 +267,11 @@ static int dgnc_start(void)
return 0;
 
 failed_tty:
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
 failed_device:
class_destroy(dgnc_class);
 failed_class:
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
return rc;
 }
 
@@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
} else {
rc = dgnc_found_board(pdev, ent->driver_data);
if (rc == 0)
-   dgnc_NumBoards++;
+   dgnc_num_boards++;
}
return rc;
 }
@@ 

[PATCH v2 11/12] mtd: nand: remove nand_chip.bbt

2015-12-14 Thread Peter Pan
From: Brian Norris 

With new nand_bbt.c, nand_chip doesn't need bbt element any more

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 include/linux/mtd/nand.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ee15f7d..99e4846 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -629,7 +629,6 @@ struct nand_buffers {
  * @read_retries:  [INTERN] the number of read retry modes supported
  * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
  * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
- * @bbt:   [INTERN] bad block table pointer
  * @nand_bbt:  [INTERN] pointer to bad block table structure, which
  * includes all information needed by Bad Block Management
  * @bbt_td:[REPLACEABLE] bad block table descriptor for flash
@@ -719,7 +718,6 @@ struct nand_chip {
struct nand_buffers *buffers;
struct nand_hw_control hwcontrol;
 
-   uint8_t *bbt;
struct nand_bbt *nand_bbt;
struct nand_bbt_descr *bbt_td;
struct nand_bbt_descr *bbt_md;
-- 
1.9.1

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


Re: Linux 4.1.15

2015-12-14 Thread Greg KH
diff --git a/Makefile b/Makefile
index 091280d66452..cf35f6bcffd8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 1
-SUBLEVEL = 14
+SUBLEVEL = 15
 EXTRAVERSION =
 NAME = Series 4800
 
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 1ec6441fe2a5..09138ceba046 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3417,6 +3417,7 @@ static void rbd_queue_workfn(struct work_struct *work)
goto err_rq;
}
img_request->rq = rq;
+   snapc = NULL; /* img_request consumes a ref */
 
if (op_type == OBJ_OP_DISCARD)
result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index f51d376d10ba..c2f5117fd8cb 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3675,6 +3675,11 @@ static int pci_probe(struct pci_dev *dev,
 
reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
+   /* JMicron JMB38x often shows 0 at first read, just ignore it */
+   if (!ohci->it_context_support) {
+   ohci_notice(ohci, "overriding IsoXmitIntMask\n");
+   ohci->it_context_support = 0xf;
+   }
reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
ohci->it_context_mask = ohci->it_context_support;
ohci->n_it = hweight32(ohci->it_context_mask);
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 9c71295f2fef..85e640440bd9 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -675,7 +675,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] 
= {
{ PHY_ID_BCM5461, 0xfff0 },
{ PHY_ID_BCM54616S, 0xfff0 },
{ PHY_ID_BCM5464, 0xfff0 },
-   { PHY_ID_BCM5482, 0xfff0 },
+   { PHY_ID_BCM5481, 0xfff0 },
{ PHY_ID_BCM5482, 0xfff0 },
{ PHY_ID_BCM50610, 0xfff0 },
{ PHY_ID_BCM50610M, 0xfff0 },
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 4e0470d396a3..71190dc1eacf 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -774,6 +774,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x2357, 0x9000, 4)},/* TP-LINK MA260 */
{QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},/* Telit LE920 */
{QMI_FIXED_INTF(0x1bc7, 0x1201, 2)},/* Telit LE920 */
+   {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)},/* XS Stick W100-2 from 4G 
Systems */
{QMI_FIXED_INTF(0x0b3c, 0xc000, 4)},/* Olivetti Olicard 100 */
{QMI_FIXED_INTF(0x0b3c, 0xc001, 4)},/* Olivetti Olicard 120 */
{QMI_FIXED_INTF(0x0b3c, 0xc002, 4)},/* Olivetti Olicard 140 */
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index b072e17479aa..2b0d84d32db4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -756,8 +756,16 @@ next_slot:
}
 
btrfs_item_key_to_cpu(leaf, , path->slots[0]);
-   if (key.objectid > ino ||
-   key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
+
+   if (key.objectid > ino)
+   break;
+   if (WARN_ON_ONCE(key.objectid < ino) ||
+   key.type < BTRFS_EXTENT_DATA_KEY) {
+   ASSERT(del_nr == 0);
+   path->slots[0]++;
+   goto next_slot;
+   }
+   if (key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
break;
 
fi = btrfs_item_ptr(leaf, path->slots[0],
@@ -776,8 +784,8 @@ next_slot:
btrfs_file_extent_inline_len(leaf,
 path->slots[0], fi);
} else {
-   WARN_ON(1);
-   extent_end = search_start;
+   /* can't happen */
+   BUG();
}
 
/*
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e3b39f0c4666..5136c73b3dce 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1294,8 +1294,14 @@ next_slot:
num_bytes = 0;
btrfs_item_key_to_cpu(leaf, _key, path->slots[0]);
 
-   if (found_key.objectid > ino ||
-   found_key.type > BTRFS_EXTENT_DATA_KEY ||
+   if (found_key.objectid > ino)
+   break;
+   if (WARN_ON_ONCE(found_key.objectid < ino) ||
+   found_key.type < BTRFS_EXTENT_DATA_KEY) {
+   path->slots[0]++;
+   goto next_slot;
+   }
+   if (found_key.type > BTRFS_EXTENT_DATA_KEY ||
found_key.offset > end)
break;
 
@@ -4184,6 +4190,47 @@ static int truncate_space_check(struct 
btrfs_trans_handle *trans,
 
 }
 
+static int 

[PATCH v2 10/12] mtd: nand_bbt: remove NAND_BBT_DYNAMICSTRUCT macro

2015-12-14 Thread Peter Pan
From: Brian Norris 

nand_bbt doesn't need nand badblock_pattern any more. So remove
NAND_BBT_DYNAMICSTRUCT from nand_bbt.h

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 include/linux/mtd/nand_bbt.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/include/linux/mtd/nand_bbt.h b/include/linux/mtd/nand_bbt.h
index 48a0620..e85596f 100644
--- a/include/linux/mtd/nand_bbt.h
+++ b/include/linux/mtd/nand_bbt.h
@@ -107,13 +107,6 @@ struct nand_bbt_descr {
  */
 #define NAND_BBT_NO_OOB_BBM0x0008
 
-/*
- * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
- * was allocated dynamicaly and must be freed in nand_release(). Has no meaning
- * in nand_chip.bbt_options.
- */
-#define NAND_BBT_DYNAMICSTRUCT 0x8000
-
 /* The maximum number of blocks to scan for a bbt */
 #define NAND_BBT_SCAN_MAXBLOCKS4
 
-- 
1.9.1

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


[PATCH v2 06/12] mtd: nand_bbt: use erase() and is_bad_bbm() hook in BBT

2015-12-14 Thread Peter Pan
From: Brian Norris 

Since NAND already create its nand_bbt struct, we can use erase()
hook instead of call nand_erase_nand() directly. Also, we can use
is_bad_bbm() to avoid passing badblock_pattern to BBT.

Signed-off-by: Brian Norris 
[Peter: remove @buf in create_bbt()]
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_bbt.c | 138 
 1 file changed, 12 insertions(+), 126 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index f256be1..a5c8ab5 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -122,23 +122,6 @@ static int check_pattern(uint8_t *buf, int len, int 
paglen, struct nand_bbt_desc
 }
 
 /**
- * check_short_pattern - [GENERIC] check if a pattern is in the buffer
- * @buf: the buffer to search
- * @td:search pattern descriptor
- *
- * Check for a pattern at the given place. Used to search bad block tables and
- * good / bad block identifiers. Same as check_pattern, but no optional empty
- * check.
- */
-static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)
-{
-   /* Compare the pattern */
-   if (memcmp(buf + td->offs, td->pattern, td->len))
-   return -1;
-   return 0;
-}
-
-/**
  * add_marker_len - compute the length of the marker in data area
  * @td: BBT descriptor used for computation
  *
@@ -409,63 +392,23 @@ static void read_abs_bbts(struct mtd_info *mtd, uint8_t 
*buf,
}
 }
 
-/* Scan a given block partially */
-static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
-  loff_t offs, uint8_t *buf, int numpages)
-{
-   struct mtd_oob_ops ops;
-   int j, ret;
-
-   ops.ooblen = mtd->oobsize;
-   ops.oobbuf = buf;
-   ops.ooboffs = 0;
-   ops.datbuf = NULL;
-   ops.mode = MTD_OPS_PLACE_OOB;
-
-   for (j = 0; j < numpages; j++) {
-   /*
-* Read the full oob until read_oob is fixed to handle single
-* byte reads for 16 bit buswidth.
-*/
-   ret = mtd_read_oob(mtd, offs, );
-   /* Ignore ECC errors when checking for BBM */
-   if (ret && !mtd_is_bitflip_or_eccerr(ret))
-   return ret;
-
-   if (check_short_pattern(buf, bd))
-   return 1;
-
-   offs += mtd->writesize;
-   }
-   return 0;
-}
-
 /**
  * create_bbt - [GENERIC] Create a bad block table by scanning the device
  * @mtd: MTD device structure
- * @buf: temporary buffer
- * @bd: descriptor for the good/bad block search pattern
  * @chip: create the table for a specific chip, -1 read all chips; applies only
  *if NAND_BBT_PERCHIP option is set
  *
  * Create a bad block table by scanning the device for the given good/bad block
  * identify pattern.
  */
-static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
-   struct nand_bbt_descr *bd, int chip)
+static int create_bbt(struct mtd_info *mtd, int chip)
 {
struct nand_chip *this = mtd_to_nand(mtd);
-   int i, numblocks, numpages;
-   int startblock;
+   int i, startblock, numblocks;
loff_t from;
 
pr_info("Scanning device for bad blocks\n");
 
-   if (bd->options & NAND_BBT_SCAN2NDPAGE)
-   numpages = 2;
-   else
-   numpages = 1;
-
if (chip == -1) {
numblocks = mtd->size >> this->bbt_erase_shift;
startblock = 0;
@@ -482,15 +425,10 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
from = (loff_t)startblock << this->bbt_erase_shift;
}
 
-   if (this->bbt_options & NAND_BBT_SCANLASTPAGE)
-   from += mtd->erasesize - (mtd->writesize * numpages);
-
for (i = startblock; i < numblocks; i++) {
int ret;
 
-   BUG_ON(bd->options & NAND_BBT_NO_OOB);
-
-   ret = scan_block_fast(mtd, bd, from, buf, numpages);
+   ret = this->nand_bbt->is_bad_bbm(mtd, from);
if (ret < 0)
return ret;
 
@@ -619,7 +557,6 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
 int chipsel)
 {
struct nand_chip *this = mtd_to_nand(mtd);
-   struct erase_info einfo;
int i, res, chip = 0;
int bits, startblock, dir, page, offs, numblocks, sft, sftmsk;
int nrchips, pageoffs, ooboffs;
@@ -782,11 +719,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
buf[offs + (i >> sft)] &= ~(msk[dat] << sftcnt);
}
 
-   memset(, 0, sizeof(einfo));
-   einfo.mtd = mtd;
-   einfo.addr = to;
-   einfo.len = 1 << this->bbt_erase_shift;
-   res = nand_erase_nand(mtd, , 1);
+   res = this->nand_bbt->erase(mtd, to);
if (res < 0)
goto outerr;
 
@@ -812,30 

[PATCH v2 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-12-14 Thread Peter Pan
Since struct nand_chip is removed from nand_bbt.c, BBT is now
shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
Both NAND and SPI NAND should depend on MTD_NAND_BBT.

Signed-off-by: Peter Pan 
---
 drivers/mtd/Kconfig   | 7 +++
 drivers/mtd/Makefile  | 1 +
 drivers/mtd/nand/Kconfig  | 2 +-
 drivers/mtd/nand/Makefile | 2 +-
 drivers/mtd/{nand => }/nand_bbt.c | 0
 5 files changed, 10 insertions(+), 2 deletions(-)
 rename drivers/mtd/{nand => }/nand_bbt.c (100%)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 42cc953..8718556 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -322,6 +322,13 @@ config MTD_PARTITIONED_MASTER
  the parent of the partition device be the master device, rather than
  what lies behind the master.
 
+config MTD_NAND_BBT
+   tristate "Bad Block Table support for NAND based devices"
+   depends on MTD
+   help
+ Since struct nand_chip is removed from nand_bbt.c, BBT is now
+ shareable. Both NAND and SPI NAND can use it.
+
 source "drivers/mtd/chips/Kconfig"
 
 source "drivers/mtd/maps/Kconfig"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 99bb9a1..55aed6f 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_SSFDC)   += ssfdc.o
 obj-$(CONFIG_SM_FTL)   += sm_ftl.o
 obj-$(CONFIG_MTD_OOPS) += mtdoops.o
 obj-$(CONFIG_MTD_SWAP) += mtdswap.o
+obj-$(CONFIG_MTD_NAND_BBT) += nand_bbt.o
 
 nftl-objs  := nftlcore.o nftlmount.o
 inftl-objs := inftlcore.o inftlmount.o
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 6c71f62..2e11994 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -12,7 +12,7 @@ config MTD_NAND_ECC_SMC
 
 menuconfig MTD_NAND
tristate "NAND Device Support"
-   depends on MTD
+   depends on MTD && MTD_NAND_BBT
select MTD_NAND_IDS
select MTD_NAND_ECC
help
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 2c7f014..4429f86 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -56,4 +56,4 @@ obj-$(CONFIG_MTD_NAND_SUNXI)  += sunxi_nand.o
 obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
 obj-$(CONFIG_MTD_NAND_BRCMNAND)+= brcmnand/
 
-nand-objs := nand_base.o nand_bbt.o nand_timings.o
+nand-objs := nand_base.o nand_timings.o
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand_bbt.c
similarity index 100%
rename from drivers/mtd/nand/nand_bbt.c
rename to drivers/mtd/nand_bbt.c
-- 
1.9.1

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


[PATCH v2 03/12] mtd: nand_bbt: add new API definitions

2015-12-14 Thread Peter Pan
From: Brian Norris 

Add new API definitions for nand_bbt to replace old ones without
any users. These API includes:
int nand_bbt_init(struct nand_bbt *bbt);
void nand_bbt_release(struct nand_bbt *bbt);
int nand_bbt_markbad(struct nand_bbt *bbt, loff_t offs);
int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs);
int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs);

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_bbt.c  | 71 
 include/linux/mtd/nand_bbt.h |  6 
 2 files changed, 77 insertions(+)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 4b6a708..72aed20 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1375,3 +1375,74 @@ int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
 }
 
 EXPORT_SYMBOL(nand_scan_bbt);
+
+/**
+ * nand_bbt_init - [NAND BBT Interface] Initialize and locate/create a bad 
block
+ * table
+ * @bbt: NAND BBT structure
+ *
+ * This function selects the default bad block table support for the device and
+ * scans for an existing table, or else creates one.
+ */
+int nand_bbt_init(struct nand_bbt *bbt)
+{
+   /*
+* FIXME: For now, we call nand_default_bbt() directly. It will change
+* when we use struct nand_bbt instead of struct nand_chip.
+*/
+   return nand_default_bbt(bbt->mtd);
+}
+EXPORT_SYMBOL(nand_bbt_init);
+
+void nand_bbt_release(struct nand_bbt *bbt)
+{
+   kfree(bbt->bbt);
+}
+EXPORT_SYMBOL(nand_bbt_release);
+
+/**
+ * nand_bbt_isreserved - [NAND BBT Interface] Check if a block is reserved
+ * @bbt: NAND BBT structure
+ * @offs: offset in the device
+ */
+int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs)
+{
+   /*
+* FIXME: For now, we call nand_isreserved_bbt() directly. It will
+* change when we use struct nand_bbt instead of struct nand_chip.
+*/
+   return nand_isreserved_bbt(bbt->mtd, offs);
+}
+EXPORT_SYMBOL(nand_bbt_isreserved);
+
+/**
+ * nand_bbt_isbad - [NAND BBT Interface] Check if a block is bad
+ * @bbt: NAND BBT structure
+ * @offs: offset in the device
+ */
+int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs)
+{
+   /*
+* FIXME: For now, we call nand_isbad_bbt() directly. It will change
+* when we use struct nand_bbt instead of struct nand_chip.
+* Since we already have nand_bbt_isreserved(), we don't need to
+* check pass down allow_bbt.
+*/
+   return nand_isbad_bbt(bbt->mtd, offs, 1);
+}
+EXPORT_SYMBOL(nand_bbt_isbad);
+
+/**
+ * nand_bbt_markbad - [NAND BBT Interface] Mark a block bad in the BBT
+ * @bbt: NAND BBT structure
+ * @offs: offset of the bad block
+ */
+int nand_bbt_markbad(struct nand_bbt *bbt, loff_t offs)
+{
+   /*
+* FIXME: For now, we call nand_markbad_bbt() directly. It will change
+* when we use struct nand_bbt instead of struct nand_chip.
+*/
+   return nand_markbad_bbt(bbt->mtd, offs);
+}
+EXPORT_SYMBOL(nand_bbt_markbad);
diff --git a/include/linux/mtd/nand_bbt.h b/include/linux/mtd/nand_bbt.h
index e468571..150c49a 100644
--- a/include/linux/mtd/nand_bbt.h
+++ b/include/linux/mtd/nand_bbt.h
@@ -174,4 +174,10 @@ struct nand_bbt {
u8 *bbt;
 };
 
+int nand_bbt_init(struct nand_bbt *bbt);
+void nand_bbt_release(struct nand_bbt *bbt);
+int nand_bbt_markbad(struct nand_bbt *bbt, loff_t offs);
+int nand_bbt_isreserved(struct nand_bbt *bbt, loff_t offs);
+int nand_bbt_isbad(struct nand_bbt *bbt, loff_t offs);
+
 #endif /* __LINUX_MTD_NAND_BBT_H */
-- 
1.9.1

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


[PATCH v2 08/12] mtd: nand_bbt: remove struct nand_chip from nand_bbt.c

2015-12-14 Thread Peter Pan
From: Brian Norris 

This commit contains most of modification. But the job is quite
simple --- replace struct nand_chip with struct nand_bbt. There
is no algorithm change, just replacement.

Signed-off-by: Brian Norris 
Signed-off-by: Peter Pan 
---
 drivers/mtd/nand/nand_bbt.c | 391 ++--
 1 file changed, 193 insertions(+), 198 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index a5c8ab5..b46b4ae 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -60,8 +60,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -76,20 +75,20 @@
 #define BBT_ENTRY_MASK 0x03
 #define BBT_ENTRY_SHIFT2
 
-static int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
+static int nand_update_bbt(struct nand_bbt *bbt, loff_t offs);
 
-static inline uint8_t bbt_get_entry(struct nand_chip *chip, int block)
+static inline uint8_t bbt_get_entry(struct nand_bbt *bbt, int block)
 {
-   uint8_t entry = chip->bbt[block >> BBT_ENTRY_SHIFT];
+   uint8_t entry = bbt->bbt[block >> BBT_ENTRY_SHIFT];
entry >>= (block & BBT_ENTRY_MASK) * 2;
return entry & BBT_ENTRY_MASK;
 }
 
-static inline void bbt_mark_entry(struct nand_chip *chip, int block,
+static inline void bbt_mark_entry(struct nand_bbt *bbt, int block,
uint8_t mark)
 {
uint8_t msk = (mark & BBT_ENTRY_MASK) << ((block & BBT_ENTRY_MASK) * 2);
-   chip->bbt[block >> BBT_ENTRY_SHIFT] |= msk;
+   bbt->bbt[block >> BBT_ENTRY_SHIFT] |= msk;
 }
 
 static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td)
@@ -142,7 +141,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td)
 
 /**
  * read_bbt - [GENERIC] Read the bad block table starting from page
- * @mtd: MTD device structure
+ * @bbt: NAND BBT structure
  * @buf: temporary buffer
  * @page: the starting page
  * @num: the number of bbt descriptors to read
@@ -151,11 +150,11 @@ static u32 add_marker_len(struct nand_bbt_descr *td)
  *
  * Read the bad block table starting from page.
  */
-static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
+static int read_bbt(struct nand_bbt *bbt, uint8_t *buf, int page, int num,
struct nand_bbt_descr *td, int offs)
 {
+   struct mtd_info *mtd = bbt->mtd;
int res, ret = 0, i, j, act = 0;
-   struct nand_chip *this = mtd_to_nand(mtd);
size_t retlen, len, totlen;
loff_t from;
int bits = td->options & NAND_BBT_NRBITS_MSK;
@@ -165,10 +164,10 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, 
int page, int num,
 
totlen = (num * bits) >> 3;
marker_len = add_marker_len(td);
-   from = ((loff_t)page) << this->page_shift;
+   from = ((loff_t)page) << bbt->page_shift;
 
while (totlen) {
-   len = min(totlen, (size_t)(1 << this->bbt_erase_shift));
+   len = min(totlen, (size_t)(1 << bbt->bbt_erase_shift));
if (marker_len) {
/*
 * In case the BBT marker is not in the OOB area it
@@ -204,8 +203,8 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int 
page, int num,
if (reserved_block_code && (tmp == 
reserved_block_code)) {
pr_info("nand_read_bbt: reserved block 
at 0x%012llx\n",
 (loff_t)(offs + act) <<
-this->bbt_erase_shift);
-   bbt_mark_entry(this, offs + act,
+bbt->bbt_erase_shift);
+   bbt_mark_entry(bbt, offs + act,
BBT_BLOCK_RESERVED);
mtd->ecc_stats.bbtblocks++;
continue;
@@ -216,13 +215,13 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, 
int page, int num,
 */
pr_info("nand_read_bbt: bad block at 
0x%012llx\n",
 (loff_t)(offs + act) <<
-this->bbt_erase_shift);
+bbt->bbt_erase_shift);
/* Factory marked bad or worn out? */
if (tmp == 0)
-   bbt_mark_entry(this, offs + act,
+   bbt_mark_entry(bbt, offs + act,
BBT_BLOCK_FACTORY_BAD);
else
-   bbt_mark_entry(this, offs + act,
+   bbt_mark_entry(bbt, offs + act,
  

[PATCH v2 01/12] mtd: nand_bbt: new header for nand family BBT

2015-12-14 Thread Peter Pan
From: Brian Norris 

Migrating existing BBT definitions from bbm.h to nand_bbt.h

Signed-off-by: Brian Norris 
[Peter: correct misspelling. s/neccecary/necessary/]
Signed-off-by: Peter Pan 
---
 include/linux/mtd/bbm.h  |  96 +--
 include/linux/mtd/nand_bbt.h | 118 +++
 2 files changed, 119 insertions(+), 95 deletions(-)
 create mode 100644 include/linux/mtd/nand_bbt.h

diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 36bb6a5..fb751d9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -28,102 +28,8 @@
 #ifndef __LINUX_MTD_BBM_H
 #define __LINUX_MTD_BBM_H
 
-/* The maximum number of NAND chips in an array */
-#define NAND_MAX_CHIPS 8
+#include 
 
-/**
- * struct nand_bbt_descr - bad block table descriptor
- * @options:   options for this descriptor
- * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE
- * when bbt is searched, then we store the found bbts pages here.
- * Its an array and supports up to 8 chips now
- * @offs:  offset of the pattern in the oob area of the page
- * @veroffs:   offset of the bbt version counter in the oob are of the page
- * @version:   version read from the bbt page during scan
- * @len:   length of the pattern, if 0 no pattern check is performed
- * @maxblocks: maximum number of blocks to search for a bbt. This number of
- * blocks is reserved at the end of the device where the tables are
- * written.
- * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
- *  bad) block in the stored bbt
- * @pattern:   pattern to identify bad block table or factory marked good /
- * bad blocks, can be NULL, if len = 0
- *
- * Descriptor for the bad block table marker and the descriptor for the
- * pattern which identifies good and bad blocks. The assumption is made
- * that the pattern and the version count are always located in the oob area
- * of the first block.
- */
-struct nand_bbt_descr {
-   int options;
-   int pages[NAND_MAX_CHIPS];
-   int offs;
-   int veroffs;
-   uint8_t version[NAND_MAX_CHIPS];
-   int len;
-   int maxblocks;
-   int reserved_block_code;
-   uint8_t *pattern;
-};
-
-/* Options for the bad block table descriptors */
-
-/* The number of bits used per block in the bbt on the device */
-#define NAND_BBT_NRBITS_MSK0x000F
-#define NAND_BBT_1BIT  0x0001
-#define NAND_BBT_2BIT  0x0002
-#define NAND_BBT_4BIT  0x0004
-#define NAND_BBT_8BIT  0x0008
-/* The bad block table is in the last good block of the device */
-#define NAND_BBT_LASTBLOCK 0x0010
-/* The bbt is at the given page, else we must scan for the bbt */
-#define NAND_BBT_ABSPAGE   0x0020
-/* bbt is stored per chip on multichip devices */
-#define NAND_BBT_PERCHIP   0x0080
-/* bbt has a version counter at offset veroffs */
-#define NAND_BBT_VERSION   0x0100
-/* Create a bbt if none exists */
-#define NAND_BBT_CREATE0x0200
-/*
- * Create an empty BBT with no vendor information. Vendor's information may be
- * unavailable, for example, if the NAND controller has a different data and 
OOB
- * layout or if this information is already purged. Must be used in conjunction
- * with NAND_BBT_CREATE.
- */
-#define NAND_BBT_CREATE_EMPTY  0x0400
-/* Write bbt if neccecary */
-#define NAND_BBT_WRITE 0x2000
-/* Read and write back block contents when writing bbt */
-#define NAND_BBT_SAVECONTENT   0x4000
-/* Search good / bad pattern on the first and the second page */
-#define NAND_BBT_SCAN2NDPAGE   0x8000
-/* Search good / bad pattern on the last page of the eraseblock */
-#define NAND_BBT_SCANLASTPAGE  0x0001
-/*
- * Use a flash based bad block table. By default, OOB identifier is saved in
- * OOB area. This option is passed to the default bad block table function.
- */
-#define NAND_BBT_USE_FLASH 0x0002
-/*
- * Do not store flash based bad block table marker in the OOB area; store it
- * in-band.
- */
-#define NAND_BBT_NO_OOB0x0004
-/*
- * Do not write new bad block markers to OOB; useful, e.g., when ECC covers
- * entire spare area. Must be used with NAND_BBT_USE_FLASH.
- */
-#define NAND_BBT_NO_OOB_BBM0x0008
-
-/*
- * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
- * was allocated dynamicaly and must be freed in nand_release(). Has no meaning
- * in nand_chip.bbt_options.
- */
-#define NAND_BBT_DYNAMICSTRUCT 0x8000
-
-/* The maximum number of blocks to scan for a bbt */
-#define NAND_BBT_SCAN_MAXBLOCKS4
 
 /*
  * Constants for oob configuration
diff --git a/include/linux/mtd/nand_bbt.h b/include/linux/mtd/nand_bbt.h
new file mode 100644
index 000..5a65230
--- /dev/null
+++ b/include/linux/mtd/nand_bbt.h
@@ -0,0 +1,118 

Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the spacing fixes that led to checkpatch.pl warnings.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_cls.c|   4 +-
 drivers/staging/dgnc/dgnc_driver.h |   8 --
 drivers/staging/dgnc/dgnc_neo.c| 235
-
drivers/staging/dgnc/dgnc_neo.h|  22 ++--
drivers/staging/dgnc/dgnc_pci.h|   1 -
drivers/staging/dgnc/dgnc_sysfs.c  |  18 ++-
drivers/staging/dgnc/dgnc_tty.c|  46 +---
drivers/staging/dgnc/digi.h|  32 ++--- 8 files changed, 223
insertions(+), 143 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c
b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch)
/* Clear out UART and FIFO */
readb(>ch_cls_uart->txrx);
 
-
writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
-  >ch_cls_uart->isr_fcr);
+   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+  UART_FCR_CLEAR_XMIT), >ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY |
CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h
b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
 #define   _POSIX_VDISABLE '\0'
 #endif
 
-
 /*
  * All the possible states the driver can be while being loaded.
  */
@@ -106,7 +105,6 @@ enum {
BOARD_READY
 };
 
-
 /*
  *
  * Structures and closely related defines.
@@ -145,7 +143,6 @@ struct board_ops {
  /
 #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express
board */ 
-
 /*
  * Per-board information
  */
@@ -241,7 +238,6 @@ struct dgnc_board {
 
 };
 
-
 /
  * Unit flag definitions for un_flags.
  /
@@ -277,7 +273,6 @@ struct un_t {
struct device *un_sysfs;
 };
 
-
 /
  * Device flag definitions for ch_flags.
  /
@@ -300,7 +295,6 @@ struct un_t {
 #define CH_FORCED_STOP  0x2/* Output is forcibly
stopped */ #define CH_FORCED_STOPI 0x4  /*
Input is forcibly stopped   */ 
-
 /* Our Read/Error/Write queue sizes */
 #define RQUEUEMASK 0x1FFF  /* 8 K - 1 */
 #define EQUEUEMASK 0x1FFF  /* 8 K - 1 */
@@ -309,7 +303,6 @@ struct un_t {
 #define EQUEUESIZE RQUEUESIZE
 #define WQUEUESIZE (WQUEUEMASK + 1)
 
-
 /
  * Channel information structure.
  /
@@ -397,7 +390,6 @@ struct channel_t {
ulong   ch_intr_tx; /* Count of interrupts
*/ ulongch_intr_rx; /* Count of interrupts */
 
-
/* /proc// entries */
struct proc_dir_entry *proc_entry_pointer;
struct dgnc_proc_entry *dgnc_channel_table;
diff --git a/drivers/staging/dgnc/dgnc_neo.c
b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = {
.send_immediate_char =  neo_send_immediate_char
 };
 
-static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10,
0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02,
0x04, 0x08,
+   0x10, 0x20, 0x40, 0x80 };
 
 /*
  * This function allows calls to ensure that all outstanding
@@ -109,14 +110,17 @@ static inline void
neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon
flow control */ efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Becuz Exar's spec says we have to zero it out before
setting it */
+   /* Why? Becuz Exar's spec says we have to
+* zero it out before setting it.
+*/
writeb(0, >ch_neo_uart->efr);
 
/* Turn on UART enhanced bits */
writeb(efr, >ch_neo_uart->efr);
 
/* Turn on table D, with 8 char hi/low watermarks */
-   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
>ch_neo_uart->fctr);
+   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+  >ch_neo_uart->fctr);
 
/* Feed the UART our trigger levels */
writeb(8, >ch_neo_uart->tfifo);
@@ -144,13 +148,16 @@ static inline void
neo_set_rts_flow_control(struct channel_t *ch) ier &=
~UART_17158_IER_XOFF; efr &= ~UART_17158_EFR_IXOFF;
 
-   /* Why? Becuz 

Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes spacing fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the spacing fixes that led to checkpatch.pl warnings.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_cls.c|   4 +-
 drivers/staging/dgnc/dgnc_driver.h |   8 --
 drivers/staging/dgnc/dgnc_neo.c| 235 -
 drivers/staging/dgnc/dgnc_neo.h|  22 ++--
 drivers/staging/dgnc/dgnc_pci.h|   1 -
 drivers/staging/dgnc/dgnc_sysfs.c  |  18 ++-
 drivers/staging/dgnc/dgnc_tty.c|  46 +---
 drivers/staging/dgnc/digi.h|  32 ++---
 8 files changed, 223 insertions(+), 143 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 75040da..d312d35 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch)
/* Clear out UART and FIFO */
readb(>ch_cls_uart->txrx);
 
-   writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
-  >ch_cls_uart->isr_fcr);
+   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+  UART_FCR_CLEAR_XMIT), >ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
 #define   _POSIX_VDISABLE '\0'
 #endif
 
-
 /*
  * All the possible states the driver can be while being loaded.
  */
@@ -106,7 +105,6 @@ enum {
BOARD_READY
 };
 
-
 /*
  *
  * Structures and closely related defines.
@@ -145,7 +143,6 @@ struct board_ops {
  /
 #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */
 
-
 /*
  * Per-board information
  */
@@ -241,7 +238,6 @@ struct dgnc_board {
 
 };
 
-
 /
  * Unit flag definitions for un_flags.
  /
@@ -277,7 +273,6 @@ struct un_t {
struct device *un_sysfs;
 };
 
-
 /
  * Device flag definitions for ch_flags.
  /
@@ -300,7 +295,6 @@ struct un_t {
 #define CH_FORCED_STOP  0x2/* Output is forcibly stopped   
*/
 #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped
*/
 
-
 /* Our Read/Error/Write queue sizes */
 #define RQUEUEMASK 0x1FFF  /* 8 K - 1 */
 #define EQUEUEMASK 0x1FFF  /* 8 K - 1 */
@@ -309,7 +303,6 @@ struct un_t {
 #define EQUEUESIZE RQUEUESIZE
 #define WQUEUESIZE (WQUEUEMASK + 1)
 
-
 /
  * Channel information structure.
  /
@@ -397,7 +390,6 @@ struct channel_t {
ulong   ch_intr_tx; /* Count of interrupts */
ulong   ch_intr_rx; /* Count of interrupts */
 
-
/* /proc// entries */
struct proc_dir_entry *proc_entry_pointer;
struct dgnc_proc_entry *dgnc_channel_table;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = {
.send_immediate_char =  neo_send_immediate_char
 };
 
-static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 
0x80 };
+static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08,
+   0x10, 0x20, 0x40, 0x80 };
 
 /*
  * This function allows calls to ensure that all outstanding
@@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Becuz Exar's spec says we have to zero it out before setting it 
*/
+   /* Why? Becuz Exar's spec says we have to
+* zero it out before setting it.
+*/
writeb(0, >ch_neo_uart->efr);
 
/* Turn on UART enhanced bits */
writeb(efr, >ch_neo_uart->efr);
 
/* Turn on table D, with 8 char hi/low watermarks */
-   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), 
>ch_neo_uart->fctr);
+   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+  >ch_neo_uart->fctr);
 
/* Feed the UART our trigger levels */
writeb(8, >ch_neo_uart->tfifo);
@@ -144,13 +148,16 @@ static inline void neo_set_rts_flow_control(struct 
channel_t *ch)
ier &= ~UART_17158_IER_XOFF;

RE: [lkp] [f2fs] 9f88450ff1: stderr.mount:wrong_fs_type,bad_option,bad_superblock_on/dev/sda3

2015-12-14 Thread Chao Yu
Hi Ying Huang,

> -Original Message-
> From: Huang, Ying [mailto:ying.hu...@linux.intel.com]
> Sent: Tuesday, December 15, 2015 12:06 PM
> To: Chao Yu
> Cc: l...@01.org; 'LKML'; '0day robot'
> Subject: Re: [lkp] [f2fs] 9f88450ff1:
> stderr.mount:wrong_fs_type,bad_option,bad_superblock_on/dev/sda3
> 
> Chao Yu  writes:
> 
> > Hi Ying Huang,
> >
> >> -Original Message-
> >> From: kernel test robot [mailto:ying.hu...@linux.intel.com]
> >> Sent: Monday, December 14, 2015 3:06 PM
> >> To: Chao Yu
> >> Cc: l...@01.org; LKML; 0day robot
> >> Subject: [lkp] [f2fs] 9f88450ff1:
> >> stderr.mount:wrong_fs_type,bad_option,bad_superblock_on/dev/sda3
> >>
> >> FYI, we noticed the below changes on
> >>
> >> https://github.com/0day-ci/linux
> >> Chao-Yu/f2fs-clean-up-node-page-updating-flow/20151211-161235
> >> commit 9f88450ff18d8bd577ff431318f7ae00034465c0 ("f2fs: do more integrity 
> >> verification for
> >> superblock")
> >>
> >>
> >> After your commit, our mounting f2fs partition operations will fail with
> >> following error message.  But I have no dmesg now.  Do you need it?
> >
> > Thanks for the report! Could you please share dmesg and some info (e.g. 
> > size..)
> > about storage device '/dev/sda3'.
> >
> 
> The dmesg is attached.

Thanks very much for your help. :) I have already fixed this issue and resent
v2 patch.

Thanks,

> 
> Best Regards,
> Huang, Ying

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: manual merge of the akpm-current tree with the powerpc tree

2015-12-14 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm-current tree got conflicts in:

  arch/powerpc/include/asm/nohash/64/pgtable.h
  arch/powerpc/mm/pgtable_64.c

between various commits from the powerpc tree and commits:

  e56ebae0dd4c ("powerpc, thp: remove infrastructure for handling splitting 
PMDs")

from the akpm-current tree.

I used the powerpc tree version of the first and the akpm-current tree
version of the second and then I applied the following merge fix patch:

From: Stephen Rothwell 
Date: Tue, 15 Dec 2015 16:50:42 +1100
Subject: [PATCH] merge fix for "powerpc, thp: remove infrastructure for
 handling splitting PMDs"

Signed-off-by: Stephen Rothwell 
---
 arch/powerpc/include/asm/book3s/64/hash-64k.h | 12 
 arch/powerpc/include/asm/book3s/64/hash.h | 10 ++
 arch/powerpc/include/asm/book3s/64/pgtable.h  |  4 
 3 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h 
b/arch/powerpc/include/asm/book3s/64/hash-64k.h
index 9f9942998587..f2072a4ca9e3 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
@@ -256,13 +256,6 @@ static inline int pmd_trans_huge(pmd_t pmd)
  (_PAGE_PTE | _PAGE_THP_HUGE));
 }
 
-static inline int pmd_trans_splitting(pmd_t pmd)
-{
-   if (pmd_trans_huge(pmd))
-   return pmd_val(pmd) & _PAGE_SPLITTING;
-   return 0;
-}
-
 static inline int pmd_large(pmd_t pmd)
 {
return !!(pmd_val(pmd) & _PAGE_PTE);
@@ -273,11 +266,6 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT);
 }
 
-static inline pmd_t pmd_mksplitting(pmd_t pmd)
-{
-   return __pmd(pmd_val(pmd) | _PAGE_SPLITTING);
-}
-
 #define __HAVE_ARCH_PMD_SAME
 static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
 {
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h 
b/arch/powerpc/include/asm/book3s/64/hash.h
index 8b929e531758..4e69d9a273ed 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -35,11 +35,6 @@
 #define _PAGE_SPECIAL  0x1 /* software: special page */
 
 /*
- * THP pages can't be special. So use the _PAGE_SPECIAL
- */
-#define _PAGE_SPLITTING _PAGE_SPECIAL
-
-/*
  * We need to differentiate between explicit huge page and THP huge
  * page, since THP huge page also need to track real subpage details
  */
@@ -48,9 +43,8 @@
 /*
  * set of bits not changed in pmd_modify.
  */
-#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS |  \
-_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \
-_PAGE_THP_HUGE | _PAGE_PTE)
+#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY |
+_PAGE_ACCESSED | _PAGE_THP_HUGE | _PAGE_PTE)
 
 #ifdef CONFIG_PPC_64K_PAGES
 #include 
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
b/arch/powerpc/include/asm/book3s/64/pgtable.h
index a2d4e0e37067..6306d6565ee0 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -232,10 +232,6 @@ extern int pmdp_clear_flush_young(struct vm_area_struct 
*vma,
 extern pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
 unsigned long addr, pmd_t *pmdp);
 
-#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
-extern void pmdp_splitting_flush(struct vm_area_struct *vma,
-unsigned long address, pmd_t *pmdp);
-
 extern pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
 unsigned long address, pmd_t *pmdp);
 #define pmdp_collapse_flush pmdp_collapse_flush
-- 
2.6.2

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


Re: [PATCH v6 3/5] memory: mediatek: Add SMI driver

2015-12-14 Thread Daniel Kurtz
Hi Yong,

On Tue, Dec 15, 2015 at 10:38 AM, Yong Wu  wrote:
> On Mon, 2015-12-14 at 19:18 +0100, Matthias Brugger wrote:
>> On Tuesday 08 Dec 2015 17:49:11 Yong Wu wrote:
>> > This patch add SMI(Smart Multimedia Interface) driver. This driver
>> > is responsible to enable/disable iommu and control the power domain
>> > and clocks of each local arbiter.
>> >
>> > Signed-off-by: Yong Wu 
>> > ---
>> >   Currently SMI offer mtk_smi_larb_get/put to enable the power-domain
>> > ,clocks and initialize the iommu configuration register for each a local
>> > arbiter, The reason is:
>> >   a) If a device would like to disable iommu, it also need call
>> > mtk_smi_larb_get/put to enable its power and clocks.
>> >   b) The iommu core don't support attach/detach a device within a
>> > iommu-group. So we cann't use iommu_attach_device(iommu_detach_device)
>> > instead
>> > of mtk_smi_larb_get/put.
>> >
> [..]
>> > +static int
>> > +mtk_smi_enable(struct device *dev, struct clk *apb, struct clk *smi)
>> > +{
>> > +   int ret;
>> > +
>> > +   ret = pm_runtime_get_sync(dev);
>> > +   if (ret < 0)
>> > +   return ret;
>> > +
>> > +   ret = clk_prepare_enable(apb);
>> > +   if (ret)
>> > +   goto err_put_pm;
>> > +
>> > +   ret = clk_prepare_enable(smi);
>> > +   if (ret)
>> > +   goto err_disable_apb;
>> > +
>> > +   return 0;
>> > +
>> > +err_disable_apb:
>> > +   clk_disable_unprepare(apb);
>> > +err_put_pm:
>> > +   pm_runtime_put_sync(dev);
>> > +   return ret;
>> > +}
>> > +
>> > +static void
>> > +mtk_smi_disable(struct device *dev, struct clk *apb, struct clk *smi)
>> > +{
>> > +   clk_disable_unprepare(smi);
>> > +   clk_disable_unprepare(apb);
>> > +   pm_runtime_put_sync(dev);
>> > +}
>> > +
>> > +static int mtk_smi_common_enable(struct mtk_smi_common *common)
>> > +{
>> > +   return mtk_smi_enable(common->dev, common->clk_apb, common->clk_smi);
>> > +}
>> > +
>> > +static void mtk_smi_common_disable(struct mtk_smi_common *common)
>> > +{
>> > +   mtk_smi_disable(common->dev, common->clk_apb, common->clk_smi);
>> > +}
>> > +
>> > +static int mtk_smi_larb_enable(struct mtk_smi_larb *larb)
>> > +{
>> > +   return mtk_smi_enable(larb->dev, larb->clk_apb, larb->clk_smi);
>> > +}
>> > +
>> > +static void mtk_smi_larb_disable(struct mtk_smi_larb *larb)
>> > +{
>> > +   mtk_smi_disable(larb->dev, larb->clk_apb, larb->clk_smi);
>> > +}
>> > +
>>
>> This is somehow over-engineered. Just use mtk_smi_enable and mtk_smi_disable
>> instead of adding an extra indirection.
>
> I added this only for readable...then the code in mtk_smi_larb_get below
> may looks simple and readable.
>
> If I use mtk_smi_enable/disable directly, the code will be like our
> v5[1], is it OK?
> Maybe I don't need these help function here, and only add more comment
> based on v5.
>
> [1]
> http://lists.linuxfoundation.org/pipermail/iommu/2015-October/014590.html

bike-shedding...

I like the fact that Yong is trying to make his helpers more type-safe.
But, perhaps we can rename "struct mtk_smi_common" as "struct
mtk_smi", and then make "struct mtk_smi_larb" contain a "struct
mtk_smi":

struct mtk_smi {
  struct device *dev;
  struct clk *clk_apb, *clk_smi;
}

struct mtk_smi_larb {
  struct mtk_smi;
  ...
}


Then, have:

int mtk_smi_enable(struct mtk_smi *smi)
{
  clk_enable(smi->clk_apb);
  ...
}

int mtk_smi_disable(struct mtk_smi *smi)
{
}

int mtk_smi_larb_get(struct device *larbdev)
{
  struct mtk_smi_larb *larb = dev_get_drvdata(larbdev);
  struct mtk_smi *common = dev_get_drvdata(larb->smi_common_dev);

  mtk_smi_enable(common);
  mtk_smi_enable(>smi);
  ...
}

>>
>> > +int mtk_smi_larb_get(struct device *larbdev)
>> > +{
>> > +   struct mtk_smi_larb *larb = dev_get_drvdata(larbdev);
>> > +   struct mtk_smi_common *common = dev_get_drvdata(larb->smi_common_dev);
>> > +   int ret;
>> > +
>> > +   ret = mtk_smi_common_enable(common);
>> > +   if (ret)
>> > +   return ret;
>> > +
>> > +   ret = mtk_smi_larb_enable(larb);
>> > +   if (ret)
>> > +   goto err_put_smi;
>> > +
>> > +   /* Configure the iommu info */
>> > +   writel_relaxed(larb->mmu, larb->base + SMI_LARB_MMU_EN);

I think this should probably be writel() not writel_relaxed, since you
really do want the barrier to ensure all other register accesses have
completed before enabling the MMU.

>> > +
>> > +   return 0;
>> > +
>> > +err_put_smi:
>> > +   mtk_smi_common_disable(common);
>> > +   return ret;
>> > +}
>> > +
>> > +void mtk_smi_larb_put(struct device *larbdev)
>> > +{
>> > +   struct mtk_smi_larb *larb = dev_get_drvdata(larbdev);
>> > +   struct mtk_smi_common *common = dev_get_drvdata(larb->smi_common_dev);
>> > +
>> > +   writel_relaxed(0, larb->base + SMI_LARB_MMU_EN);
>> > +   mtk_smi_larb_disable(larb);
>> > +   mtk_smi_common_disable(common);
>> > +}
>> > +
>>
>> Looks strange that you just disable all MMUs while you only enable some of
>> them at runtime. Unfortunately the datasheet I have lacks the SMI part, so I
>> can just guess 

Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Greg KH
On Mon, Dec 14, 2015 at 08:22:47PM -0500, Sanidhya Solanki wrote:
> Patch contains the spacing fixes that checkpatch prompted for,
> as asked by the TODO.
> 
> Signed-off-by: Sanidhya Solanki 

What is the FIXED doing in the subject?

And the subject is horrid, please make it sane...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] tty/n_gsm.c: fix false positive WARN_ON and do some codes improvement

2015-12-14 Thread Pan Xinhui

Hi, Greg
This patch is dropped, I have created another patch based on Jiri' 
patch.
On 2015/12/15 02:55, Greg Kroah-Hartman wrote:

On Wed, Nov 25, 2015 at 07:18:37PM +0800, xinhui wrote:

From: xinhui 

If gsm driver fails to activate one mux, and this mux is not stored in
gsm_mux[], there would be a warning in gsm_cleanup_mux(). Actually this
is a legal case. So just do a simple check instead of WARN_ON.

There is one filed gsm->num to store its index of gsm_mux[]. So use
gsm->num to remove itself from gsm_mux[] instead of the for-loop
traverse.

Reported-by: Dmitry Vyukov 
Fixes: 5a64096700dc ("tty/n_gsm.c: fix a memory leak in gsmld_open")
Signed-off-by: Pan Xinhui 


the signed-off-by name has to match your from: name :(



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 V9 2/5] dma: add Qualcomm Technologies HIDMA management driver

2015-12-14 Thread Sinan Kaya
Hi Mark,

On 12/14/2015 7:05 AM, Mark Rutland wrote:
>> +Required properties:
>> +- compatible: "qcom,hidma-mgmt-1.0";
>> +- reg: Address range for DMA device
>
> Does this cover just the management registers, or those for channels as
> well?

 just management.

>
>> +- dma-channels: Number of channels supported by this DMA controller.
>
> Surely this is discoverable, or can be derived from the set of channels
> described in the DT?

 No, this is a HW configuration. Each hardware instance supports certain
 number of channels based on the HW build. The number of active channels
 on the running operating system does not necessarily represent the
 maximum possible.
>>>
>>> I don't follow.
>>>
>>> If you aren't using some channels, why do you need to know about them?
>>>
>>
>> I mean the hypervisor OS may not be using the channels. It could be the
>> guest machines that are using it. I need the number of the channels not
>> the memory addresses where each channel is.
> 
> I still don't follow. Knowing the number of channels alone is clearly
> insufficient.
>
> The hypervisor is in charge of handing these out to guests. So it needs
> to know the set of of channels (i.e. the address of each channel, and
> which index the channel has in the control interface). Otherwise it
> cannot possibly allocate them to guests, and cannot possibly control
> those channels at runtime.

For clarification, let me reiterate.

Hypervisor operating system certainly knows which channels and
management interfaces there are in the system. However, the information
feeds into the OS from two different drivers.

The HW ownership has been partitioned among two drivers as management
driver and channel driver. Both of them serve the hypervisor but the
management driver doesn't need to know about the channel addresses where
the transfer descriptors are set up. Similarly, the channel driver
doesn't need to know anything about the management interface where the
priority and weight assignment is done.

> 
> Given the hypervisor is in chage of allocating channels to guests, it
> knows which channels are in use, and can decide whether or not to use
> channels for its own purposes.

Agreed

> 
>>> The driver seems to assume it can access registers for all (linearly
>>> indexed) channels up to the value it read from dt for dma-channels. That
>>> doesn't seem right if the driver is not dealing with all of those
>>> channels.
>>
>> I assume you are talking about this. Feel free to be specific if not
>> this one.
>>
>>  for (i = 0; i < mgmtdev->dma_channels; i++) {
>>  u32 weight = mgmtdev->weight[i];
>>  u32 priority = mgmtdev->priority[i];
>>
>>  val = readl(mgmtdev->virtaddr + HIDMA_QOS_N_OFFSET + (4 * i));
>>  val &= ~(1 << HIDMA_PRIORITY_BIT_POS);
>>  val |= (priority & 0x1) << HIDMA_PRIORITY_BIT_POS;
>>  val &= ~(HIDMA_WEIGHT_MASK << HIDMA_WRR_BIT_POS);
>>  val |= (weight & HIDMA_WEIGHT_MASK) << HIDMA_WRR_BIT_POS;
>>  writel(val, mgmtdev->virtaddr + HIDMA_QOS_N_OFFSET + (4 * i));
>>  }
>>
>> The management driver is configuring the priority and weight registers
>> inside the management address space. It is not accessing the channel
>> address space where data transfer descriptors are set up. There is one
>> register for priority & weight of the each channel inside the management
>> address space.
> 
> My point was that this implies that the driver has no idea as to the
> relationship between these configuration registers and the actual
> channel address spaces. It has no idea which channel address spaces are
> being configured here. That does not seem right.

My intention was to use the ACPI _UID to associate the channel index.
The _UID would tell me the index of the channel. I was encoding UID as
follows in the ACPI table.



this would tell me which HIDMA this channel belongs to as well as which
channel it is.

Since this solution is very much ACPI specific and doesn't scale to
device-tree, I'm thinking of adding a sysfs "index" file into each
channel so that I don't need to search through the firmware_node in ACPI
and of_node directory in device-tree mode.

I'm also thinking of creating symbolic links from the channel object
into the management object.

> hidma {
>   compatible - "qcom,hidma-1.0";
>
>   /* OPTIONAL management interface registers */
>   reg = < ... ... >;
>
>   ...
>
>   channel0 {
>   compatible = "qcom,
>   reg = < ... ... >;
>
>   ...
>   };
>
>   ...
> };
>>
>> This seems to have worked without requiring any work from me.
>>

Here is something I don't understand why and I could get some help from
DT experts.

When I have ACPI as follows

device(mgmt)
{
device(channel0)
{
}
}

The channel0 driver gets automatically probed by the OS.

Re: [PATCH 4.3 34/71] vrf: fix double free and memory corruption on register_netdevice failure

2015-12-14 Thread Greg Kroah-Hartman
On Mon, Dec 14, 2015 at 11:59:15AM -0700, David Ahern wrote:
> On 12/14/15 10:45 AM, Ben Hutchings wrote:
> >On Sat, 2015-12-12 at 12:05 -0800, Greg Kroah-Hartman wrote:
> >>4.3-stable review patch.  If anyone has any objections, please let me
> >>know.
> >>
> >>--
> >>
> >>From: Nikolay Aleksandrov 
> >>
> >>[ Upstream commit 7f109f7cc37108cba7243bc832988525b0d85909 ]
> >[...]
> >>--- a/drivers/net/vrf.c
> >>+++ b/drivers/net/vrf.c
> >>@@ -581,7 +581,6 @@ static int vrf_newlink(struct net *src_n
> >>  {
> >>struct net_vrf *vrf = netdev_priv(dev);
> >>struct net_vrf_dev *vrf_ptr;
> >>-   int err;
> >>
> >>if (!data || !data[IFLA_VRF_TABLE])
> >>return -EINVAL;
> >>@@ -590,26 +589,16 @@ static int vrf_newlink(struct net *src_n
> >>
> >>dev->priv_flags |= IFF_VRF_MASTER;
> >>
> >>-   err = -ENOMEM;
> >>vrf_ptr = kmalloc(sizeof(*dev->vrf_ptr), GFP_KERNEL);
> >>if (!vrf_ptr)
> >>-   goto out_fail;
> >>+   return -ENOMEM;
> >>
> >>vrf_ptr->ifindex = dev->ifindex;
> >>vrf_ptr->tb_id = vrf->tb_id;
> >>
> >>-   err = register_netdevice(dev);
> >>-   if (err < 0)
> >>-   goto out_fail;
> >>-
> >>rcu_assign_pointer(dev->vrf_ptr, vrf_ptr);
> >>
> >>-   return 0;
> >>-
> >>-out_fail:
> >>-   kfree(vrf_ptr);
> >>-   free_netdev(dev);
> >>-   return err;
> >>+   return register_netdev(dev);
> >>  }
> >>
> >>  static size_t vrf_nl_getsize(const struct net_device *dev)
> >
> >This leaks *dev->vrf_ptr if register_netdevice() fails.  (This bug does
> >not exist in the mainline version, as net_device::vrf_ptr no longer
> >exists there.)
> 
> Good catch. The backport just needs to drop the free_netdev call:
> 
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 488c6f50df73..374feba02565 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -608,7 +608,6 @@ static int vrf_newlink(struct net *src_net, struct
> net_device *dev,
> 
>  out_fail:
> kfree(vrf_ptr);
> -   free_netdev(dev);
> return err;
>  }

I don't understand, can someone send me a patch on top of what I have
already applied to resolve this?  This patch doesn't make much sense in
any context...

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/


[PATCH 8/8] f2fs: fix to avoid deadlock between checkpoint and writepages

2015-12-14 Thread Chao Yu
This patch fixes to move f2fs_balance_fs out of sbi->writepages'
coverage to avoid potential ABBA deadlock which was found by lockdep:

  Possible unsafe locking scenario:

CPU0CPU1

   lock(>writepages);
lock(>cp_mutex);
lock(>writepages);
   lock(>cp_mutex);

  *** DEADLOCK ***

stack of CPU0:
[] __lock_acquire+0x1321/0x1770
[] lock_acquire+0xb7/0x130
[] mutex_lock_nested+0x52/0x380
[] f2fs_balance_fs+0x8b/0xa0 [f2fs]
[] f2fs_write_data_page+0x33b/0x460 [f2fs]
[] __f2fs_writepage+0x1a/0x50 [f2fs]
[] T.1541+0x293/0x560 [f2fs]
[] f2fs_write_data_pages+0x12c/0x230 [f2fs]
[] do_writepages+0x23/0x40
[] __filemap_fdatawrite_range+0xb5/0xf0
[] filemap_write_and_wait_range+0xa3/0xd0
[] f2fs_symlink+0x180/0x300 [f2fs]
[] vfs_symlink+0xb7/0xe0
[] SyS_symlinkat+0xc5/0x100
[] SyS_symlink+0x16/0x20
[] entry_SYSCALL_64_fastpath+0x12/0x6f

stack of CPU1
[] lock_acquire+0xb7/0x130
[] mutex_lock_nested+0x52/0x380
[] f2fs_write_data_pages+0x11e/0x230 [f2fs]
[] do_writepages+0x23/0x40
[] __filemap_fdatawrite_range+0xb5/0xf0
[] filemap_fdatawrite+0x1f/0x30
[] sync_dirty_inodes+0x4d/0xd0 [f2fs]
[] block_operations+0x71/0x160 [f2fs]
[] write_checkpoint+0xe8/0xbb0 [f2fs]
[] f2fs_sync_fs+0x8f/0xf0 [f2fs]
[] f2fs_balance_fs_bg+0x6f/0xd0 [f2fs]
[] f2fs_write_node_pages+0x57/0x150 [f2fs]
[] do_writepages+0x23/0x40
[] __writeback_single_inode+0x6d/0x3d0
[] writeback_sb_inodes+0x2c7/0x520
[] wb_writeback+0x133/0x330
[] wb_do_writeback+0xe8/0x270
[] wb_workfn+0x80/0x1f0
[] process_one_work+0x20c/0x5c0
[] worker_thread+0x132/0x5f0
[] kthread+0xde/0x100
[] ret_from_fork+0x3f/0x70

Signed-off-by: Chao Yu 
---
 fs/f2fs/data.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2e97057..985671d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -506,7 +506,6 @@ static void __allocate_data_blocks(struct inode *inode, 
loff_t offset,
u64 end_offset;
 
while (len) {
-   f2fs_balance_fs(sbi);
f2fs_lock_op(sbi);
 
/* When reading holes, we need its node page */
@@ -1186,7 +1185,7 @@ out:
if (err)
ClearPageUptodate(page);
unlock_page(page);
-   if (need_balance_fs)
+   if (need_balance_fs && !test_opt(sbi, DATA_FLUSH))
f2fs_balance_fs(sbi);
if (wbc->for_reclaim) {
f2fs_submit_merged_bio(sbi, DATA, WRITE);
@@ -1617,6 +1616,8 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct 
iov_iter *iter,
trace_f2fs_direct_IO_enter(inode, offset, count, rw);
 
if (rw == WRITE) {
+   f2fs_balance_fs(sbi);
+
if (serialized)
mutex_lock(>writepages);
__allocate_data_blocks(inode, offset, count);
-- 
2.6.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/


[PATCH 7/8] f2fs: introduce new option for controlling data flush

2015-12-14 Thread Chao Yu
Add a new option 'data_flush' to enable/disable data flush functionality
in checkpoint.

Signed-off-by: Chao Yu 
---
 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/checkpoint.c   | 2 +-
 fs/f2fs/f2fs.h | 1 +
 fs/f2fs/super.c| 7 +++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/filesystems/f2fs.txt 
b/Documentation/filesystems/f2fs.txt
index 8088bd9..727373e 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -151,6 +151,8 @@ noextent_cache Disable an extent cache based on 
rb-tree explicitly, see
the above extent_cache mount option.
 noinline_data  Disable the inline data feature, inline data feature is
enabled by default.
+data_flush Enable data flushing during checkpoint in order to
+   persist data of regular and symlink.
 
 

 DEBUGFS ENTRIES
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index a73909c..2fdf271 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
 retry_flush_datas:
/* write all the dirty data pages */
-   if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+   if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) {
sync_dirty_inodes(sbi, FILE_INODE);
if (unlikely(f2fs_cp_error(sbi))) {
err = -EIO;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 4d44732..ee1f0a8 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -54,6 +54,7 @@
 #define F2FS_MOUNT_FASTBOOT0x1000
 #define F2FS_MOUNT_EXTENT_CACHE0x2000
 #define F2FS_MOUNT_FORCE_FG_GC 0x4000
+#define F2FS_MOUNT_DATA_FLUSH  0x8000
 
 #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)   (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 051bce6..694e092 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -67,6 +67,7 @@ enum {
Opt_extent_cache,
Opt_noextent_cache,
Opt_noinline_data,
+   Opt_data_flush,
Opt_nodiscard,
Opt_err,
 };
@@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = {
{Opt_extent_cache, "extent_cache"},
{Opt_noextent_cache, "noextent_cache"},
{Opt_noinline_data, "noinline_data"},
+   {Opt_data_flush, "data_flush"},
{Opt_nodiscard, "nodiscard"},
{Opt_err, NULL},
 };
@@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char 
*options)
case Opt_noinline_data:
clear_opt(sbi, INLINE_DATA);
break;
+   case Opt_data_flush:
+   clear_opt(sbi, DATA_FLUSH);
+   break;
default:
f2fs_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" or missing 
value",
@@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct 
dentry *root)
seq_puts(seq, ",extent_cache");
else
seq_puts(seq, ",noextent_cache");
+   if (test_opt(sbi, DATA_FLUSH))
+   seq_puts(seq, ",data_flush");
seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
return 0;
-- 
2.6.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/


[PATCH 6/8] f2fs: stat dirty regular/symlink inodes

2015-12-14 Thread Chao Yu
Add to stat dirty regular and symlink inode for showing in debugfs.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 4 
 fs/f2fs/debug.c  | 4 
 fs/f2fs/f2fs.h   | 8 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 217571f..a73909c 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -735,6 +735,8 @@ static void __add_dirty_inode(struct inode *inode, enum 
inode_type type)
list_add_tail(>dirty_list, >inode_list[type]);
if (type == DIR_INODE)
stat_inc_dirty_dir(sbi);
+   else
+   stat_inc_dirty_file(sbi);
 }
 
 static void __remove_dirty_inode(struct inode *inode, enum inode_type type)
@@ -751,6 +753,8 @@ static void __remove_dirty_inode(struct inode *inode, enum 
inode_type type)
clear_inode_flag(fi, flag);
if (type == DIR_INODE)
stat_dec_dirty_dir(sbi);
+   else
+   stat_dec_dirty_file(sbi);
 }
 
 void update_dirty_page(struct inode *inode, struct page *page)
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index f4a7b9e..80a40dd 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -42,7 +42,9 @@ static void update_general_status(struct f2fs_sb_info *sbi)
si->ext_node = atomic_read(>total_ext_node);
si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES);
si->ndirty_dent = get_pages(sbi, F2FS_DIRTY_DENTS);
+   si->ndirty_data = get_pages(sbi, F2FS_DIRTY_DATAS);
si->ndirty_dirs = sbi->n_dirty_dirs;
+   si->ndirty_files = sbi->n_dirty_files;
si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META);
si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES);
si->wb_pages = get_pages(sbi, F2FS_WRITEBACK);
@@ -298,6 +300,8 @@ static int stat_show(struct seq_file *s, void *v)
   si->ndirty_node, si->node_pages);
seq_printf(s, "  - dents: %4d in dirs:%4d\n",
   si->ndirty_dent, si->ndirty_dirs);
+   seq_printf(s, "  - datas: %4d in files:%4d\n",
+  si->ndirty_data, si->ndirty_files);
seq_printf(s, "  - meta: %4d in %4d\n",
   si->ndirty_meta, si->meta_pages);
seq_printf(s, "  - NATs: %9d/%9d\n  - SITs: %9d/%9d\n",
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 2477b2f5..4d44732 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -818,6 +818,7 @@ struct f2fs_sb_info {
atomic_t inline_dir;/* # of inline_dentry inodes */
int bg_gc;  /* background gc calls */
unsigned int n_dirty_dirs;  /* # of dir inodes */
+   unsigned int n_dirty_files; /* # of regular/symlink inodes 
*/
 #endif
unsigned int last_victim[2];/* last victim segment # */
spinlock_t stat_lock;   /* lock for stat operations */
@@ -1892,7 +1893,8 @@ struct f2fs_stat_info {
unsigned long long hit_largest, hit_cached, hit_rbtree;
unsigned long long hit_total, total_ext;
int ext_tree, ext_node;
-   int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
+   int ndirty_node, ndirty_meta;
+   int ndirty_dent, ndirty_dirs, ndirty_data, ndirty_files;
int nats, dirty_nats, sits, dirty_sits, fnids;
int total_count, utilization;
int bg_gc, inmem_pages, wb_pages;
@@ -1927,6 +1929,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
f2fs_sb_info *sbi)
 #define stat_inc_bggc_count(sbi)   ((sbi)->bg_gc++)
 #define stat_inc_dirty_dir(sbi)((sbi)->n_dirty_dirs++)
 #define stat_dec_dirty_dir(sbi)((sbi)->n_dirty_dirs--)
+#define stat_inc_dirty_file(sbi)   ((sbi)->n_dirty_files++)
+#define stat_dec_dirty_file(sbi)   ((sbi)->n_dirty_files--)
 #define stat_inc_total_hit(sbi)
(atomic64_inc(&(sbi)->total_hit_ext))
 #define stat_inc_rbtree_node_hit(sbi)  (atomic64_inc(&(sbi)->read_hit_rbtree))
 #define stat_inc_largest_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_largest))
@@ -2009,6 +2013,8 @@ void f2fs_destroy_root_stats(void);
 #define stat_inc_bggc_count(si)
 #define stat_inc_dirty_dir(sbi)
 #define stat_dec_dirty_dir(sbi)
+#define stat_inc_dirty_file(sbi)
+#define stat_dec_dirty_file(sbi)
 #define stat_inc_total_hit(sb)
 #define stat_inc_rbtree_node_hit(sb)
 #define stat_inc_largest_node_hit(sbi)
-- 
2.6.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/


[PATCH 5/8] f2fs: support data flush in checkpoint

2015-12-14 Thread Chao Yu
Previously, when finishing a checkpoint, we only keep consistency of all fs
meta info including meta inode, node inode, dentry page of directory inode,
so, after a sudden power cut, f2fs can recover from last checkpoint with
full directory structure.

But during checkpoint, we didn't flush dirty pages of regular and symlink
inode, so such dirty datas still in memory will be lost in that moment of
power off.

In order to reduce the chance of lost data, this patch tries to flush user
data before starting a checkpoint. So user's data written between two
checkpoint which may not be fsynced could be saved.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 11 +++
 fs/f2fs/f2fs.h   |  5 +
 2 files changed, 16 insertions(+)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index f33c4d7..217571f 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -849,6 +849,17 @@ static int block_operations(struct f2fs_sb_info *sbi)
 
blk_start_plug();
 
+retry_flush_datas:
+   /* write all the dirty data pages */
+   if (get_pages(sbi, F2FS_DIRTY_DATAS)) {
+   sync_dirty_inodes(sbi, FILE_INODE);
+   if (unlikely(f2fs_cp_error(sbi))) {
+   err = -EIO;
+   goto out;
+   }
+   goto retry_flush_datas;
+   }
+
 retry_flush_dents:
f2fs_lock_all(sbi);
/* write all the dirty dentry pages */
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d8bef3c..2477b2f5 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -648,6 +648,7 @@ struct f2fs_sm_info {
 enum count_type {
F2FS_WRITEBACK,
F2FS_DIRTY_DENTS,
+   F2FS_DIRTY_DATAS,
F2FS_DIRTY_NODES,
F2FS_DIRTY_META,
F2FS_INMEM_PAGES,
@@ -1068,6 +1069,8 @@ static inline void inode_inc_dirty_pages(struct inode 
*inode)
atomic_inc(_I(inode)->dirty_pages);
if (S_ISDIR(inode->i_mode))
inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS);
+   else
+   inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DATAS);
 }
 
 static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type)
@@ -1085,6 +1088,8 @@ static inline void inode_dec_dirty_pages(struct inode 
*inode)
 
if (S_ISDIR(inode->i_mode))
dec_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS);
+   else
+   dec_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DATAS);
 }
 
 static inline int get_pages(struct f2fs_sb_info *sbi, int count_type)
-- 
2.6.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/


[PATCH 4/8] f2fs: record dirty status of regular/symlink inode

2015-12-14 Thread Chao Yu
Maintain regular/symlink inode which has dirty pages in global dirty list
like the way of handling directory inode.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 66 ++--
 fs/f2fs/data.c   |  4 ++--
 fs/f2fs/dir.c|  2 +-
 fs/f2fs/f2fs.h   | 17 ++
 fs/f2fs/inode.c  |  2 +-
 fs/f2fs/super.c  |  6 +++--
 6 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index a4392f0..f33c4d7 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -722,53 +722,51 @@ fail_no_cp:
return -EINVAL;
 }
 
-static void __add_dirty_inode(struct inode *inode)
+static void __add_dirty_inode(struct inode *inode, enum inode_type type)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct f2fs_inode_info *fi = F2FS_I(inode);
+   int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE;
 
-   if (is_inode_flag_set(fi, FI_DIRTY_DIR))
+   if (is_inode_flag_set(fi, flag))
return;
 
-   set_inode_flag(fi, FI_DIRTY_DIR);
-   list_add_tail(>dirty_list, >dir_inode_list);
-   stat_inc_dirty_dir(sbi);
-   return;
+   set_inode_flag(fi, flag);
+   list_add_tail(>dirty_list, >inode_list[type]);
+   if (type == DIR_INODE)
+   stat_inc_dirty_dir(sbi);
 }
 
-static void __remove_dirty_inode(struct inode *inode)
+static void __remove_dirty_inode(struct inode *inode, enum inode_type type)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct f2fs_inode_info *fi = F2FS_I(inode);
+   int flag = (type == DIR_INODE) ? FI_DIRTY_DIR : FI_DIRTY_FILE;
 
if (get_dirty_pages(inode) ||
-   !is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR))
+   !is_inode_flag_set(F2FS_I(inode), flag))
return;
 
list_del_init(>dirty_list);
-   clear_inode_flag(fi, FI_DIRTY_DIR);
-   stat_dec_dirty_dir(sbi);
+   clear_inode_flag(fi, flag);
+   if (type == DIR_INODE)
+   stat_dec_dirty_dir(sbi);
 }
 
 void update_dirty_page(struct inode *inode, struct page *page)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+   enum inode_type type = S_ISDIR(inode->i_mode) ? DIR_INODE : FILE_INODE;
 
if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) &&
!S_ISLNK(inode->i_mode))
return;
 
-   if (!S_ISDIR(inode->i_mode)) {
-   inode_inc_dirty_pages(inode);
-   goto out;
-   }
-
-   spin_lock(>dir_inode_lock);
-   __add_dirty_inode(inode);
+   spin_lock(>inode_lock[type]);
+   __add_dirty_inode(inode, type);
inode_inc_dirty_pages(inode);
-   spin_unlock(>dir_inode_lock);
+   spin_unlock(>inode_lock[type]);
 
-out:
SetPagePrivate(page);
f2fs_trace_pid(page);
 }
@@ -777,22 +775,24 @@ void add_dirty_dir_inode(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 
-   spin_lock(>dir_inode_lock);
-   __add_dirty_inode(inode);
-   spin_unlock(>dir_inode_lock);
+   spin_lock(>inode_lock[DIR_INODE]);
+   __add_dirty_inode(inode, DIR_INODE);
+   spin_unlock(>inode_lock[DIR_INODE]);
 }
 
-void remove_dirty_dir_inode(struct inode *inode)
+void remove_dirty_inode(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct f2fs_inode_info *fi = F2FS_I(inode);
+   enum inode_type type = S_ISDIR(inode->i_mode) ? DIR_INODE : FILE_INODE;
 
-   if (!S_ISDIR(inode->i_mode))
+   if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) &&
+   !S_ISLNK(inode->i_mode))
return;
 
-   spin_lock(>dir_inode_lock);
-   __remove_dirty_inode(inode);
-   spin_unlock(>dir_inode_lock);
+   spin_lock(>inode_lock[type]);
+   __remove_dirty_inode(inode, type);
+   spin_unlock(>inode_lock[type]);
 
/* Only from the recovery routine */
if (is_inode_flag_set(fi, FI_DELAY_IPUT)) {
@@ -801,7 +801,7 @@ void remove_dirty_dir_inode(struct inode *inode)
}
 }
 
-void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi)
+void sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
 {
struct list_head *head;
struct inode *inode;
@@ -810,16 +810,16 @@ retry:
if (unlikely(f2fs_cp_error(sbi)))
return;
 
-   spin_lock(>dir_inode_lock);
+   spin_lock(>inode_lock[type]);
 
-   head = >dir_inode_list;
+   head = >inode_list[type];
if (list_empty(head)) {
-   spin_unlock(>dir_inode_lock);
+   spin_unlock(>inode_lock[type]);
return;
}
fi = list_entry(head->next, struct f2fs_inode_info, dirty_list);
inode = igrab(>vfs_inode);
-   spin_unlock(>dir_inode_lock);
+   spin_unlock(>inode_lock[type]);
if (inode) {

[Patch v2 1/3] soc: qcom: documentation: Update SMD/RPM Docs

2015-12-14 Thread Andy Gross
From: Andy Gross 

This patch moves the qcom,smd-rpm.txt to the correct location and splits
out the smd and rpm documentation.  In addition, a smd-rpm-regulator
document is added.

Signed-off-by: Andy Gross 
Acked-by: Bjorn Andersson 
---
 .../bindings/regulator/qcom,smd-rpm-regulator.txt  | 106 +++
 .../devicetree/bindings/soc/qcom,smd-rpm.txt   | 117 -
 .../devicetree/bindings/soc/qcom/qcom,smd-rpm.txt  |  58 ++
 3 files changed, 164 insertions(+), 117 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
 delete mode 100644 Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
new file mode 100644
index 000..bda2ed9
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
@@ -0,0 +1,106 @@
+QCOM SMD RPM REGULATOR
+
+The Qualcomm RPM over SMD regulator is modelled as a subdevice of the RPM.
+Because SMD is used as the communication transport mechanism, the RPM resides 
as
+a subnode of the SMD.  As such, the SMD-RPM regulator requires that the SMD and
+RPM nodes be present.
+
+Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt for
+information pertaining to the SMD node.
+
+Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt for
+information regarding the RPM node.
+
+== Regulator
+
+Regulator nodes are identified by their compatible:
+
+- compatible:
+   Usage: required
+   Value type: 
+   Definition: must be one of:
+   "qcom,rpm-pm8841-regulators"
+   "qcom,rpm-pm8941-regulators"
+
+- vdd_s1-supply:
+- vdd_s2-supply:
+- vdd_s3-supply:
+- vdd_s4-supply:
+- vdd_s5-supply:
+- vdd_s6-supply:
+- vdd_s7-supply:
+- vdd_s8-supply:
+   Usage: optional (pm8841 only)
+   Value type: 
+   Definition: reference to regulator supplying the input pin, as
+   described in the data sheet
+
+- vdd_s1-supply:
+- vdd_s2-supply:
+- vdd_s3-supply:
+- vdd_l1_l3-supply:
+- vdd_l2_lvs1_2_3-supply:
+- vdd_l4_l11-supply:
+- vdd_l5_l7-supply:
+- vdd_l6_l12_l14_l15-supply:
+- vdd_l8_l16_l18_l19-supply:
+- vdd_l9_l10_l17_l22-supply:
+- vdd_l13_l20_l23_l24-supply:
+- vdd_l21-supply:
+- vin_5vs-supply:
+   Usage: optional (pm8941 only)
+   Value type: 
+   Definition: reference to regulator supplying the input pin, as
+   described in the data sheet
+
+The regulator node houses sub-nodes for each regulator within the device. Each
+sub-node is identified using the node's name, with valid values listed for each
+of the pmics below.
+
+pm8841:
+   s1, s2, s3, s4, s5, s6, s7, s8
+
+pm8941:
+   s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
+   l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,
+   lvs3, 5vs1, 5vs2
+
+The content of each sub-node is defined by the standard binding for regulators 
-
+see regulator.txt.
+
+= EXAMPLE
+
+   smd {
+   compatible = "qcom,smd";
+
+   rpm {
+   interrupts = <0 168 1>;
+   qcom,ipc = < 8 0>;
+   qcom,smd-edge = <15>;
+
+   rpm_requests {
+   compatible = "qcom,rpm-msm8974";
+   qcom,smd-channels = "rpm_requests";
+
+   pm8941-regulators {
+   compatible = 
"qcom,rpm-pm8941-regulators";
+   vdd_l13_l20_l23_l24-supply = 
<_boost>;
+
+   pm8941_s3: s3 {
+   regulator-min-microvolt = 
<180>;
+   regulator-max-microvolt = 
<180>;
+   };
+
+   pm8941_boost: s4 {
+   regulator-min-microvolt = 
<500>;
+   regulator-max-microvolt = 
<500>;
+   };
+
+   pm8941_l20: l20 {
+   regulator-min-microvolt = 
<295>;
+   regulator-max-microvolt = 
<295>;
+   };
+   };
+   };
+   };
+   };
diff --git a/Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt 
b/Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt
deleted file mode 100644
index e27f5c4..000
--- a/Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt
+++ 

[Patch v2 3/3] regulator: qcom-smd: Add support for PMA8084

2015-12-14 Thread Andy Gross
From: Andy Gross 

This patch adds support and documentation for the PMA8084 regulators
found on APQ8084 platforms.

Signed-off-by: Andy Gross 
Acked-by: Bjorn Andersson 
---
 .../bindings/regulator/qcom,smd-rpm-regulator.txt  | 35 
 drivers/regulator/qcom_smd-regulator.c | 95 ++
 2 files changed, 130 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
index 82557e1..1f8d6f8 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
@@ -22,6 +22,7 @@ Regulator nodes are identified by their compatible:
"qcom,rpm-pm8841-regulators"
"qcom,rpm-pm8916-regulators"
"qcom,rpm-pm8941-regulators"
+   "qcom,rpm-pma8084-regulators"
 
 - vdd_s1-supply:
 - vdd_s2-supply:
@@ -67,6 +68,35 @@ Regulator nodes are identified by their compatible:
Definition: reference to regulator supplying the input pin, as
described in the data sheet
 
+- vdd_s1-supply:
+- vdd_s2-supply:
+- vdd_s3-supply:
+- vdd_s4-supply:
+- vdd_s5-supply:
+- vdd_s6-supply:
+- vdd_s7-supply:
+- vdd_s8-supply:
+- vdd_s9-supply:
+- vdd_s10-supply:
+- vdd_s11-supply:
+- vdd_s12-supply:
+- vdd_l1_l11-supply:
+- vdd_l2_l3_l4_l27-supply:
+- vdd_l5_l7-supply:
+- vdd_l6_l12_l14_l15_l26-supply:
+- vdd_l8-supply:
+- vdd_l9_l10_l13_l20_l23_l24-supply:
+- vdd_l16_l25-supply:
+- vdd_l17-supply:
+- vdd_l18-supply:
+- vdd_l19-supply:
+- vdd_l21-supply:
+- vdd_l22-supply:
+   Usage: optional (pma8084 only)
+   Value type: 
+   Definition: reference to regulator supplying the input pin, as
+   described in the data sheet
+
 The regulator node houses sub-nodes for each regulator within the device. Each
 sub-node is identified using the node's name, with valid values listed for each
 of the pmics below.
@@ -83,6 +113,11 @@ pm8941:
l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,
lvs3, 5vs1, 5vs2
 
+pma8084:
+   s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
+   l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20,
+   l21, l22, l23, l24, l25, l26, l27, lvs1, lvs2, lvs3, lvs4, 5vs1
+
 The content of each sub-node is defined by the standard binding for regulators 
-
 see regulator.txt.
 
diff --git a/drivers/regulator/qcom_smd-regulator.c 
b/drivers/regulator/qcom_smd-regulator.c
index 8464ead..56a17ec 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -153,6 +153,49 @@ static const struct regulator_ops rpm_switch_ops = {
.is_enabled = rpm_reg_is_enabled,
 };
 
+static const struct regulator_desc pma8084_hfsmps = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(375000,  0,  95, 12500),
+   REGULATOR_LINEAR_RANGE(155, 96, 158, 25000),
+   },
+   .n_linear_ranges = 2,
+   .n_voltages = 159,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pma8084_ftsmps = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(35,  0, 184, 5000),
+   REGULATOR_LINEAR_RANGE(70, 185, 339, 1),
+   },
+   .n_linear_ranges = 2,
+   .n_voltages = 340,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pma8084_pldo = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(75,  0,  30, 25000),
+   REGULATOR_LINEAR_RANGE(150, 31, 99, 5),
+   },
+   .n_linear_ranges = 2,
+   .n_voltages = 100,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pma8084_nldo = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(75, 0, 63, 12500),
+   },
+   .n_linear_ranges = 1,
+   .n_voltages = 64,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pma8084_switch = {
+   .ops = _switch_ops,
+};
+
 static const struct regulator_desc pm8x41_hfsmps = {
.linear_ranges = (struct regulator_linear_range[]) {
REGULATOR_LINEAR_RANGE( 375000,  0,  95, 12500),
@@ -335,10 +378,62 @@ static const struct rpm_regulator_data 
rpm_pm8941_regulators[] = {
{}
 };
 
+static const struct rpm_regulator_data rpm_pma8084_regulators[] = {
+   { "s1", QCOM_SMD_RPM_SMPA, 1, _ftsmps, "vdd_s1" },
+   { "s2", QCOM_SMD_RPM_SMPA, 2, _ftsmps, "vdd_s2" },
+   { "s3", QCOM_SMD_RPM_SMPA, 3, _hfsmps, "vdd_s3" },
+   { "s4", QCOM_SMD_RPM_SMPA, 4, _hfsmps, "vdd_s4" },
+   { "s5", QCOM_SMD_RPM_SMPA, 5, _hfsmps, "vdd_s5" },
+   { "s6", QCOM_SMD_RPM_SMPA, 6, _ftsmps, "vdd_s6" },
+ 

[PATCH 3/8] f2fs: introduce __remove_dirty_inode

2015-12-14 Thread Chao Yu
Introduce __remove_dirty_inode to clean up codes in remove_dirty_dir_inode.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 1aca402..a4392f0 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -736,6 +736,20 @@ static void __add_dirty_inode(struct inode *inode)
return;
 }
 
+static void __remove_dirty_inode(struct inode *inode)
+{
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+   struct f2fs_inode_info *fi = F2FS_I(inode);
+
+   if (get_dirty_pages(inode) ||
+   !is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR))
+   return;
+
+   list_del_init(>dirty_list);
+   clear_inode_flag(fi, FI_DIRTY_DIR);
+   stat_dec_dirty_dir(sbi);
+}
+
 void update_dirty_page(struct inode *inode, struct page *page)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
@@ -777,15 +791,7 @@ void remove_dirty_dir_inode(struct inode *inode)
return;
 
spin_lock(>dir_inode_lock);
-   if (get_dirty_pages(inode) ||
-   !is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR)) {
-   spin_unlock(>dir_inode_lock);
-   return;
-   }
-
-   list_del_init(>dirty_list);
-   clear_inode_flag(fi, FI_DIRTY_DIR);
-   stat_dec_dirty_dir(sbi);
+   __remove_dirty_inode(inode);
spin_unlock(>dir_inode_lock);
 
/* Only from the recovery routine */
-- 
2.6.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/


[Patch v2 2/3] regulator: qcom-smd: Add PM8916 support

2015-12-14 Thread Andy Gross
From: Andy Gross 

This patch adds support and documentation for the PM8916 regulators
found on MSM8916 platforms.

Acked-by: Bjorn Andersson 
Signed-off-by: Andy Gross 
---
 .../bindings/regulator/qcom,smd-rpm-regulator.txt  | 18 ++
 drivers/regulator/qcom_smd-regulator.c | 64 ++
 2 files changed, 82 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
index bda2ed9..82557e1 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
@@ -20,6 +20,7 @@ Regulator nodes are identified by their compatible:
Value type: 
Definition: must be one of:
"qcom,rpm-pm8841-regulators"
+   "qcom,rpm-pm8916-regulators"
"qcom,rpm-pm8941-regulators"
 
 - vdd_s1-supply:
@@ -38,6 +39,19 @@ Regulator nodes are identified by their compatible:
 - vdd_s1-supply:
 - vdd_s2-supply:
 - vdd_s3-supply:
+- vdd_s4-supply:
+- vdd_l1_l2_l3-supply:
+- vdd_l4_l5_l6-supply:
+- vdd_l7-supply:
+- vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18-supply:
+   Usage: optional (pm8916 only)
+   Value type: 
+   Definition: reference to regulator supplying the input pin, as
+   described in the data sheet
+
+- vdd_s1-supply:
+- vdd_s2-supply:
+- vdd_s3-supply:
 - vdd_l1_l3-supply:
 - vdd_l2_lvs1_2_3-supply:
 - vdd_l4_l11-supply:
@@ -60,6 +74,10 @@ of the pmics below.
 pm8841:
s1, s2, s3, s4, s5, s6, s7, s8
 
+pm8916:
+   s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
+   l14, l15, l16, l17, l18
+
 pm8941:
s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,
diff --git a/drivers/regulator/qcom_smd-regulator.c 
b/drivers/regulator/qcom_smd-regulator.c
index 6fa0c7d..8464ead 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -211,6 +211,43 @@ static const struct regulator_desc pm8941_switch = {
.ops = _switch_ops,
 };
 
+static const struct regulator_desc pm8916_pldo = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(75, 0, 208, 12500),
+   },
+   .n_linear_ranges = 1,
+   .n_voltages = 209,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pm8916_nldo = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(375000, 0, 93, 12500),
+   },
+   .n_linear_ranges = 1,
+   .n_voltages = 94,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pm8916_buck_lvo_smps = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(375000, 0, 95, 12500),
+   REGULATOR_LINEAR_RANGE(75, 96, 127, 25000),
+   },
+   .n_linear_ranges = 2,
+   .n_voltages = 128,
+   .ops = _smps_ldo_ops,
+};
+
+static const struct regulator_desc pm8916_buck_hvo_smps = {
+   .linear_ranges = (struct regulator_linear_range[]) {
+   REGULATOR_LINEAR_RANGE(155, 0, 31, 25000),
+   },
+   .n_linear_ranges = 1,
+   .n_voltages = 32,
+   .ops = _smps_ldo_ops,
+};
+
 struct rpm_regulator_data {
const char *name;
u32 type;
@@ -231,6 +268,32 @@ static const struct rpm_regulator_data 
rpm_pm8841_regulators[] = {
{}
 };
 
+static const struct rpm_regulator_data rpm_pm8916_regulators[] = {
+   { "s1", QCOM_SMD_RPM_SMPA, 1, _buck_lvo_smps, "vdd_s1" },
+   { "s2", QCOM_SMD_RPM_SMPA, 2, _buck_lvo_smps, "vdd_s2" },
+   { "s3", QCOM_SMD_RPM_SMPA, 3, _buck_lvo_smps, "vdd_s3" },
+   { "s4", QCOM_SMD_RPM_SMPA, 4, _buck_hvo_smps, "vdd_s4" },
+   { "l1", QCOM_SMD_RPM_LDOA, 1, _nldo, "vdd_l1_l2_l3" },
+   { "l2", QCOM_SMD_RPM_LDOA, 2, _nldo, "vdd_l1_l2_l3" },
+   { "l3", QCOM_SMD_RPM_LDOA, 3, _nldo, "vdd_l1_l2_l3" },
+   { "l4", QCOM_SMD_RPM_LDOA, 4, _pldo, "vdd_l4_l5_l6" },
+   { "l5", QCOM_SMD_RPM_LDOA, 5, _pldo, "vdd_l4_l5_l6" },
+   { "l6", QCOM_SMD_RPM_LDOA, 6, _pldo, "vdd_l4_l5_l6" },
+   { "l7", QCOM_SMD_RPM_LDOA, 7, _pldo, "vdd_l7" },
+   { "l8", QCOM_SMD_RPM_LDOA, 8, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18" },
+   { "l9", QCOM_SMD_RPM_LDOA, 9, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18" },
+   { "l10", QCOM_SMD_RPM_LDOA, 10, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"},
+   { "l11", QCOM_SMD_RPM_LDOA, 11, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"},
+   { "l12", QCOM_SMD_RPM_LDOA, 12, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"},
+   { "l13", QCOM_SMD_RPM_LDOA, 13, _pldo, 
"vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"},
+   { 

[PATCH 2/8] f2fs: introduce dirty list node in inode info

2015-12-14 Thread Chao Yu
Add a new dirt list node member in inode info for linking the inode to
global dirty list in superblock, instead of old implementation which
allocate slab cache memory as an entry to inode.

It avoids memory pressure due to slab cache allocation, and also makes
codes more clean.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 54 +---
 fs/f2fs/debug.c  |  1 -
 fs/f2fs/f2fs.h   | 10 ++
 fs/f2fs/super.c  |  1 +
 4 files changed, 20 insertions(+), 46 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index b839f5f..1aca402 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -722,25 +722,23 @@ fail_no_cp:
return -EINVAL;
 }
 
-static int __add_dirty_inode(struct inode *inode, struct inode_entry *new)
+static void __add_dirty_inode(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+   struct f2fs_inode_info *fi = F2FS_I(inode);
 
-   if (is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR))
-   return -EEXIST;
+   if (is_inode_flag_set(fi, FI_DIRTY_DIR))
+   return;
 
-   set_inode_flag(F2FS_I(inode), FI_DIRTY_DIR);
-   F2FS_I(inode)->dirty_dir = new;
-   list_add_tail(>list, >dir_inode_list);
+   set_inode_flag(fi, FI_DIRTY_DIR);
+   list_add_tail(>dirty_list, >dir_inode_list);
stat_inc_dirty_dir(sbi);
-   return 0;
+   return;
 }
 
 void update_dirty_page(struct inode *inode, struct page *page)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-   struct inode_entry *new;
-   int ret = 0;
 
if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) &&
!S_ISLNK(inode->i_mode))
@@ -751,17 +749,11 @@ void update_dirty_page(struct inode *inode, struct page 
*page)
goto out;
}
 
-   new = f2fs_kmem_cache_alloc(inode_entry_slab, GFP_NOFS);
-   new->inode = inode;
-   INIT_LIST_HEAD(>list);
-
spin_lock(>dir_inode_lock);
-   ret = __add_dirty_inode(inode, new);
+   __add_dirty_inode(inode);
inode_inc_dirty_pages(inode);
spin_unlock(>dir_inode_lock);
 
-   if (ret)
-   kmem_cache_free(inode_entry_slab, new);
 out:
SetPagePrivate(page);
f2fs_trace_pid(page);
@@ -770,25 +762,16 @@ out:
 void add_dirty_dir_inode(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-   struct inode_entry *new =
-   f2fs_kmem_cache_alloc(inode_entry_slab, GFP_NOFS);
-   int ret = 0;
-
-   new->inode = inode;
-   INIT_LIST_HEAD(>list);
 
spin_lock(>dir_inode_lock);
-   ret = __add_dirty_inode(inode, new);
+   __add_dirty_inode(inode);
spin_unlock(>dir_inode_lock);
-
-   if (ret)
-   kmem_cache_free(inode_entry_slab, new);
 }
 
 void remove_dirty_dir_inode(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-   struct inode_entry *entry;
+   struct f2fs_inode_info *fi = F2FS_I(inode);
 
if (!S_ISDIR(inode->i_mode))
return;
@@ -800,17 +783,14 @@ void remove_dirty_dir_inode(struct inode *inode)
return;
}
 
-   entry = F2FS_I(inode)->dirty_dir;
-   list_del(>list);
-   F2FS_I(inode)->dirty_dir = NULL;
-   clear_inode_flag(F2FS_I(inode), FI_DIRTY_DIR);
+   list_del_init(>dirty_list);
+   clear_inode_flag(fi, FI_DIRTY_DIR);
stat_dec_dirty_dir(sbi);
spin_unlock(>dir_inode_lock);
-   kmem_cache_free(inode_entry_slab, entry);
 
/* Only from the recovery routine */
-   if (is_inode_flag_set(F2FS_I(inode), FI_DELAY_IPUT)) {
-   clear_inode_flag(F2FS_I(inode), FI_DELAY_IPUT);
+   if (is_inode_flag_set(fi, FI_DELAY_IPUT)) {
+   clear_inode_flag(fi, FI_DELAY_IPUT);
iput(inode);
}
 }
@@ -818,8 +798,8 @@ void remove_dirty_dir_inode(struct inode *inode)
 void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi)
 {
struct list_head *head;
-   struct inode_entry *entry;
struct inode *inode;
+   struct f2fs_inode_info *fi;
 retry:
if (unlikely(f2fs_cp_error(sbi)))
return;
@@ -831,8 +811,8 @@ retry:
spin_unlock(>dir_inode_lock);
return;
}
-   entry = list_entry(head->next, struct inode_entry, list);
-   inode = igrab(entry->inode);
+   fi = list_entry(head->next, struct f2fs_inode_info, dirty_list);
+   inode = igrab(>vfs_inode);
spin_unlock(>dir_inode_lock);
if (inode) {
filemap_fdatawrite(inode->i_mapping);
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 8ce2fe3..f4a7b9e 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -189,7 +189,6 @@ get_cache:
si->cache_mem += NM_I(sbi)->dirty_nat_cnt *
sizeof(struct nat_entry_set);
si->cache_mem += 

Re: [PATCH v2] net/macb: add support for resetting PHY using GPIO

2015-12-14 Thread Florian Fainelli
On December 14, 2015 2:56:34 PM PST, Rob Herring  wrote:
>On Fri, Dec 11, 2015 at 11:34:53AM +0100, Gregory CLEMENT wrote:
>> With device tree it is no more possible to reset the PHY at board
>> level. Furthermore, doing in the driver allow to power down the PHY
>when
>> the network interface is no more used.
>> 
>> This reset can't be done at the PHY driver level. The PHY must be
>able to
>> answer the to the mii bus scan to let the kernel creating a PHY
>device.
>> 
>> The patch introduces a new optional property "phy-reset-gpios"
>inspired
>> from the one use for the FEC.
>> 
>> Signed-off-by: Gregory CLEMENT 
>> ---
>> 
>> Since the v1, I used the gpiod functions. It allows to simplify the
>> code and to not introduce any #ifdef.
>> 
>> I also rename the property in phy-reset-gpios, even if actually the
>> gpiod will match both phy-reset-gpios and phy-reset-gpio.
>> 
>> 
>>  Documentation/devicetree/bindings/net/macb.txt | 3 +++
>>  drivers/net/ethernet/cadence/macb.c| 8 
>>  drivers/net/ethernet/cadence/macb.h| 1 +
>>  3 files changed, 12 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/bindings/net/macb.txt
>b/Documentation/devicetree/bindings/net/macb.txt
>> index b5d7976..4a7fb6c 100644
>> --- a/Documentation/devicetree/bindings/net/macb.txt
>> +++ b/Documentation/devicetree/bindings/net/macb.txt
>> @@ -19,6 +19,9 @@ Required properties:
>>  Optional elements: 'tx_clk'
>>  - clocks: Phandles to input clocks.
>>  
>> +Optional properties:
>> +- phy-reset-gpios : Should specify the gpio for phy reset
>> +
>
>This alone is simple enough, but I worry that this doesn't really
>scale. 
>What if you need to enable clocks or regulators for the same reason?
>The 
>mmc folks did a pwrseq binding for similar reasons. I don't think I'd 
>recommend that here as I think it is kind of ugly. We really need a 
>pre-probe/scan hook for drivers. This is also needed for USB devices 
>mounted on boards.

In this particular case, the way Ethernet MAC drivers register their MDIO buses 
and therefore PHYs, there is always a good way to deassert the PHY GPIO line 
without requiring major core device driver changes. Worst case, there is the 
MDIO bus reset callback which could used for that matter.

In the case of PCI, USB etc. I do agree having a way to twiddle things before 
scanning/probing would be awesome. I have some boards here which have GPIO 
controlled regulator and hacking the RC driver to deal with that is 
suboptimal... 

>
>But I'm not going to hold up something simple to do all that, so:
>
>Acked-by: Rob Herring 
>
>___
>linux-arm-kernel mailing list
>linux-arm-ker...@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v2 0/3] Add support for APQ8084 and MSM8916 Regulators

2015-12-14 Thread Andy Gross
This patch set is a resend of part of the following series:

https://lkml.org/lkml/2015/9/24/561

This adds support for the PMA8084 regulators found on APQ8084 platforms
and the PM8916 regulators found on MSM8916 platforms.  This also adds in the
Documentation dependency required for the regulator patches.  This is a
standalone set of patches that can be taken as a whole.

Changes since v1:
- Added in Documentation dependency

Andy Gross (3):
  soc: qcom: documentation: Update SMD/RPM Docs
  regulator: qcom-smd: Add PM8916 support
  regulator: qcom-smd: Add support for PMA8084

 .../bindings/regulator/qcom,smd-rpm-regulator.txt  | 159 +
 .../devicetree/bindings/soc/qcom,smd-rpm.txt   | 117 ---
 .../devicetree/bindings/soc/qcom/qcom,smd-rpm.txt  |  58 
 drivers/regulator/qcom_smd-regulator.c | 159 +
 4 files changed, 376 insertions(+), 117 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
 delete mode 100644 Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt

-- 
1.9.1

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


[PATCH 1/8] f2fs: rename {add,remove,release}_dirty_inode to {add,remove,release}_ino_entry

2015-12-14 Thread Chao Yu
remove_dirty_dir_inode will be renamed to remove_dirty_inode as a generic
function in following patch for removing directory/regular/symlink inode
in global dirty list.

Here rename ino management related functions for readability, also in
order to avoid name conflict.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 8 
 fs/f2fs/f2fs.h   | 6 +++---
 fs/f2fs/file.c   | 4 ++--
 fs/f2fs/inode.c  | 4 ++--
 fs/f2fs/super.c  | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index f661d80..b839f5f 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -410,13 +410,13 @@ static void __remove_ino_entry(struct f2fs_sb_info *sbi, 
nid_t ino, int type)
spin_unlock(>ino_lock);
 }
 
-void add_dirty_inode(struct f2fs_sb_info *sbi, nid_t ino, int type)
+void add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type)
 {
/* add new dirty ino entry into list */
__add_ino_entry(sbi, ino, type);
 }
 
-void remove_dirty_inode(struct f2fs_sb_info *sbi, nid_t ino, int type)
+void remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type)
 {
/* remove dirty ino entry from list */
__remove_ino_entry(sbi, ino, type);
@@ -434,7 +434,7 @@ bool exist_written_data(struct f2fs_sb_info *sbi, nid_t 
ino, int mode)
return e ? true : false;
 }
 
-void release_dirty_inode(struct f2fs_sb_info *sbi)
+void release_ino_entry(struct f2fs_sb_info *sbi)
 {
struct ino_entry *e, *tmp;
int i;
@@ -1081,7 +1081,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, 
struct cp_control *cpc)
invalidate_mapping_pages(META_MAPPING(sbi), discard_blk,
discard_blk);
 
-   release_dirty_inode(sbi);
+   release_ino_entry(sbi);
 
if (unlikely(f2fs_cp_error(sbi)))
return;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 4d1587b..4be54e6 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1820,9 +1820,9 @@ bool is_valid_blkaddr(struct f2fs_sb_info *, block_t, 
int);
 int ra_meta_pages(struct f2fs_sb_info *, block_t, int, int, bool);
 void ra_meta_pages_cond(struct f2fs_sb_info *, pgoff_t);
 long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long);
-void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type);
-void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type);
-void release_dirty_inode(struct f2fs_sb_info *);
+void add_ino_entry(struct f2fs_sb_info *, nid_t, int type);
+void remove_ino_entry(struct f2fs_sb_info *, nid_t, int type);
+void release_ino_entry(struct f2fs_sb_info *);
 bool exist_written_data(struct f2fs_sb_info *, nid_t, int);
 int acquire_orphan_inode(struct f2fs_sb_info *);
 void release_orphan_inode(struct f2fs_sb_info *);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9949d0f..c6d909e 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -275,10 +275,10 @@ sync_nodes:
goto out;
 
/* once recovery info is written, don't need to tack this */
-   remove_dirty_inode(sbi, ino, APPEND_INO);
+   remove_ino_entry(sbi, ino, APPEND_INO);
clear_inode_flag(fi, FI_APPEND_WRITE);
 flush_out:
-   remove_dirty_inode(sbi, ino, UPDATE_INO);
+   remove_ino_entry(sbi, ino, UPDATE_INO);
clear_inode_flag(fi, FI_UPDATE_WRITE);
ret = f2fs_issue_flush(sbi);
 out:
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 97e20de..3d2fe59 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -357,9 +357,9 @@ no_delete:
if (xnid)
invalidate_mapping_pages(NODE_MAPPING(sbi), xnid, xnid);
if (is_inode_flag_set(fi, FI_APPEND_WRITE))
-   add_dirty_inode(sbi, inode->i_ino, APPEND_INO);
+   add_ino_entry(sbi, inode->i_ino, APPEND_INO);
if (is_inode_flag_set(fi, FI_UPDATE_WRITE))
-   add_dirty_inode(sbi, inode->i_ino, UPDATE_INO);
+   add_ino_entry(sbi, inode->i_ino, UPDATE_INO);
if (is_inode_flag_set(fi, FI_FREE_NID)) {
if (err && err != -ENOENT)
alloc_nid_done(sbi, inode->i_ino);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 2b1a324..f7e9384 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -553,7 +553,7 @@ static void f2fs_put_super(struct super_block *sb)
 * normally superblock is clean, so we need to release this.
 * In addition, EIO will skip do checkpoint, we need this as well.
 */
-   release_dirty_inode(sbi);
+   release_ino_entry(sbi);
release_discard_addrs(sbi);
 
f2fs_leave_shrinker(sbi);
-- 
2.6.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: [PATCH FIXED 3/3] staging: dgnc: Patch updates the TODO file

2015-12-14 Thread Sanidhya Solanki
Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/TODO | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
 * remove unnecessary comments
 * remove unnecessary error messages. Example kzalloc() has its
   own error message. Adding an extra one is useless.
-- 
2.5.0

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


Re: [PATCH FIXED 2/3] staging: dgnc: Patch for CamelCase fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the CamelCase fixes & Macro fixes that
checkpatch prompted for, as asked by the TODO.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_driver.c |  56 -
 drivers/staging/dgnc/dgnc_driver.h |  25 ++--
 drivers/staging/dgnc/dgnc_mgmt.c   |  28 ++---
 drivers/staging/dgnc/dgnc_neo.c| 226 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 134 +-
 drivers/staging/dgnc/dgnc_tty.c| 197 
 drivers/staging/dgnc/digi.h|  20 ++--
 7 files changed, 367 insertions(+), 319 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index fc6d298..37fb8f9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -48,7 +48,7 @@ static void   dgnc_do_remap(struct dgnc_board *brd);
 /*
  * File operations permitted on Control/Management major.
  */
-static const struct file_operations dgnc_BoardFops = {
+static const struct file_operations dgnc_board_fops = {
.owner  =   THIS_MODULE,
.unlocked_ioctl =   dgnc_mgmt_ioctl,
.open   =   dgnc_mgmt_open,
@@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = {
 /*
  * Globals
  */
-uint   dgnc_NumBoards;
-struct dgnc_board  *dgnc_Board[MAXBOARDS];
+uint   dgnc_num_boards;
+struct dgnc_board  *dgnc_board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
 DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
-uint   dgnc_Major;
+uint   dgnc_major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
 /*
@@ -92,7 +92,7 @@ struct board_id {
unsigned int is_pci_express;
 };
 
-static struct board_id dgnc_Ids[] = {
+static struct board_id dgnc_ids[] = {
{   PCI_DEVICE_CLASSIC_4_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_4_422_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_8_PCI_NAME,  8,  0   },
@@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void)
 
dgnc_remove_driver_sysfiles(_driver);
 
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
class_destroy(dgnc_class);
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
 
-   for (i = 0; i < dgnc_NumBoards; ++i) {
-   dgnc_remove_ports_sysfiles(dgnc_Board[i]);
-   dgnc_tty_uninit(dgnc_Board[i]);
-   dgnc_cleanup_board(dgnc_Board[i]);
+   for (i = 0; i < dgnc_num_boards; ++i) {
+   dgnc_remove_ports_sysfiles(dgnc_board[i]);
+   dgnc_tty_uninit(dgnc_board[i]);
+   dgnc_cleanup_board(dgnc_board[i]);
}
 
dgnc_tty_post_uninit();
 
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
 }
 
@@ -187,7 +187,7 @@ static int __init dgnc_init_module(void)
 */
if (rc < 0) {
/* Only unregister if it was actually registered. */
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
else
pr_warn("WARNING: dgnc driver load failed.  No Digi Neo 
or Classic boards found.\n");
@@ -222,12 +222,12 @@ static int dgnc_start(void)
 *
 * Register management/dpa devices
 */
-   rc = register_chrdev(0, "dgnc", _BoardFops);
+   rc = register_chrdev(0, "dgnc", _board_fops);
if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
return rc;
}
-   dgnc_Major = rc;
+   dgnc_major = rc;
 
dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
if (IS_ERR(dgnc_class)) {
@@ -237,7 +237,7 @@ static int dgnc_start(void)
}
 
dev = device_create(dgnc_class, NULL,
-   MKDEV(dgnc_Major, 0),
+   MKDEV(dgnc_major, 0),
NULL, "dgnc_mgmt");
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
@@ -267,11 +267,11 @@ static int dgnc_start(void)
return 0;
 
 failed_tty:
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
 failed_device:
class_destroy(dgnc_class);
 failed_class:
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
return rc;
 }
 
@@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
} else {
rc = dgnc_found_board(pdev, ent->driver_data);
if (rc == 0)
-   dgnc_NumBoards++;
+   dgnc_num_boards++;
}

Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the spacing fixes that checkpatch prompted for,
as asked by the TODO.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_cls.c|   4 +-
 drivers/staging/dgnc/dgnc_driver.h |   8 --
 drivers/staging/dgnc/dgnc_neo.c| 235 -
 drivers/staging/dgnc/dgnc_neo.h|  22 ++--
 drivers/staging/dgnc/dgnc_pci.h|   1 -
 drivers/staging/dgnc/dgnc_sysfs.c  |  18 ++-
 drivers/staging/dgnc/dgnc_tty.c|  46 +---
 drivers/staging/dgnc/digi.h|  32 ++---
 8 files changed, 223 insertions(+), 143 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 75040da..d312d35 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch)
/* Clear out UART and FIFO */
readb(>ch_cls_uart->txrx);
 
-   writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
-  >ch_cls_uart->isr_fcr);
+   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+  UART_FCR_CLEAR_XMIT), >ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
 #define   _POSIX_VDISABLE '\0'
 #endif
 
-
 /*
  * All the possible states the driver can be while being loaded.
  */
@@ -106,7 +105,6 @@ enum {
BOARD_READY
 };
 
-
 /*
  *
  * Structures and closely related defines.
@@ -145,7 +143,6 @@ struct board_ops {
  /
 #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */
 
-
 /*
  * Per-board information
  */
@@ -241,7 +238,6 @@ struct dgnc_board {
 
 };
 
-
 /
  * Unit flag definitions for un_flags.
  /
@@ -277,7 +273,6 @@ struct un_t {
struct device *un_sysfs;
 };
 
-
 /
  * Device flag definitions for ch_flags.
  /
@@ -300,7 +295,6 @@ struct un_t {
 #define CH_FORCED_STOP  0x2/* Output is forcibly stopped   
*/
 #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped
*/
 
-
 /* Our Read/Error/Write queue sizes */
 #define RQUEUEMASK 0x1FFF  /* 8 K - 1 */
 #define EQUEUEMASK 0x1FFF  /* 8 K - 1 */
@@ -309,7 +303,6 @@ struct un_t {
 #define EQUEUESIZE RQUEUESIZE
 #define WQUEUESIZE (WQUEUEMASK + 1)
 
-
 /
  * Channel information structure.
  /
@@ -397,7 +390,6 @@ struct channel_t {
ulong   ch_intr_tx; /* Count of interrupts */
ulong   ch_intr_rx; /* Count of interrupts */
 
-
/* /proc// entries */
struct proc_dir_entry *proc_entry_pointer;
struct dgnc_proc_entry *dgnc_channel_table;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = {
.send_immediate_char =  neo_send_immediate_char
 };
 
-static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 
0x80 };
+static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08,
+   0x10, 0x20, 0x40, 0x80 };
 
 /*
  * This function allows calls to ensure that all outstanding
@@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Becuz Exar's spec says we have to zero it out before setting it 
*/
+   /* Why? Becuz Exar's spec says we have to
+* zero it out before setting it.
+*/
writeb(0, >ch_neo_uart->efr);
 
/* Turn on UART enhanced bits */
writeb(efr, >ch_neo_uart->efr);
 
/* Turn on table D, with 8 char hi/low watermarks */
-   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), 
>ch_neo_uart->fctr);
+   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+  >ch_neo_uart->fctr);
 
/* Feed the UART our trigger levels */
writeb(8, >ch_neo_uart->tfifo);
@@ -144,13 +148,16 @@ static inline void neo_set_rts_flow_control(struct 
channel_t *ch)
ier &= 

Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Greg KH
On Mon, Dec 14, 2015 at 07:45:25PM -0500, Sanidhya Solanki wrote:
> Can you tell me what was incorrect about them?

The subjects are all wrong, go look at them...  PATCH twice?  1/3 for
every message? Same string for every message?

> I thought you requested the dgnc patches to be resent without the
> headers.

I did, but that doesn't mean you send incorrect ones :)

> There are 3 of them because Dan Carpenter asked my patch to be broken
> up so each one does only one thing. I also resent you the skein
> subsystem patches, as I did not hear anything from you for almost a
> week.

My queue of pending staging patches is over 1000 right now, they are
burried somewhere in there, be patient.

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] powerpc: Enable UBSAN support

2015-12-14 Thread Daniel Axtens
Michael Ellerman  writes:

> Hi Daniel,
>
> Great work thanks for getting this going.
>

> Have you tried running with KVM?
>
> I'm wondering if we should be excluding some of the KVM code that runs in 
> real mode, eg:
>
>   arch/powerpc/kvm/book3s_hv_rm_mmu.c
>   arch/powerpc/kvm/book3s_hv_rm_xics.c
>
> And maybe some other bits.
>
> Also the early setup code, a/p/k/setup*.c might be dicey.

My philosphy was just to copy the GCOV excludes, although you're right
that perhaps we want to be more aggressive in excluding here given that
the UBSAN handlers print a bunch of stuff. I'm happy to respin with
further exclusions - they're really easy to add.

> In all of the above it's probably OK unless you actually hit a warning at the
> wrong point, so testing will probably not find problems. Although I guess we
> could add some deliberatly incorrect code at certain points and check we
> survive the warning.

Yep. I'll run a kvm guest on an instrumented kernel and let you know
what happens!

>
> Is there an easy way to spot the calls to UBSAN in the generated code?

Yes - because of the handler functions, they're *really* easy to spot.
Here's some assembly for GregorianDay():


c002924c:   6d 26 7e 48 bl  c080b8b8 
<__ubsan_handle_mul_overflow+0x8>
c0029250:   00 00 00 60 nop
c0029254:   38 fe ff 4b b   c002908c 

c0029258:   8c ff 62 3c addis   r3,r2,-116
c002925c:   01 00 a0 38 li  r5,1
c0029260:   78 db 64 7f mr  r4,r27
c0029264:   50 9c 63 38 addir3,r3,-25520
c0029268:   41 26 7e 48 bl  c080b8a8 
<__ubsan_handle_sub_overflow+0x8>
c002926c:   00 00 00 60 nop
c0029270:   44 fe ff 4b b   c00290b4 

c0029274:   8c ff 62 3c addis   r3,r2,-116
c0029278:   78 d3 45 7f mr  r5,r26
c002927c:   e0 9c 63 38 addir3,r3,-25376
c0029280:   19 26 7e 48 bl  c080b898 
<__ubsan_handle_add_overflow+0x8>
c0029284:   00 00 00 60 nop
c0029288:   94 fe ff 4b b   c002911c 

c002928c:   8c ff 62 3c addis   r3,r2,-116
c0029290:   78 f3 c4 7f mr  r4,r30
c0029294:   68 9c 63 38 addir3,r3,-25496
c0029298:   b1 21 7e 48 bl  c080b448 
<__ubsan_handle_out_of_bounds+0x8>
c002929c:   00 00 00 60 nop
c00292a0:   20 fe ff 4b b   c00290c0 

c00292a4:   14 4a 24 7d add r9,r4,r9
c00292a8:   40 48 a4 7f cmpld   cr7,r4,r9
c00292ac:   2c fe fd 41 bgt+cr7,c00290d8 


You can see that there are lots of calls to __ubsan_handle_blah_blah
inserted.

Regards,
Daniel

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


signature.asc
Description: PGP signature


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

2015-12-14 Thread Vincent Guittot
On 14 December 2015 at 22:12, Luca Abeni  wrote:
> On Mon, 14 Dec 2015 16:56:17 +0100
> Vincent Guittot  wrote:
> [...]
>> >> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> >> index 08858d1..e44c6be 100644
>> >> --- a/kernel/sched/sched.h
>> >> +++ b/kernel/sched/sched.h
>> >> @@ -519,6 +519,8 @@ struct dl_rq {
>> >>  #else
>> >>   struct dl_bw dl_bw;
>> >>  #endif
>> >> + /* This is the "average utilization" for this runqueue */
>> >> + s64 avg_bw;
>> >>  };
>> >
>> > So I don't think this is right. AFAICT this projects the WCET as the
>> > amount of time actually used by DL. This will, under many
>> > circumstances, vastly overestimate the amount of time actually
>> > spend on it. Therefore unduly pessimisme the fair capacity of this
>> > CPU.
>>
>> I agree that if the WCET is far from reality, we will underestimate
>> available capacity for CFS. Have you got some use case in mind which
>> overestimates the WCET ?
>> If we can't rely on this parameters to evaluate the amount of capacity
>> used by deadline scheduler on a core, this will imply that we can't
>> also use it for requesting capacity to cpufreq and we should fallback
>> on a monitoring mechanism which reacts to a change instead of
>> anticipating it.
> I think a more "theoretically sound" approach would be to track the
> _active_ utilisation (informally speaking, the sum of the utilisations
> of the tasks that are actually active on a core - the exact definition
> of "active" is the trick here).

The point is that we probably need 2 definitions of "active" tasks.
The 1st one would be used to scale the frequency. From a power saving
point of view, it have to reflect the minimum frequency needed at the
current time to handle all works without missing deadline. This one
should be updated quite often with the wake up and the sleep of tasks
as well as the throttling.
The 2nd definition is used to compute the remaining capacity for the
CFS scheduler. This one doesn't need to be updated at each wake/sleep
of a deadline task but should reflect the capacity used by deadline in
a larger time scale. The latter will be used by the CFS scheduler  at
the periodic load balance pace

> As done, for example, here:
> https://github.com/lucabe72/linux-reclaiming/tree/track-utilisation-v2
> (in particular, see
> https://github.com/lucabe72/linux-reclaiming/commit/49fc786a1c453148625f064fa38ea538470df55b
> )
> I understand this approach might look too complex... But I think it is
> much less pessimistic while still being "safe".
> If there is something that I can do to make that code more acceptable,
> let me know.
>
>
> Luca
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Fix INT1 Exception with unregistered breakpoints

2015-12-14 Thread Jeff Merkey
On 12/14/15, H. Peter Anvin  wrote:
> On December 14, 2015 4:49:51 PM PST, Jeff Merkey 
> wrote:
>>On 12/14/15, Jeff Merkey  wrote:
>>> Please consider the attached patch.
>>>
>>> SUMMARY
>>>
>>> This patch corrects a hard lockup failure of the system kernel if the
>>> operating system receives a breakpoint exception at a code execution
>>> address which was not registered with the operating system.  The
>>patch
>>> allows kernel debuggers, application profiling and performance
>>modules,
>>> and external debugging tools to work better together at sharing the
>>> breakpoint registers on the platform in a way that they do not cause
>>> errors and system faults, and enables the full feature set in the
>>> breakpoint API.  If a kernel application triggers a breakpoint
>>> or programs one in error, this patch will catch the condition and
>>report
>>> it to the system log without the operating system experiencing a
>>system
>>> fault.  There are several consumers of the Linux Breakpoint API and
>>all
>>> of them can and sometimes do cause the condition this patch corrects.
>>>
>>
>>Peter,
>>
>>Is that the type of summary that meets the standards.  I tried to be
>>concise.
>>
>>Jeff
>
> It would be good if you could be a bit more precise.  In particular, explain
> how and why the condition can appear rather than just explain that it can.
> --
> Sent from my Android device with K-9 Mail. Please excuse brevity and
> formatting.
>

Yes sir.  I'll be more concise and re-submit

Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/8 v5] enable to use thermal-zone on r8a7790/1

2015-12-14 Thread Simon Horman
On Tue, Dec 15, 2015 at 01:16:20AM +, Kuninori Morimoto wrote:
> 
> Hi
> 
> These are v5 of thermal-zone support for r8a7790/r8a7791.
> 
> Kuninori Morimoto (8):
>   1) thermal: rcar: move rcar_thermal_dt_ids to upside
>   2) thermal: rcar: check every rcar_thermal_update_temp() return value
>   3) thermal: rcar: check irq possibility in rcar_thermal_irq_xxx()
>   4) thermal: rcar: rcar_thermal_get_temp() return error if strange temp
>   5) thermal: rcar: enable to use thermal-zone on DT
>   6) ARM: shmobile: r8a7790: enable to use thermal-zone
>   7) ARM: shmobile: r8a7791: enable to use thermal-zone
>   8) thermal: of-thermal: of_thermal_set_trip_temp() call 
> thermal_zone_device_update()

I have marked patches 6 and 7 as deferred pending acceptance of the driver
changes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Fix INT1 Exception with unregistered breakpoints

2015-12-14 Thread H. Peter Anvin
On December 14, 2015 4:49:51 PM PST, Jeff Merkey  wrote:
>On 12/14/15, Jeff Merkey  wrote:
>> Please consider the attached patch.
>>
>> SUMMARY
>>
>> This patch corrects a hard lockup failure of the system kernel if the
>> operating system receives a breakpoint exception at a code execution
>> address which was not registered with the operating system.  The
>patch
>> allows kernel debuggers, application profiling and performance
>modules,
>> and external debugging tools to work better together at sharing the
>> breakpoint registers on the platform in a way that they do not cause
>> errors and system faults, and enables the full feature set in the
>> breakpoint API.  If a kernel application triggers a breakpoint
>> or programs one in error, this patch will catch the condition and
>report
>> it to the system log without the operating system experiencing a
>system
>> fault.  There are several consumers of the Linux Breakpoint API and
>all
>> of them can and sometimes do cause the condition this patch corrects.
>>
>
>Peter,
>
>Is that the type of summary that meets the standards.  I tried to be
>concise.
>
>Jeff

It would be good if you could be a bit more precise.  In particular, explain 
how and why the condition can appear rather than just explain that it can.
-- 
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Can you tell me what was incorrect about them?
I thought you requested the dgnc patches to be resent without the
headers.
There are 3 of them because Dan Carpenter asked my patch to be broken
up so each one does only one thing. I also resent you the skein
subsystem patches, as I did not hear anything from you for almost a
week.
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] 82xx: FCC: Fixing a bug causing to FCC port lock-up

2015-12-14 Thread Martin Roth
The patch fixes FCC port lock-up, which occurs as a result of a bug
during underrun/collision handling. Within the tx_startup() function
in mac-fcc.c, the address of last BD is not calculated correctly.
As a result of wrong calculation of the last BD address, the next
transmitted BD may be set to an area out of the transmit BD ring.
This actually causes to port lock-up and it is not recoverable.

Signed-off-by: Martin Roth 
---
 drivers/net/ethernet/freescale/fs_enet/mac-fcc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c 
b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
index 08f5b91..52e0091 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
@@ -552,7 +552,7 @@ static void tx_restart(struct net_device *dev)
cbd_t __iomem *prev_bd;
cbd_t __iomem *last_tx_bd;
 
-   last_tx_bd = fep->tx_bd_base + (fpi->tx_ring * sizeof(cbd_t));
+   last_tx_bd = fep->tx_bd_base + ((fpi->tx_ring - 1) * sizeof(cbd_t));
 
/* get the current bd held in TBPTR  and scan back from this point */
recheck_bd = curr_tbptr = (cbd_t __iomem *)
-- 
1.7.9.5

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


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

2015-12-14 Thread Vincent Guittot
On 14 December 2015 at 17:51, Peter Zijlstra  wrote:
> On Mon, Dec 14, 2015 at 04:56:17PM +0100, Vincent Guittot wrote:
>> I agree that if the WCET is far from reality, we will underestimate
>> available capacity for CFS. Have you got some use case in mind which
>> overestimates the WCET ?
>
> Pretty much any 'correct' WCET is pessimistic. There's heaps of smart
> people working on improving WCET bounds, but they're still out there.
> This is mostly because of the .1% tail cases that 'never' happen but
> would make your tokamak burn a hole just when you're outside.
>
>> If we can't rely on this parameters to evaluate the amount of capacity
>> used by deadline scheduler on a core, this will imply that we can't
>> also use it for requesting capacity to cpufreq and we should fallback
>> on a monitoring mechanism which reacts to a change instead of
>> anticipating it.
>
> No, since the WCET can and _will_ happen, its the best you can do with
> cpufreq. If you were to set it lower you could not be able to execute
> correctly in your 'never' tail cases.

In the context of frequency scaling, This mean that we will never
reach low frequency


>
> There 'might' be smart pants ways around this, where you run part of the
> execution at lower speed and switch to a higher speed to 'catch' up if
> you exceed some boundary, such that, on average, you run at the same
> speed the WCET mandates, but I'm not sure that's worth it. Juri/Luca
> might know.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cris: debugport: Fix section mismatches

2015-12-14 Thread Guenter Roeck

On 11/10/2015 02:04 PM, Guenter Roeck wrote:

Section mismatches can now cause build failures, such as for
cris:allnoconfig. Rename affected variables to end with _console
to make section mismatch checks happy.

Signed-off-by: Guenter Roeck 


ping ...

cris:allnoconfig still fails to build in mainline.

Should I drop the build from my tests ?

Thanks,
Guenter


---
  arch/cris/arch-v10/kernel/debugport.c | 22 +++---
  1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/debugport.c 
b/arch/cris/arch-v10/kernel/debugport.c
index 7d307cce8bd8..b6549e54be29 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -468,7 +468,7 @@ etrax_console_device(struct console* co, int *index)
  #endif
  }

-static struct console sercons = {
+static struct console ser_console = {
name : "ttyS",
write: console_write,
read : NULL,
@@ -480,7 +480,7 @@ static struct console sercons = {
cflag : 0,
next : NULL
  };
-static struct console sercons0 = {
+static struct console ser0_console = {
name : "ttyS",
write: console_write,
read : NULL,
@@ -493,7 +493,7 @@ static struct console sercons0 = {
next : NULL
  };

-static struct console sercons1 = {
+static struct console ser1_console = {
name : "ttyS",
write: console_write,
read : NULL,
@@ -505,7 +505,7 @@ static struct console sercons1 = {
cflag : 0,
next : NULL
  };
-static struct console sercons2 = {
+static struct console ser2_console = {
name : "ttyS",
write: console_write,
read : NULL,
@@ -517,7 +517,7 @@ static struct console sercons2 = {
cflag : 0,
next : NULL
  };
-static struct console sercons3 = {
+static struct console ser3_console = {
name : "ttyS",
write: console_write,
read : NULL,
@@ -539,17 +539,17 @@ init_etrax_debug(void)
static int first = 1;

if (!first) {
-   unregister_console();
-   register_console();
-   register_console();
-   register_console();
-   register_console();
+   unregister_console(_console);
+   register_console(_console);
+   register_console(_console);
+   register_console(_console);
+   register_console(_console);
  init_dummy_console();
return 0;
}

first = 0;
-   register_console();
+   register_console(_console);
start_port(port);
  #ifdef CONFIG_ETRAX_KGDB
start_port(kgdb_port);



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: FW: Commit 81a43adae3b9 (locking/mutex: Use acquire/release semantics) causing failures on arm64 (ThunderX)

2015-12-14 Thread Paul E. McKenney
On Mon, Dec 14, 2015 at 09:28:55PM +0100, Peter Zijlstra wrote:
> On Fri, Dec 11, 2015 at 02:35:40PM -0800, Paul E. McKenney wrote:
> > On Fri, Dec 11, 2015 at 02:48:03PM +0100, Peter Zijlstra wrote:
> > > On Fri, Dec 11, 2015 at 01:33:14PM +, Will Deacon wrote:
> > > > On Fri, Dec 11, 2015 at 01:26:47PM +0100, Peter Zijlstra wrote:
> > > 
> > > > > While we're there, the acquire in osq_wait_next() seems somewhat ill
> > > > > documented too.
> > > > > 
> > > > > I _think_ we need ACQUIRE semantics there because we want to strictly
> > > > > order the lock-unqueue A,B,C steps and we get that with:
> > > > > 
> > > > >  A: SC
> > > > >  B: ACQ
> > > > >  C: Relaxed
> > > > > 
> > > > > Similarly for unlock we want the WRITE_ONCE to happen after
> > > > > osq_wait_next, but in that case we can even rely on the control
> > > > > dependency there.
> > > > 
> > > > Even for the lock-unqueue case, isn't B->C ordered by a control 
> > > > dependency
> > > > because C consists only of stores?
> > > 
> > > Hmm, indeed. So we could go fully relaxed on it I suppose, since the
> > > same is true for the unlock site.
> > 
> > I am probably missing quite a bit on this thread, but don't x86 MMIO
> > accesses to frame buffers need to interact with something more heavyweight
> > than an x86 release store or acquire load in order to remain confined
> > to the resulting critical section?
> 
> So on x86 there really isn't a problem because every atomic op (and
> there's plenty here) will be a full barrier.
> 
> That is, even if you were to replace everything with _relaxed() ops, it
> would still work as 'expected' on x86.
> 
> ppc/arm64 will crash and burn, but that's another story.
> 
> But the important point here was that osq_wait_next() is never relied
> upon to provide either the ACQUIRE semantics for osq_lock() not the
> RELEASE semantics for osq_unlock(). Those are provided by other ops.

OK, good to know!

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] powerpc: Enable UBSAN support

2015-12-14 Thread Michael Ellerman
Hi Daniel,

Great work thanks for getting this going.

On Tue, 2015-12-15 at 14:46 +1100, Daniel Axtens wrote:

> This hooks up UBSAN support for PowerPC.
> 
> So far it's found some interesting cases where we don't properly sanitise
> input to shifts, including one in our futex handling. It's also found an
> out of bounds read in an array. Nothing critical, but worth fixing.
> 
> Tested-by: Andrew Donnellan 
> CC: Andrey Ryabinin 
> Signed-off-by: Daniel Axtens 
> ---
> 
> RFC -> v1:
>  - Update patch to use fixed spelling of SANITIZE.
>  - Include tested by tag from Andrew - Thanks!
> 
> This applies on top of next with Andrey's patches:
>  1) https://patchwork.kernel.org/patch/7761341/
>  2) https://patchwork.kernel.org/patch/7761351/
>  3) https://patchwork.kernel.org/patch/7761361/
>  4) https://patchwork.kernel.org/patch/7785791/
>  5) https://patchwork.kernel.org/patch/7819661/
> 
> -mm and therefore -next have these patches, and the RFC of this
> patch.
> 
> This has now been tested on LE and BE 64bit, on pseries, bml and
> PowerNV.


Have you tried running with KVM?

I'm wondering if we should be excluding some of the KVM code that runs in real 
mode, eg:

  arch/powerpc/kvm/book3s_hv_rm_mmu.c
  arch/powerpc/kvm/book3s_hv_rm_xics.c

And maybe some other bits.

Also the early setup code, a/p/k/setup*.c might be dicey.

In all of the above it's probably OK unless you actually hit a warning at the
wrong point, so testing will probably not find problems. Although I guess we
could add some deliberatly incorrect code at certain points and check we
survive the warning.

Is there an easy way to spot the calls to UBSAN in the generated code?

cheers

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


Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Greg KH
On Mon, Dec 14, 2015 at 07:03:31PM -0500, Sanidhya Solanki wrote:
> Patch updates the TODO file.
> 
> Signed-off-by: Sanidhya Solanki 
> ---
>  drivers/staging/dgnc/TODO | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
> index 0e0825b..0bdfd26 100644
> --- a/drivers/staging/dgnc/TODO
> +++ b/drivers/staging/dgnc/TODO
> @@ -1,4 +1,3 @@
> -* checkpatch fixes
>  * remove unnecessary comments
>  * remove unnecessary error messages. Example kzalloc() has its
>own error message. Adding an extra one is useless.
> -- 
> 2.5.0

You sent me 3 patches, all with the same Subject: line, and all of them
incorrect, so I've dropped them all :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] perf tests: Fix false TEST_OK result for 'perf test hist'

2015-12-14 Thread Wang Nan
Commit 71d6de64feddd4b45326fba2111b3006d9e0 ('perf test: Fix hist
testcases when kptr_restrict is on') solves a double free problem when
'perf test hist' calling setup_fake_machine(). However, the result is
still incorrect. For example:

 $ ./perf test -v 'filtering hist entries'
 25: Test filtering hist entries  :
 --- start ---
 test child forked, pid 4186
 Cannot create kernel maps
 test child finished with 0
  end 
 Test filtering hist entries: Ok

In this case the body of this test is not get executed at all, but the
result is 'Ok'. I think 'Skip' should be better.

The reason is that *ALL* hists test cases forget to reset err after
using it to hold an error code.

This patch ensure err is reset.

In case when kptr_restrict prevent normal user get kernel address, this
test should be skipped, not fail. This patch uses linux/err.h to store
error code in return value of setup_fake_machine(), and let 'EACCES' to
indicate this problem.

Signed-off-by: Wang Nan 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
---
 tools/perf/tests/hists_common.c   | 12 +---
 tools/perf/tests/hists_common.h   |  1 +
 tools/perf/tests/hists_cumulate.c |  6 +-
 tools/perf/tests/hists_filter.c   |  6 +-
 tools/perf/tests/hists_link.c |  6 +-
 tools/perf/tests/hists_output.c   |  6 +-
 6 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index bcfd081..2eca1b2 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -81,15 +81,20 @@ struct machine *setup_fake_machine(struct machines 
*machines)
 {
struct machine *machine = machines__find(machines, HOST_KERNEL_ID);
size_t i;
+   int err = -ENOMEM;
 
if (machine == NULL) {
pr_debug("Not enough memory for machine setup\n");
-   return NULL;
+   return ERR_PTR(-ENOMEM);
}
 
if (machine__create_kernel_maps(machine)) {
pr_debug("Cannot create kernel maps\n");
-   return NULL;
+   if (symbol_conf.kptr_restrict) {
+   pr_debug("Hint: Check 
/proc/sys/kernel/kptr_restrict.\n");
+   err = -EACCES;
+   }
+   return ERR_PTR(err);
}
 
for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
@@ -155,7 +160,8 @@ struct machine *setup_fake_machine(struct machines 
*machines)
 out:
pr_debug("Not enough memory for machine setup\n");
machine__delete_threads(machine);
-   return NULL;
+   machine__exit(machine);
+   return ERR_PTR(err);
 }
 
 void print_hists_in(struct hists *hists)
diff --git a/tools/perf/tests/hists_common.h b/tools/perf/tests/hists_common.h
index 888254e..0252eae 100644
--- a/tools/perf/tests/hists_common.h
+++ b/tools/perf/tests/hists_common.h
@@ -1,5 +1,6 @@
 #ifndef __PERF_TESTS__HISTS_COMMON_H__
 #define __PERF_TESTS__HISTS_COMMON_H__
+#include 
 
 struct machine;
 struct machines;
diff --git a/tools/perf/tests/hists_cumulate.c 
b/tools/perf/tests/hists_cumulate.c
index 8292948..c211075 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -706,13 +706,17 @@ int test__hists_cumulate(int subtest __maybe_unused)
err = parse_events(evlist, "cpu-clock", NULL);
if (err)
goto out;
+   err = TEST_FAIL;
 
machines__init();
 
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine();
-   if (!machine)
+   if (IS_ERR(machine)) {
+   if (PTR_ERR(machine) == -EACCES)
+   err = TEST_SKIP;
goto out;
+   }
 
if (verbose > 1)
machine__fprintf(machine, stderr);
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index ccb5b49..795a04d 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused)
err = parse_events(evlist, "task-clock", NULL);
if (err)
goto out;
+   err = TEST_FAIL;
 
/* default sort order (comm,dso,sym) will be used */
if (setup_sorting() < 0)
@@ -129,8 +130,11 @@ int test__hists_filter(int subtest __maybe_unused)
 
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine();
-   if (!machine)
+   if (IS_ERR(machine)) {
+   if (PTR_ERR(machine) == -EACCES)
+   err = TEST_SKIP;
goto out;
+   }
 
if (verbose > 1)
machine__fprintf(machine, stderr);
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 6243e2b..f5f37ef9 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -293,6 +293,7 @@ int test__hists_link(int subtest 

Re: WARNING in crypto_wait_for_test

2015-12-14 Thread Herbert Xu
On Mon, Dec 14, 2015 at 11:45:02PM +0100, Stephan Mueller wrote:
>
> But with the given code, when you remove the bogus mask setting (which in 
> turn 
> leaves it as 0), the code works flawless.

Please find out exactly why this would be triggering the warning
because your previous explanation of not being able to find the
algorithm due to the mask does not make sense.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V

2015-12-14 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Monday, December 14, 2015 7:08 PM
> To: KY Srinivasan 
> Cc: linux-kernel@vger.kernel.org; de...@linuxdriverproject.org;
> o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com;
> jasow...@redhat.com; Jake Oshins 
> Subject: Re: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a
> hypercall on Hyper-V
> 
> On Mon, Dec 14, 2015 at 04:01:40PM -0800, K. Y. Srinivasan wrote:
> > From: Jake Oshins 
> >
> > This patch exposes the function that hv_vmbus.ko uses to make hypercalls.
> This
> > is necessary for retargeting an interrupt when it is given a new affinity.
> >
> > Since we are exporting this API, rename the API as it will be visible 
> > outside
> > the hv.c file.
> >
> > Signed-off-by: Jake Oshins 
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> >  drivers/hv/hv.c   |   20 ++--
> >  drivers/hv/hyperv_vmbus.h |2 +-
> >  include/linux/hyperv.h|1 +
> >  3 files changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> > index 6341be8..7a06933 100644
> > --- a/drivers/hv/hv.c
> > +++ b/drivers/hv/hv.c
> > @@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
> >  }
> >
> >  /*
> > - * do_hypercall- Invoke the specified hypercall
> > + * hv_do_hypercall- Invoke the specified hypercall
> >   */
> > -static u64 do_hypercall(u64 control, void *input, void *output)
> > +u64 hv_do_hypercall(u64 control, void *input, void *output)
> >  {
> > u64 input_address = (input) ? virt_to_phys(input) : 0;
> > u64 output_address = (output) ? virt_to_phys(output) : 0;
> > @@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,
> void *output)
> > return hv_status_lo | ((u64)hv_status_hi << 32);
> >  #endif /* !x86_64 */
> >  }
> > +EXPORT_SYMBOL_GPL(hv_do_hypercall);
> >
> >  #ifdef CONFIG_X86_64
> >  static cycle_t read_hv_clock_tsc(struct clocksource *arg)
> > @@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id
> connection_id,
> >  {
> >
> > struct hv_input_post_message *aligned_msg;
> > -   u16 status;
> > +   u64 status;
> >
> > if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
> > return -EMSGSIZE;
> > @@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id
> connection_id,
> > aligned_msg->payload_size = payload_size;
> > memcpy((void *)aligned_msg->payload, payload, payload_size);
> >
> > -   status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
> > -   & 0x;
> > +   status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,
> NULL);
> >
> > put_cpu();
> > -   return status;
> > +   return status & 0x;
> >  }
> >
> >
> > @@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id
> connection_id,
> >   *
> >   * This involves a hypercall.
> >   */
> > -u16 hv_signal_event(void *con_id)
> > +int hv_signal_event(void *con_id)
> >  {
> > -   u16 status;
> > +   u64 status;
> >
> > -   status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &
> 0x);
> > +   status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL);
> >
> > -   return status;
> > +   return status & 0x;
> 
> This "feels" odd, as the return value isn't the traditional 0 or -ERROR,
> right?  Why are you masking off the top bits?
> 
> And, no one ever does anything with the return value of
> hv_signal_event(), so why have it return anything anyway?
> 
> I'll take this, but please fix up the area, it's messy...

Thanks Greg. Will do.

K. Y
> 
> 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: Skein: Moved macros from skein_block.c to header file.

2015-12-14 Thread Sanidhya Solanki
The original code defined macros in the source code, making it
harder to read. Moved them to the header file, as per the TODO file.

Updated the TODO file.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/skein/TODO  | 1 -
 drivers/staging/skein/skein_block.c | 6 --
 drivers/staging/skein/skein_block.h | 7 +++
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO
index cd3508d..e3de0c7 100644
--- a/drivers/staging/skein/TODO
+++ b/drivers/staging/skein/TODO
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - move macros into appropriate header files
  - add / pass test vectors
  - module support
 
diff --git a/drivers/staging/skein/skein_block.c 
b/drivers/staging/skein/skein_block.c
index 45b4732..2120392 100644
--- a/drivers/staging/skein/skein_block.c
+++ b/drivers/staging/skein/skein_block.c
@@ -26,12 +26,6 @@
 #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */
 #endif
 
-#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */
-#define KW_TWK_BASE (0)
-#define KW_KEY_BASE (3)
-#define ks  (kw + KW_KEY_BASE)
-#define ts  (kw + KW_TWK_BASE)
-
 #ifdef SKEIN_DEBUG
 #define debug_save_tweak(ctx)   \
 {   \
diff --git a/drivers/staging/skein/skein_block.h 
b/drivers/staging/skein/skein_block.h
index 9d40f4a..0fd4bfe 100644
--- a/drivers/staging/skein/skein_block.h
+++ b/drivers/staging/skein/skein_block.h
@@ -7,6 +7,13 @@
 ** This algorithm and source code is released to the public domain.
 **
 /
+
+#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */
+#define KW_TWK_BASE (0)
+#define KW_KEY_BASE (3)
+#define ks  (kw + KW_KEY_BASE)
+#define ts  (kw + KW_TWK_BASE)
+
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
-- 
2.5.0

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


Re: [lkp] [f2fs] 9f88450ff1: stderr.mount:wrong_fs_type,bad_option,bad_superblock_on/dev/sda3

2015-12-14 Thread Huang, Ying
Chao Yu  writes:

> Hi Ying Huang,
>
>> -Original Message-
>> From: kernel test robot [mailto:ying.hu...@linux.intel.com]
>> Sent: Monday, December 14, 2015 3:06 PM
>> To: Chao Yu
>> Cc: l...@01.org; LKML; 0day robot
>> Subject: [lkp] [f2fs] 9f88450ff1:
>> stderr.mount:wrong_fs_type,bad_option,bad_superblock_on/dev/sda3
>> 
>> FYI, we noticed the below changes on
>> 
>> https://github.com/0day-ci/linux
>> Chao-Yu/f2fs-clean-up-node-page-updating-flow/20151211-161235
>> commit 9f88450ff18d8bd577ff431318f7ae00034465c0 ("f2fs: do more integrity 
>> verification for
>> superblock")
>> 
>> 
>> After your commit, our mounting f2fs partition operations will fail with
>> following error message.  But I have no dmesg now.  Do you need it?
>
> Thanks for the report! Could you please share dmesg and some info (e.g. 
> size..)
> about storage device '/dev/sda3'.
>

The dmesg is attached.

Best Regards,
Huang, Ying


dmesg.xz
Description: application/xz


Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Patch updates the TODO file.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/TODO | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 0e0825b..0bdfd26 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,4 +1,3 @@
-* checkpatch fixes
 * remove unnecessary comments
 * remove unnecessary error messages. Example kzalloc() has its
   own error message. Adding an extra one is useless.
-- 
2.5.0

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


Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the spacing fixes that checkpatch prompted for,
as asked by the TODO.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_cls.c|   4 +-
 drivers/staging/dgnc/dgnc_driver.h |   8 --
 drivers/staging/dgnc/dgnc_neo.c| 235 -
 drivers/staging/dgnc/dgnc_neo.h|  22 ++--
 drivers/staging/dgnc/dgnc_pci.h|   1 -
 drivers/staging/dgnc/dgnc_sysfs.c  |  18 ++-
 drivers/staging/dgnc/dgnc_tty.c|  46 +---
 drivers/staging/dgnc/digi.h|  32 ++---
 8 files changed, 223 insertions(+), 143 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 75040da..d312d35 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch)
/* Clear out UART and FIFO */
readb(>ch_cls_uart->txrx);
 
-   writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
-  >ch_cls_uart->isr_fcr);
+   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
+  UART_FCR_CLEAR_XMIT), >ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index ce7cd9b..e4be81b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -88,7 +88,6 @@
 #define   _POSIX_VDISABLE '\0'
 #endif
 
-
 /*
  * All the possible states the driver can be while being loaded.
  */
@@ -106,7 +105,6 @@ enum {
BOARD_READY
 };
 
-
 /*
  *
  * Structures and closely related defines.
@@ -145,7 +143,6 @@ struct board_ops {
  /
 #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */
 
-
 /*
  * Per-board information
  */
@@ -241,7 +238,6 @@ struct dgnc_board {
 
 };
 
-
 /
  * Unit flag definitions for un_flags.
  /
@@ -277,7 +273,6 @@ struct un_t {
struct device *un_sysfs;
 };
 
-
 /
  * Device flag definitions for ch_flags.
  /
@@ -300,7 +295,6 @@ struct un_t {
 #define CH_FORCED_STOP  0x2/* Output is forcibly stopped   
*/
 #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped
*/
 
-
 /* Our Read/Error/Write queue sizes */
 #define RQUEUEMASK 0x1FFF  /* 8 K - 1 */
 #define EQUEUEMASK 0x1FFF  /* 8 K - 1 */
@@ -309,7 +303,6 @@ struct un_t {
 #define EQUEUESIZE RQUEUESIZE
 #define WQUEUESIZE (WQUEUEMASK + 1)
 
-
 /
  * Channel information structure.
  /
@@ -397,7 +390,6 @@ struct channel_t {
ulong   ch_intr_tx; /* Count of interrupts */
ulong   ch_intr_rx; /* Count of interrupts */
 
-
/* /proc// entries */
struct proc_dir_entry *proc_entry_pointer;
struct dgnc_proc_entry *dgnc_channel_table;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8106f52..2b94b75 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = {
.send_immediate_char =  neo_send_immediate_char
 };
 
-static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 
0x80 };
+static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08,
+   0x10, 0x20, 0x40, 0x80 };
 
 /*
  * This function allows calls to ensure that all outstanding
@@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
/* Turn off auto Xon flow control */
efr &= ~UART_17158_EFR_IXON;
 
-   /* Why? Becuz Exar's spec says we have to zero it out before setting it 
*/
+   /* Why? Becuz Exar's spec says we have to
+* zero it out before setting it.
+*/
writeb(0, >ch_neo_uart->efr);
 
/* Turn on UART enhanced bits */
writeb(efr, >ch_neo_uart->efr);
 
/* Turn on table D, with 8 char hi/low watermarks */
-   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), 
>ch_neo_uart->fctr);
+   writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY),
+  >ch_neo_uart->fctr);
 
/* Feed the UART our trigger levels */
writeb(8, >ch_neo_uart->tfifo);
@@ -144,13 +148,16 @@ static inline void neo_set_rts_flow_control(struct 
channel_t *ch)
ier &= 

Re: [PATCH 05/16] perf test: Fix hist testcases when kptr_restrict is on

2015-12-14 Thread Wangnan (F)

Hi,

On 2015/12/15 1:44, Arnaldo Carvalho de Melo wrote:

From: Namhyung Kim 

Currently if kptr_restrict is enabled, all hist tests failed with
segfaults.  This is because machine__create_kernel_maps() in
setup_fake_machine() failed in that situation, and it called
machine__delete() on the error path.  But outer callers again called
machines__exit() causing double free for the host machine.

Signed-off-by: Namhyung Kim 
Cc: Jiri Olsa 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1450062673-22312-1-git-send-email-namhy...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
  tools/perf/tests/hists_common.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)


I have a similar patch on this problem at [1][2].

This patch applied solves only half of the problem I seen. Although double
free is gone, in case when kptr_restrict is enabled a normal user still
gets incorrect result. For example:

 $ ./perf test -v 'filtering hist entries'
 25: Test filtering hist entries  :
 --- start ---
 test child forked, pid 4186
 Cannot create kernel maps
 test child finished with 0
  end 
 Test filtering hist entries: Ok

The test body doesn't get called at all. I think in this case we'd better
return 'Skip'.

I'd like to send another for it.

[1] 
http://lkml.kernel.org/g/1450089563-122430-2-git-send-email-wangn...@huawei.com
[2] 
http://lkml.kernel.org/g/1449726768-79624-1-git-send-email-wangn...@huawei.com


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


Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes

2015-12-14 Thread Sanidhya Solanki
Patch contains the CamelCase fixes & Macro fixes that
checkpatch prompted for, as asked by the TODO.

Signed-off-by: Sanidhya Solanki 
---
 drivers/staging/dgnc/dgnc_driver.c |  56 -
 drivers/staging/dgnc/dgnc_driver.h |  25 ++--
 drivers/staging/dgnc/dgnc_mgmt.c   |  28 ++---
 drivers/staging/dgnc/dgnc_neo.c| 226 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 134 +-
 drivers/staging/dgnc/dgnc_tty.c| 197 
 drivers/staging/dgnc/digi.h|  20 ++--
 7 files changed, 367 insertions(+), 319 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index fc6d298..37fb8f9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -48,7 +48,7 @@ static void   dgnc_do_remap(struct dgnc_board *brd);
 /*
  * File operations permitted on Control/Management major.
  */
-static const struct file_operations dgnc_BoardFops = {
+static const struct file_operations dgnc_board_fops = {
.owner  =   THIS_MODULE,
.unlocked_ioctl =   dgnc_mgmt_ioctl,
.open   =   dgnc_mgmt_open,
@@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = {
 /*
  * Globals
  */
-uint   dgnc_NumBoards;
-struct dgnc_board  *dgnc_Board[MAXBOARDS];
+uint   dgnc_num_boards;
+struct dgnc_board  *dgnc_board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
 DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
-uint   dgnc_Major;
+uint   dgnc_major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
 /*
@@ -92,7 +92,7 @@ struct board_id {
unsigned int is_pci_express;
 };
 
-static struct board_id dgnc_Ids[] = {
+static struct board_id dgnc_ids[] = {
{   PCI_DEVICE_CLASSIC_4_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_4_422_PCI_NAME,  4,  0   },
{   PCI_DEVICE_CLASSIC_8_PCI_NAME,  8,  0   },
@@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void)
 
dgnc_remove_driver_sysfiles(_driver);
 
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
class_destroy(dgnc_class);
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
 
-   for (i = 0; i < dgnc_NumBoards; ++i) {
-   dgnc_remove_ports_sysfiles(dgnc_Board[i]);
-   dgnc_tty_uninit(dgnc_Board[i]);
-   dgnc_cleanup_board(dgnc_Board[i]);
+   for (i = 0; i < dgnc_num_boards; ++i) {
+   dgnc_remove_ports_sysfiles(dgnc_board[i]);
+   dgnc_tty_uninit(dgnc_board[i]);
+   dgnc_cleanup_board(dgnc_board[i]);
}
 
dgnc_tty_post_uninit();
 
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
 }
 
@@ -187,7 +187,7 @@ static int __init dgnc_init_module(void)
 */
if (rc < 0) {
/* Only unregister if it was actually registered. */
-   if (dgnc_NumBoards)
+   if (dgnc_num_boards)
pci_unregister_driver(_driver);
else
pr_warn("WARNING: dgnc driver load failed.  No Digi Neo 
or Classic boards found.\n");
@@ -222,12 +222,12 @@ static int dgnc_start(void)
 *
 * Register management/dpa devices
 */
-   rc = register_chrdev(0, "dgnc", _BoardFops);
+   rc = register_chrdev(0, "dgnc", _board_fops);
if (rc < 0) {
pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
return rc;
}
-   dgnc_Major = rc;
+   dgnc_major = rc;
 
dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
if (IS_ERR(dgnc_class)) {
@@ -237,7 +237,7 @@ static int dgnc_start(void)
}
 
dev = device_create(dgnc_class, NULL,
-   MKDEV(dgnc_Major, 0),
+   MKDEV(dgnc_major, 0),
NULL, "dgnc_mgmt");
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
@@ -267,11 +267,11 @@ static int dgnc_start(void)
return 0;
 
 failed_tty:
-   device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+   device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
 failed_device:
class_destroy(dgnc_class);
 failed_class:
-   unregister_chrdev(dgnc_Major, "dgnc");
+   unregister_chrdev(dgnc_major, "dgnc");
return rc;
 }
 
@@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
} else {
rc = dgnc_found_board(pdev, ent->driver_data);
if (rc == 0)
-   dgnc_NumBoards++;
+   dgnc_num_boards++;
}

[PATCH] powerpc: Enable UBSAN support

2015-12-14 Thread Daniel Axtens
This hooks up UBSAN support for PowerPC.

So far it's found some interesting cases where we don't properly sanitise
input to shifts, including one in our futex handling. It's also found an
out of bounds read in an array. Nothing critical, but worth fixing.

Tested-by: Andrew Donnellan 
CC: Andrey Ryabinin 
Signed-off-by: Daniel Axtens 
---

RFC -> v1:
 - Update patch to use fixed spelling of SANITIZE.
 - Include tested by tag from Andrew - Thanks!

This applies on top of next with Andrey's patches:
 1) https://patchwork.kernel.org/patch/7761341/
 2) https://patchwork.kernel.org/patch/7761351/
 3) https://patchwork.kernel.org/patch/7761361/
 4) https://patchwork.kernel.org/patch/7785791/
 5) https://patchwork.kernel.org/patch/7819661/

-mm and therefore -next have these patches, and the RFC of this
patch.

This has now been tested on LE and BE 64bit, on pseries, bml and
PowerNV.
---
 arch/powerpc/Kconfig| 1 +
 arch/powerpc/kernel/Makefile| 8 +++-
 arch/powerpc/kernel/vdso32/Makefile | 1 +
 arch/powerpc/kernel/vdso64/Makefile | 1 +
 arch/powerpc/xmon/Makefile  | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 25283796a02e..171d4e4b015d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -156,6 +156,7 @@ config PPC
select EDAC_ATOMIC_SCRUB
select ARCH_HAS_DMA_SET_COHERENT_MASK
select HAVE_ARCH_SECCOMP_FILTER
+   select ARCH_HAS_UBSAN_SANITIZE_ALL
 
 config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ba336930d448..794f22adf99d 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -136,12 +136,18 @@ endif
 obj-$(CONFIG_EPAPR_PARAVIRT)   += epapr_paravirt.o epapr_hcalls.o
 obj-$(CONFIG_KVM_GUEST)+= kvm.o kvm_emul.o
 
-# Disable GCOV in odd or sensitive code
+# Disable GCOV & sanitizers in odd or sensitive code
 GCOV_PROFILE_prom_init.o := n
+UBSAN_SANITIZE_prom_init.o := n
 GCOV_PROFILE_ftrace.o := n
+UBSAN_SANITIZE_ftrace.o := n
 GCOV_PROFILE_machine_kexec_64.o := n
+UBSAN_SANITIZE_machine_kexec_64.o := n
 GCOV_PROFILE_machine_kexec_32.o := n
+UBSAN_SANITIZE_machine_kexec_32.o := n
 GCOV_PROFILE_kprobes.o := n
+UBSAN_SANITIZE_kprobes.o := n
+UBSAN_SANITIZE_vdso.o := n
 
 extra-$(CONFIG_PPC_FPU)+= fpu.o
 extra-$(CONFIG_ALTIVEC)+= vector.o
diff --git a/arch/powerpc/kernel/vdso32/Makefile 
b/arch/powerpc/kernel/vdso32/Makefile
index 6abffb7a8cd9..cbabd143acae 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -15,6 +15,7 @@ targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
 
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 ccflags-y := -shared -fno-common -fno-builtin
 ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
diff --git a/arch/powerpc/kernel/vdso64/Makefile 
b/arch/powerpc/kernel/vdso64/Makefile
index 8c8f2ae43935..c710802b8fb6 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -8,6 +8,7 @@ targets := $(obj-vdso64) vdso64.so vdso64.so.dbg
 obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
 
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 ccflags-y := -shared -fno-common -fno-builtin
 ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 1278788d96e3..436062dbb6e2 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -3,6 +3,7 @@
 subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
 
-- 
2.6.2

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


ARM64/KVM: Bad page state in process iperf

2015-12-14 Thread Bhushan Bharat

Hi All,

I am running "iperf" in KVM guest on ARM64 machine and observing below crash.

=
$iperf -c 3.3.3.3 -P 4 -t 0 -i 5 -w 90k

Client connecting to 3.3.3.3, TCP port 5001
TCP window size:  180 KByte (WARNING: requested 90.0 KByte)

[  3] local 3.3.3.1 port 51131 connected with 3.3.3.3 port 5001
[  6] local 3.3.3.1 port 51134 connected with 3.3.3.3 port 5001
[  5] local 3.3.3.1 port 51133 connected with 3.3.3.3 port 5001
[  4] local 3.3.3.1 port 51132 connected with 3.3.3.3 port 5001
[   53.088567] random: nonblocking pool is initialized
[ ID] Interval   Transfer Bandwidth
[  3]  0.0- 5.0 sec   638 MBytes  1.07 Gbits/sec
[  4] 35.0-40.0 sec  1.66 GBytes  2.85 Gbits/sec
[  5] 40.0-45.0 sec  1.11 GBytes  1.90 Gbits/sec
[  4] 40.0-45.0 sec  1.16 GBytes  1.99 Gbits/sec
[   98.895207] BUG: Bad page state in process iperf  pfn:0a584
[   98.896164] page:78296100 count:-1 mapcount:0 mapping:  
(null) index:0x0
[   98.897436] flags: 0x0()
[   98.897885] page dumped because: nonzero _count
[   98.898640] Modules linked in:
[   98.899178] CPU: 0 PID: 1639 Comm: iperf Not tainted 4.1.8-00461-ge5431ad 
#141
[   98.900302] Hardware name: linux,dummy-virt (DT)
[   98.901014] Call trace:
[   98.901406] [] dump_backtrace+0x0/0x12c
[   98.902522] [] show_stack+0x10/0x1c
[   98.903441] [] dump_stack+0x8c/0xdc
[   98.904202] [] bad_page+0xc4/0x114
[   98.904945] [] get_page_from_freelist+0x590/0x63c
[   98.905871] [] __alloc_pages_nodemask+0xec/0x794
[   98.906791] [] skb_page_frag_refill+0x70/0xa8
[   98.907678] [] sk_page_frag_refill+0x20/0xd0
[   98.908550] [] tcp_sendmsg+0x1f8/0x9a8
[   98.909368] [] inet_sendmsg+0x5c/0xd0
[   98.910178] [] sock_sendmsg+0x14/0x58
[   98.911027] [] sock_write_iter+0x64/0xbc
[   98.912119] [] __vfs_write+0xac/0x10c
[   98.913126] [] vfs_write+0x90/0x1a0
[   98.913963] [] SyS_write+0x40/0xa0

---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/15] copy offload patches

2015-12-14 Thread Douglas Gilbert

On 15-12-14 08:22 PM, Mikulas Patocka wrote:



On Thu, 10 Dec 2015, Martin K. Petersen wrote:


"Mikulas" == Mikulas Patocka  writes:


Mikulas,

Mikulas> This patch series adds copy offload (the XCOPY command) to the
Mikulas> block layer, SCSI subsystems and device mapper.

Now that the VFS stuff appears to stabilize I agree it's a good time to
revisit all this. I just merged the required VPD patches from Hannes so
those will be in 4.5.

I have a bunch of changes to the SCSI code that I worked on over the
spring/summer based on a feedback from the array vendors after
discussions we started at LSF/MM. Generally speaking, their comments
didn't make things easier, nor prettier :( But your two bio approach is
a requirement to accommodate those needs (token-based copy) so I'll work
on consolidating your changes with mine.


Let me know when you make some progress with that.

Is there some software iSCSI implementation that supports token-based
copy? So that I could try to make support for it.


FreeNAS. See:
   http://www.freenas.org/

It has the best ODX implementation (thanks to Alexander Motin) that
I have come across for testing my ddpt based ODX client. It also
supports large parts of the more general xcopy LID1 and LID4.


BTW In SPC-5 xcopy LID1 has been dropped and "xcopy" now means
xcopy LID4 (as found in SPC-4).

Doug Gilbert


That said, we still need Mike Christie's patches to go in first.

Mike: What's your status? I'm afraid I didn't get a chance to dig very
deep in your series since it coincided with me scrambling to sort out
SCSI for 4.4. Do you think there's a chance we could get your patches in
shape for 4.5? Is there an up-to-date tree I can look at?

--
Martin K. Petersen  Oracle Linux Engineering



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


Re: [PATCH v4 01/20] PM / devfreq: exynos: Add generic exynos bus frequency driver

2015-12-14 Thread Krzysztof Kozlowski
On 14.12.2015 15:38, Chanwoo Choi wrote:
> This patch adds the generic exynos bus frequency driver for AMBA AXI bus
> of sub-blocks in exynos SoC with DEVFREQ framework. The Samsung Exynos SoC
> have the common architecture for bus between DRAM and sub-blocks in SoC.
> This driver can support the generic bus frequency driver for Exynos SoCs.
> 
> In devicetree, Each bus block has a bus clock, regulator, operation-point
> and devfreq-event devices which measure the utilization of each bus block.
> 
> Signed-off-by: Chanwoo Choi 
> [linux.amoon: Tested on Odroid U3]
> Tested-by: Anand Moon 
> ---
>  drivers/devfreq/Kconfig |  15 ++
>  drivers/devfreq/Makefile|   1 +
>  drivers/devfreq/exynos/Makefile |   1 +
>  drivers/devfreq/exynos/exynos-bus.c | 449 
> 
>  4 files changed, 466 insertions(+)
>  create mode 100644 drivers/devfreq/exynos/exynos-bus.c
> 
> diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
> index 64281bb2f650..55ec774f794c 100644
> --- a/drivers/devfreq/Kconfig
> +++ b/drivers/devfreq/Kconfig
> @@ -66,6 +66,21 @@ config DEVFREQ_GOV_USERSPACE
>  
>  comment "DEVFREQ Drivers"
>  
> +config ARM_EXYNOS_BUS_DEVFREQ
> + bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"
> + depends on ARCH_EXYNOS
> + select DEVFREQ_GOV_SIMPLE_ONDEMAND
> + select DEVFREQ_EVENT_EXYNOS_PPMU
> + select PM_DEVFREQ_EVENT
> + select PM_OPP
> + help
> +   This adds the common DEVFREQ driver for Exynos Memory bus. Exynos
> +   Memory bus has one more group of memory bus (e.g, MIF and INT block).
> +   Each memory bus group could contain many memoby bus block. It reads
> +   PPMU counters of memory controllers by using DEVFREQ-event device
> +   and adjusts the operating frequencies and voltages with OPP support.
> +   This does not yet operate with optimal voltages.
> +
>  config ARM_EXYNOS4_BUS_DEVFREQ
>   bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
>   depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412) && 
> !ARCH_MULTIPLATFORM
> diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile
> index 5134f9ee983d..375ebbb4fcfb 100644
> --- a/drivers/devfreq/Makefile
> +++ b/drivers/devfreq/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_DEVFREQ_GOV_POWERSAVE)   += governor_powersave.o
>  obj-$(CONFIG_DEVFREQ_GOV_USERSPACE)  += governor_userspace.o
>  
>  # DEVFREQ Drivers
> +obj-$(CONFIG_ARCH_EXYNOS)+= exynos/

Why limiting it to ARCH_EXYNOS? Are there real dependencies on exynos
mach code? Or on ARM code?

If not, then this probably should be obj-y to allow compile testing.
Particular objects would be selected by ARM_EXYNOS_BUS_DEVFREQ.

Best regards,
Krzysztof

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


[PATCH v3 1/3] perf tools: Fix PowerPC native building

2015-12-14 Thread Wang Nan
Checks BPF syscall number, turn off libbpf building on platform doesn't
correctly support sys_bpf instead of blocking compiling.

Reported-by: Naveen N. Rao 
Signed-off-by: Wang Nan 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Sukadev Bhattiprolu 
---
 tools/build/feature/test-bpf.c | 20 +++-
 tools/lib/bpf/bpf.c|  4 ++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
index 062bac8..b389026 100644
--- a/tools/build/feature/test-bpf.c
+++ b/tools/build/feature/test-bpf.c
@@ -1,9 +1,23 @@
+#include 
 #include 
+#include 
+
+#ifndef __NR_bpf
+# if defined(__i386__)
+#  define __NR_bpf 357
+# elif defined(__x86_64__)
+#  define __NR_bpf 321
+# elif defined(__aarch64__)
+#  define __NR_bpf 280
+#  error __NR_bpf not defined. libbpf does not support your arch.
+# endif
+#endif
 
 int main(void)
 {
union bpf_attr attr;
 
+   /* Check fields in attr */
attr.prog_type = BPF_PROG_TYPE_KPROBE;
attr.insn_cnt = 0;
attr.insns = 0;
@@ -14,5 +28,9 @@ int main(void)
attr.kern_version = 0;
 
attr = attr;
-   return 0;
+   /*
+* Test existence of __NR_bpf and BPF_PROG_LOAD.
+* This call should fail if we run the testcase.
+*/
+   return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
 }
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 5bdc6ea..1f91cc9 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -14,8 +14,8 @@
 #include "bpf.h"
 
 /*
- * When building perf, unistd.h is override. Define __NR_bpf is
- * required to be defined.
+ * When building perf, unistd.h is overrided. __NR_bpf is
+ * required to be defined explicitly.
  */
 #ifndef __NR_bpf
 # if defined(__i386__)
-- 
1.8.3.4

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


[PATCH v3 0/3] perf build: PowerPC: Fix build breakage due to libbpf

2015-12-14 Thread Wang Nan
Hi Naveen,

   Now I know your problem is in native building and the reason is
missing proper $(ARCH). I think other than that there's another problem
in libbpf's building: if your problem is unable to compile libbpf,
feature checker should find it and set NO_LIBBPF=1 for perf, so perf
building won't be blocked, only BPF related features should be turned
off. Also, I think including Makefile.arch from tools/scripts would be
better, because libbpf is at the same level with perf. So I separate
them into 3 patches. Please help me test it on PowerPC.

Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Naveen N. Rao 
Cc: Sukadev Bhattiprolu 

Naveen N. Rao (1):
  perf: bpf: Fix build breakage due to libbpf

Wang Nan (2):
  perf tools: Fix PowerPC native building
  tools: Move Makefile.arch from perf/config to tools/scripts

 tools/build/feature/test-bpf.c   | 20 +++-
 tools/lib/bpf/Makefile   |  3 ++-
 tools/lib/bpf/bpf.c  |  4 ++--
 tools/perf/config/Makefile   |  2 +-
 tools/perf/tests/make|  2 +-
 tools/{perf/config => scripts}/Makefile.arch |  0
 6 files changed, 25 insertions(+), 6 deletions(-)
 rename tools/{perf/config => scripts}/Makefile.arch (100%)

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


  1   2   3   4   5   6   7   8   9   10   >