Re: [PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd instruction emulation
On Tue, Sep 04, 2018 at 04:12:07PM -0500, Segher Boessenkool wrote: > On Mon, Sep 03, 2018 at 08:49:35PM +0530, Sandipan Das wrote: > > + case 538: /* cnttzw */ > > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > > + return -1; > > + val = (unsigned int) regs->gpr[rd]; > > + op->val = ( val ? __builtin_ctz(val) : 32 ); > > + goto logical_done; > > +#ifdef __powerpc64__ > > + case 570: /* cnttzd */ > > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > > + return -1; > > + val = regs->gpr[rd]; > > + op->val = ( val ? __builtin_ctzl(val) : 64 ); > > + goto logical_done; > > __builtin_ctz(val) is undefined for val == 0. Which would be why he only calls it when val != 0, presumably, and uses 64 when val == 0. Apart from idiosyncratic whitespace his code looks correct to me. Are you saying there is a bug in his code, or that his patch description is incomplete, or what? Paul.
Re: [PATCH v2] powerpc/powernv: Make possible for user to force a full ipl cec reboot
On 09/03/2018 03:56 PM, Vaibhav Jain wrote: Ever since fast reboot is enabled by default in opal, opal_cec_reboot() will use fast-reset instead of full IPL to perform system reboot. This leaves the user with no direct way to force a full IPL reboot except changing an nvram setting that persistently disables fast-reset for all subsequent reboots. This patch provides a more direct way for the user to force a one-shot full IPL reboot by passing the command line argument 'full' to the reboot command. So the user will be able to tweak the reboot behavior via: .../... /* Argument to OPAL_PCI_TCE_KILL */ diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index ae023622..650484e0940b 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -224,7 +224,22 @@ static void __noreturn pnv_restart(char *cmd) pnv_prepare_going_down(); while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { - rc = opal_cec_reboot(); + /* See if we need to do a full IPL reboot */ + if (cmd && strcmp(cmd, "full") == 0) + rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL); + else + rc = OPAL_UNSUPPORTED; As discussed offline, please handle OPAL_SUCCESS case well. -Vasant
Re: [PATCH 01/25] tty: Change return type to void
On 09/05/2018, 03:08 AM, Jaejoong Kim wrote: > > @@ -688,7 +688,7 @@ extern int tty_port_close_start(struct > tty_port *port, > > extern void tty_port_close_end(struct tty_port *port, struct > tty_struct *tty); > > extern void tty_port_close(struct tty_port *port, > > struct tty_struct *tty, struct file > *filp); > > -extern int tty_port_install(struct tty_port *port, struct > tty_driver *driver, > > +extern void tty_port_install(struct tty_port *port, struct > tty_driver *driver, > > struct tty_struct *tty); > > You need to update all the callers in the same patch -- the > kernel must > remain buildable after each patch but you seem to have spread that > update > among a lot of patches.. > > > OK. I will make several patches as one patch. You don't have to. Just reorder the patches as suggested by Sam. (First, make everybody ignore the return value, then change these return types to void.) BTW you can mention in this commit log, that this change is possible after a3123fd0a4a5. That commit made tty_standard_install to always return 0. thanks, -- js suse labs
Re: [PATCH] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size
On Tue, Sep 04, 2018 at 06:16:01PM +1000, Nicholas Piggin wrote: > THP paths can defer splitting compound pages until after the actual > remap and TLB flushes to split a huge PMD/PUD. This causes radix > partition scope page table mappings to get out of synch with the host > qemu page table mappings. > > This results in random memory corruption in the guest when running > with THP. The easiest way to reproduce is use KVM baloon to free up > a lot of memory in the guest and then shrink the balloon to give the > memory back, while some work is being done in the guest. > > Cc: Paul Mackerras > Cc: David Gibson > Cc: "Aneesh Kumar K.V" > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Nicholas Piggin Seems to fix the problem on my test case. Tested-by: David Gibson > --- > arch/powerpc/kvm/book3s_64_mmu_radix.c | 88 ++ > 1 file changed, 34 insertions(+), 54 deletions(-) > > diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c > b/arch/powerpc/kvm/book3s_64_mmu_radix.c > index 0af1c0aea1fe..d8792445d95a 100644 > --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c > +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c > @@ -525,8 +525,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, > struct kvm_vcpu *vcpu, > unsigned long ea, unsigned long dsisr) > { > struct kvm *kvm = vcpu->kvm; > - unsigned long mmu_seq, pte_size; > - unsigned long gpa, gfn, hva, pfn; > + unsigned long mmu_seq; > + unsigned long gpa, gfn, hva; > struct kvm_memory_slot *memslot; > struct page *page = NULL; > long ret; > @@ -623,9 +623,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, > struct kvm_vcpu *vcpu, >*/ > hva = gfn_to_hva_memslot(memslot, gfn); > if (upgrade_p && __get_user_pages_fast(hva, 1, 1, &page) == 1) { > - pfn = page_to_pfn(page); > upgrade_write = true; > } else { > + unsigned long pfn; > + > /* Call KVM generic code to do the slow-path check */ > pfn = __gfn_to_pfn_memslot(memslot, gfn, false, NULL, > writing, upgrade_p); > @@ -639,63 +640,42 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, > struct kvm_vcpu *vcpu, > } > } > > - /* See if we can insert a 1GB or 2MB large PTE here */ > - level = 0; > - if (page && PageCompound(page)) { > - pte_size = PAGE_SIZE << compound_order(compound_head(page)); > - if (pte_size >= PUD_SIZE && > - (gpa & (PUD_SIZE - PAGE_SIZE)) == > - (hva & (PUD_SIZE - PAGE_SIZE))) { > - level = 2; > - pfn &= ~((PUD_SIZE >> PAGE_SHIFT) - 1); > - } else if (pte_size >= PMD_SIZE && > -(gpa & (PMD_SIZE - PAGE_SIZE)) == > -(hva & (PMD_SIZE - PAGE_SIZE))) { > - level = 1; > - pfn &= ~((PMD_SIZE >> PAGE_SHIFT) - 1); > - } > - } > - > /* > - * Compute the PTE value that we need to insert. > + * Read the PTE from the process' radix tree and use that > + * so we get the shift and attribute bits. >*/ > - if (page) { > - pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE | > - _PAGE_ACCESSED; > - if (writing || upgrade_write) > - pgflags |= _PAGE_WRITE | _PAGE_DIRTY; > - pte = pfn_pte(pfn, __pgprot(pgflags)); > + local_irq_disable(); > + ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); > + pte = *ptep; > + local_irq_enable(); > + > + /* Get pte level from shift/size */ > + if (shift == PUD_SHIFT && > + (gpa & (PUD_SIZE - PAGE_SIZE)) == > + (hva & (PUD_SIZE - PAGE_SIZE))) { > + level = 2; > + } else if (shift == PMD_SHIFT && > +(gpa & (PMD_SIZE - PAGE_SIZE)) == > +(hva & (PMD_SIZE - PAGE_SIZE))) { > + level = 1; > } else { > - /* > - * Read the PTE from the process' radix tree and use that > - * so we get the attribute bits. > - */ > - local_irq_disable(); > - ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); > - pte = *ptep; > - local_irq_enable(); > - if (shift == PUD_SHIFT && > - (gpa & (PUD_SIZE - PAGE_SIZE)) == > - (hva & (PUD_SIZE - PAGE_SIZE))) { > - level = 2; > - } else if (shift == PMD_SHIFT && > -(gpa & (PMD_SIZE - PAGE_SIZE)) == > -(hva & (PMD_SIZE - PAGE_SIZE))) { > - level = 1; > - } else if (shift && shift != PAGE_SHIFT) { > - /* Adjust PFN */ > - unsigned lon
Re: Regression from patch 'tty: hvc: hvc_poll() break hv read loop'
On Wed, Sep 05, 2018 at 01:51:56PM +1000, Nicholas Piggin wrote: > On Tue, 4 Sep 2018 15:16:35 -0600 > Jason Gunthorpe wrote: > > > On Wed, Sep 05, 2018 at 07:15:29AM +1000, Nicholas Piggin wrote: > > > On Tue, 4 Sep 2018 11:48:08 -0600 > > > Jason Gunthorpe wrote: > > > > > > > Hi Nicholas, > > > > > > > > I am testing 4.19-rc2 and I see bad behavior with my qemu hvc0 > > > > console.. > > > > > > > > Running interactive with qemu (qemu-2.11.2-1.fc28) on the console > > > > providing hvc0, using options like: > > > > > > > > -nographic > > > > -chardev stdio,id=stdio,mux=on,signal=off > > > > -mon chardev=stdio > > > > -device isa-serial,chardev=stdio > > > > -device virtio-serial-pci > > > > -device virtconsole,chardev=stdio > > > > > > > > I see the hvc0 console hang regularly, ie doing something like 'up > > > > arrow' in bash causes the hvc0 console to hang. Prior kernels worked > > > > OK. > > > > > > > > Any ideas? I'm not familiar with this code.. Thanks! > > > > > > Yes I have had another report, I'm working on a fix. Sorry it has taken > > > a while and thank you for the report. > > > > Okay, let me know when you have a fix and I will be able to test it > > for you! > > Can you try this? It worked for me, so it will work for Jason too (we have same setup). Tested-by: Leon Romanovsky Thanks
Re: Regression from patch 'tty: hvc: hvc_poll() break hv read loop'
On Tue, 4 Sep 2018 15:16:35 -0600 Jason Gunthorpe wrote: > On Wed, Sep 05, 2018 at 07:15:29AM +1000, Nicholas Piggin wrote: > > On Tue, 4 Sep 2018 11:48:08 -0600 > > Jason Gunthorpe wrote: > > > > > Hi Nicholas, > > > > > > I am testing 4.19-rc2 and I see bad behavior with my qemu hvc0 > > > console.. > > > > > > Running interactive with qemu (qemu-2.11.2-1.fc28) on the console > > > providing hvc0, using options like: > > > > > > -nographic > > > -chardev stdio,id=stdio,mux=on,signal=off > > > -mon chardev=stdio > > > -device isa-serial,chardev=stdio > > > -device virtio-serial-pci > > > -device virtconsole,chardev=stdio > > > > > > I see the hvc0 console hang regularly, ie doing something like 'up > > > arrow' in bash causes the hvc0 console to hang. Prior kernels worked > > > OK. > > > > > > Any ideas? I'm not familiar with this code.. Thanks! > > > > Yes I have had another report, I'm working on a fix. Sorry it has taken > > a while and thank you for the report. > > Okay, let me know when you have a fix and I will be able to test it > for you! Can you try this? diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 5414c4a87bea..f5fc3ba49130 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -49,6 +49,8 @@ #define N_OUTBUF 16 #define N_INBUF16 +#define HVC_ATOMIC_READ_MAX128 + #define __ALIGNED__ __attribute__((__aligned__(sizeof(long static struct tty_driver *hvc_driver; @@ -522,6 +524,8 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count return -EIO; while (count > 0) { + int ret; + spin_lock_irqsave(&hp->lock, flags); rsize = hp->outbuf_size - hp->n_outbuf; @@ -537,10 +541,13 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count } if (hp->n_outbuf > 0) - hvc_push(hp); + ret = hvc_push(hp); spin_unlock_irqrestore(&hp->lock, flags); + if (!ret) + break; + if (count) { if (hp->n_outbuf > 0) hvc_flush(hp); @@ -669,8 +676,8 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep) if (!hp->irq_requested) poll_mask |= HVC_POLL_READ; + read_again: /* Read data if any */ - count = tty_buffer_request_room(&hp->port, N_INBUF); /* If flip is full, just reschedule a later read */ @@ -717,9 +724,23 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep) #endif /* CONFIG_MAGIC_SYSRQ */ tty_insert_flip_char(&hp->port, buf[i], 0); } - if (n == count) - poll_mask |= HVC_POLL_READ; - read_total = n; + read_total += n; + + if (may_sleep) { + /* Keep going until the flip is full */ + spin_unlock_irqrestore(&hp->lock, flags); + cond_resched(); + spin_lock_irqsave(&hp->lock, flags); + goto read_again; + } else if (read_total < HVC_ATOMIC_READ_MAX) { + /* Break and defer if it's a large read in atomic */ + goto read_again; + } + + /* +* Latency break, schedule another poll immediately. +*/ + poll_mask |= HVC_POLL_READ; out: /* Wakeup write queue if necessary */
Re: [PATCH 3/3] soc: fsl: add RCPM driver
On Tue, Sep 4, 2018 at 9:58 PM Wang, Dongsheng wrote: > > Please change your comments style. Although this doesn't get into the Linux kernel coding style documentation yet, Linus seems changed his mind to prefer // than /* */ comment style now. https://lkml.org/lkml/2017/11/25/133 So the // style should be acceptable for now. > > On 2018/8/31 11:56, Ran Wang wrote: > > The NXP's QorIQ Processors based on ARM Core have RCPM module (Run > > Control and Power Management), which performs all device-level > > tasks associated with power management such as wakeup source control. > > > > This driver depends on FSL platform PM driver framework which help to > > isolate user and PM service provider (such as RCPM driver). > > > > Signed-off-by: Chenhui Zhao > > Signed-off-by: Ying Zhang > > Signed-off-by: Ran Wang > > --- > > drivers/soc/fsl/Kconfig |6 ++ > > drivers/soc/fsl/Makefile |1 + > > drivers/soc/fsl/ls-rcpm.c | 153 > > + > > 3 files changed, 160 insertions(+), 0 deletions(-) > > create mode 100644 drivers/soc/fsl/ls-rcpm.c > > > > diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig > > index 6517412..882330d 100644 > > --- a/drivers/soc/fsl/Kconfig > > +++ b/drivers/soc/fsl/Kconfig > > @@ -30,3 +30,9 @@ config FSL_PLAT_PM > > have to know the implement details of wakeup function it require. > > Besides, it is also easy for service side to upgrade its logic when > > design changed and remain user side unchanged. > > + > > +config LS_RCPM > > + bool "Freescale RCPM support" > > + depends on (FSL_PLAT_PM) > > + help > > + This feature is to enable specified wakeup source for system sleep. > > diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile > > index 8f9db23..43ff71a 100644 > > --- a/drivers/soc/fsl/Makefile > > +++ b/drivers/soc/fsl/Makefile > > @@ -7,3 +7,4 @@ obj-$(CONFIG_QUICC_ENGINE)+= qe/ > > obj-$(CONFIG_CPM)+= qe/ > > obj-$(CONFIG_FSL_GUTS) += guts.o > > obj-$(CONFIG_FSL_PLAT_PM)+= plat_pm.o > > +obj-$(CONFIG_LS_RCPM)+= ls-rcpm.o Probably use "_" instead of "-" for alignment. > > diff --git a/drivers/soc/fsl/ls-rcpm.c b/drivers/soc/fsl/ls-rcpm.c > > new file mode 100644 > > index 000..b0feb88 > > --- /dev/null > > +++ b/drivers/soc/fsl/ls-rcpm.c > > @@ -0,0 +1,153 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// > > +// plat_pm.c - Freescale Layerscape RCPM driver The file name here is not the same as the real file name. > > +// > > +// Copyright 2018 NXP > > +// > > +// Author: Ran Wang , Where do you need the comma in the end? > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define MAX_COMPATIBLE_NUM 10 > > + > > +struct rcpm_t { > > + struct device *dev; > > + void __iomem *ippdexpcr_addr; > > + bool big_endian;/* Big/Little endian of RCPM module */ > > +}; > > + > > +// rcpm_handle - Configure RCPM reg according to wake up source request > > +// @user_dev: pointer to user's device struct > > +// @flag: to enable(true) or disable(false) wakeup source > > +// @handle_priv: pointer to struct rcpm_t instance > > +// > > +// Return 0 on success other negative errno Although Linus preferred this // comment style. I'm not sure if this will be handled correctly by the kernel-doc compiler. https://www.kernel.org/doc/html/v4.18/doc-guide/kernel-doc.html > > +static int rcpm_handle(struct device *user_dev, bool flag, void > > *handle_priv) > > +{ > > + struct rcpm_t *rcpm; > > + bool big_endian; > > + const char *dev_compatible_array[MAX_COMPATIBLE_NUM]; > > + void __iomem *ippdexpcr_addr; > > + u32 ippdexpcr; > > + u32 set_bit; > > + int ret, num, i; > > + > > + rcpm = handle_priv; > > + big_endian = rcpm->big_endian; > > + ippdexpcr_addr = rcpm->ippdexpcr_addr; > > + > > + num = device_property_read_string_array(user_dev, "compatible", > > + dev_compatible_array, MAX_COMPATIBLE_NUM); > > + if (num < 0) > > + return num; > > + > > + for (i = 0; i < num; i++) { > > + if (!device_property_present(rcpm->dev, > > + dev_compatible_array[i])) > > + continue; > > + else { > Remove this else. > > + ret = device_property_read_u32(rcpm->dev, > > + dev_compatible_array[i], &set_bit); > > + if (ret) > > + return ret; > > + > > + if (!device_property_present(rcpm->dev, > > + dev_compatible_array[i])) > This has been checked. Continue ? or return ENODEV? > > + return -ENODEV; > > + else { > Remove this else. > > +
Re: [PATCH 3/3] soc: fsl: add RCPM driver
Please change your comments style. On 2018/8/31 11:56, Ran Wang wrote: > The NXP's QorIQ Processors based on ARM Core have RCPM module (Run > Control and Power Management), which performs all device-level > tasks associated with power management such as wakeup source control. > > This driver depends on FSL platform PM driver framework which help to > isolate user and PM service provider (such as RCPM driver). > > Signed-off-by: Chenhui Zhao > Signed-off-by: Ying Zhang > Signed-off-by: Ran Wang > --- > drivers/soc/fsl/Kconfig |6 ++ > drivers/soc/fsl/Makefile |1 + > drivers/soc/fsl/ls-rcpm.c | 153 > + > 3 files changed, 160 insertions(+), 0 deletions(-) > create mode 100644 drivers/soc/fsl/ls-rcpm.c > > diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig > index 6517412..882330d 100644 > --- a/drivers/soc/fsl/Kconfig > +++ b/drivers/soc/fsl/Kconfig > @@ -30,3 +30,9 @@ config FSL_PLAT_PM > have to know the implement details of wakeup function it require. > Besides, it is also easy for service side to upgrade its logic when > design changed and remain user side unchanged. > + > +config LS_RCPM > + bool "Freescale RCPM support" > + depends on (FSL_PLAT_PM) > + help > + This feature is to enable specified wakeup source for system sleep. > diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile > index 8f9db23..43ff71a 100644 > --- a/drivers/soc/fsl/Makefile > +++ b/drivers/soc/fsl/Makefile > @@ -7,3 +7,4 @@ obj-$(CONFIG_QUICC_ENGINE)+= qe/ > obj-$(CONFIG_CPM)+= qe/ > obj-$(CONFIG_FSL_GUTS) += guts.o > obj-$(CONFIG_FSL_PLAT_PM)+= plat_pm.o > +obj-$(CONFIG_LS_RCPM)+= ls-rcpm.o > diff --git a/drivers/soc/fsl/ls-rcpm.c b/drivers/soc/fsl/ls-rcpm.c > new file mode 100644 > index 000..b0feb88 > --- /dev/null > +++ b/drivers/soc/fsl/ls-rcpm.c > @@ -0,0 +1,153 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// > +// plat_pm.c - Freescale Layerscape RCPM driver > +// > +// Copyright 2018 NXP > +// > +// Author: Ran Wang , > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define MAX_COMPATIBLE_NUM 10 > + > +struct rcpm_t { > + struct device *dev; > + void __iomem *ippdexpcr_addr; > + bool big_endian;/* Big/Little endian of RCPM module */ > +}; > + > +// rcpm_handle - Configure RCPM reg according to wake up source request > +// @user_dev: pointer to user's device struct > +// @flag: to enable(true) or disable(false) wakeup source > +// @handle_priv: pointer to struct rcpm_t instance > +// > +// Return 0 on success other negative errno > +static int rcpm_handle(struct device *user_dev, bool flag, void *handle_priv) > +{ > + struct rcpm_t *rcpm; > + bool big_endian; > + const char *dev_compatible_array[MAX_COMPATIBLE_NUM]; > + void __iomem *ippdexpcr_addr; > + u32 ippdexpcr; > + u32 set_bit; > + int ret, num, i; > + > + rcpm = handle_priv; > + big_endian = rcpm->big_endian; > + ippdexpcr_addr = rcpm->ippdexpcr_addr; > + > + num = device_property_read_string_array(user_dev, "compatible", > + dev_compatible_array, MAX_COMPATIBLE_NUM); > + if (num < 0) > + return num; > + > + for (i = 0; i < num; i++) { > + if (!device_property_present(rcpm->dev, > + dev_compatible_array[i])) > + continue; > + else { Remove this else. > + ret = device_property_read_u32(rcpm->dev, > + dev_compatible_array[i], &set_bit); > + if (ret) > + return ret; > + > + if (!device_property_present(rcpm->dev, > + dev_compatible_array[i])) This has been checked. Continue ? or return ENODEV? > + return -ENODEV; > + else { Remove this else. > + ret = device_property_read_u32(rcpm->dev, > + dev_compatible_array[i], > &set_bit); > + if (ret) > + return ret; > + > + if (big_endian) > + ippdexpcr = ioread32be(ippdexpcr_addr); > + else > + ippdexpcr = ioread32(ippdexpcr_addr); > + > + if (flag) > + ippdexpcr |= set_bit; > + else > + ippdexpcr &= ~set_bit; > + > + if (big_endian) { > + iowrite32be(ippdexpcr, ippdexpcr_addr); > + ippdexpcr = ioread32
Re: [PATCH 1/3] soc: fsl: add Platform PM driver QorIQ platforms
Please change your comments style. On 2018/8/31 11:57, Ran Wang wrote: > This driver is to provide a independent framework for PM service > provider and consumer to configure system level wake up feature. For > example, RCPM driver could register a callback function on this > platform first, and Flex timer driver who want to enable timer wake > up feature, will call generic API provided by this platform driver, > and then it will trigger RCPM driver to do it. The benefit is to > isolate the user and service, such as flex timer driver will not have > to know the implement details of wakeup function it require. Besides, > it is also easy for service side to upgrade its logic when design is > changed and remain user side unchanged. > > Signed-off-by: Ran Wang > --- > drivers/soc/fsl/Kconfig | 14 + > drivers/soc/fsl/Makefile |1 + > drivers/soc/fsl/plat_pm.c | 144 > + > include/soc/fsl/plat_pm.h | 22 +++ > 4 files changed, 181 insertions(+), 0 deletions(-) > create mode 100644 drivers/soc/fsl/plat_pm.c > create mode 100644 include/soc/fsl/plat_pm.h > > diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig > index 7a9fb9b..6517412 100644 > --- a/drivers/soc/fsl/Kconfig > +++ b/drivers/soc/fsl/Kconfig > @@ -16,3 +16,17 @@ config FSL_GUTS > Initially only reading SVR and registering soc device are supported. > Other guts accesses, such as reading RCW, should eventually be moved > into this driver as well. > + > +config FSL_PLAT_PM > + bool "Freescale platform PM framework" > + help > + This driver is to provide a independent framework for PM service > + provider and consumer to configure system level wake up feature. For > + example, RCPM driver could register a callback function on this > + platform first, and Flex timer driver who want to enable timer wake > + up feature, will call generic API provided by this platform driver, > + and then it will trigger RCPM driver to do it. The benefit is to > + isolate the user and service, such as flex timer driver will not > + have to know the implement details of wakeup function it require. > + Besides, it is also easy for service side to upgrade its logic when > + design changed and remain user side unchanged. > diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile > index 44b3beb..8f9db23 100644 > --- a/drivers/soc/fsl/Makefile > +++ b/drivers/soc/fsl/Makefile > @@ -6,3 +6,4 @@ obj-$(CONFIG_FSL_DPAA) += qbman/ > obj-$(CONFIG_QUICC_ENGINE) += qe/ > obj-$(CONFIG_CPM)+= qe/ > obj-$(CONFIG_FSL_GUTS) += guts.o > +obj-$(CONFIG_FSL_PLAT_PM)+= plat_pm.o > diff --git a/drivers/soc/fsl/plat_pm.c b/drivers/soc/fsl/plat_pm.c > new file mode 100644 > index 000..19ea14e > --- /dev/null > +++ b/drivers/soc/fsl/plat_pm.c > @@ -0,0 +1,144 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// > +// plat_pm.c - Freescale platform PM framework > +// > +// Copyright 2018 NXP > +// > +// Author: Ran Wang , > + > +#include > +#include > +#include > +#include > +#include > +#include > + > + > +struct plat_pm_t { > + struct list_head node; > + fsl_plat_pm_handle handle; > + void *handle_priv; > + spinlock_t lock; > +}; > + > +static struct plat_pm_t plat_pm; > + > +// register_fsl_platform_wakeup_source - Register callback function to > plat_pm > +// @handle: Pointer to handle PM feature requirement > +// @handle_priv: Handler specific data struct > +// > +// Return 0 on success other negative errno > +int register_fsl_platform_wakeup_source(fsl_plat_pm_handle handle, > + void *handle_priv) > +{ > + struct plat_pm_t *p; > + unsigned long flags; > + > + if (!handle) { > + pr_err("FSL plat_pm: Handler invalid, reject\n"); > + return -EINVAL; > + } > + > + p = kmalloc(sizeof(*p), GFP_KERNEL); > + if (!p) > + return -ENOMEM; > + > + p->handle = handle; > + p->handle_priv = handle_priv; > + > + spin_lock_irqsave(&plat_pm.lock, flags); > + list_add_tail(&p->node, &plat_pm.node); > + spin_unlock_irqrestore(&plat_pm.lock, flags); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(register_fsl_platform_wakeup_source); > + > +// Deregister_fsl_platform_wakeup_source - deregister callback function > +// @handle_priv: Handler specific data struct > +// > +// Return 0 on success other negative errno > +int deregister_fsl_platform_wakeup_source(void *handle_priv) > +{ > + struct plat_pm_t *p, *tmp; > + unsigned long flags; > + > + spin_lock_irqsave(&plat_pm.lock, flags); > + list_for_each_entry_safe(p, tmp, &plat_pm.node, node) { > + if (p->handle_priv == handle_priv) { > + list_del(&p->node); > + kfree(p); > + } > + } > + spin_unlock_irqrestore(&p
[PATCH v2] tty: Change tty_{port|standard}_install() return type to void
Many drivers with tty use the tty_stand_install(). But, there is no need to handle the error, since it always returns 0. So, change the return type of tty_standard_install() and tty_port_install() to void type and remove unnecessary exception handling where we use these functions. Signed-off-by: Jaejoong Kim --- Changes in v2: - Update commit title - Squash other patches into one https://lkml.org/lkml/2018/9/4/70 arch/um/drivers/line.c | 7 +-- drivers/isdn/capi/capi.c| 10 -- drivers/isdn/i4l/isdn_tty.c | 3 ++- drivers/misc/pti.c | 28 +--- drivers/mmc/core/sdio_uart.c| 11 --- drivers/s390/char/con3215.c | 3 ++- drivers/s390/char/tty3270.c | 7 +-- drivers/staging/fwserial/fwserial.c | 22 -- drivers/staging/gdm724x/gdm_tty.c | 11 +++ drivers/staging/greybus/uart.c | 10 ++ drivers/tty/hvc/hvc_console.c | 7 ++- drivers/tty/hvc/hvcs.c | 10 ++ drivers/tty/mips_ejtag_fdc.c| 4 +++- drivers/tty/n_gsm.c | 9 + drivers/tty/nozomi.c| 8 +++- drivers/tty/serial/kgdb_nmi.c | 11 +-- drivers/tty/synclink.c | 3 ++- drivers/tty/synclinkmp.c| 3 ++- drivers/tty/tty_io.c| 10 ++ drivers/tty/tty_port.c | 4 ++-- drivers/tty/vcc.c | 5 + drivers/tty/vt/vt.c | 5 + drivers/usb/class/cdc-acm.c | 10 +- drivers/usb/host/xhci-dbgtty.c | 3 ++- drivers/usb/serial/usb-serial.c | 6 +- include/linux/tty.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 7 +-- 27 files changed, 73 insertions(+), 148 deletions(-) diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 8d80b27..47058cf 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -338,12 +338,7 @@ int line_open(struct tty_struct *tty, struct file *filp) int line_install(struct tty_driver *driver, struct tty_struct *tty, struct line *line) { - int ret; - - ret = tty_standard_install(driver, tty); - if (ret) - return ret; - + tty_standard_install(driver, tty); tty->driver_data = line; return 0; diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index ef5560b..08daf3a 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -999,13 +999,11 @@ static int capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) { struct capiminor *mp = capiminor_get(tty->index); - int ret = tty_standard_install(driver, tty); - if (ret == 0) - tty->driver_data = mp; - else - capiminor_put(mp); - return ret; + tty_standard_install(driver, tty); + tty->driver_data = mp; + + return 0; } static void capinc_tty_cleanup(struct tty_struct *tty) diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index b730037..3d6b24e 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -1481,8 +1481,9 @@ static int isdn_tty_install(struct tty_driver *driver, struct tty_struct *tty) return -ENODEV; tty->driver_data = info; + tty_port_install(&info->port, driver, tty); - return tty_port_install(&info->port, driver, tty); + return 0; } /* diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c index 41f2a9f..5c885a1 100644 --- a/drivers/misc/pti.c +++ b/drivers/misc/pti.c @@ -462,26 +462,24 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty) { int idx = tty->index; struct pti_tty *pti_tty_data; - int ret = tty_standard_install(driver, tty); - if (ret == 0) { - pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL); - if (pti_tty_data == NULL) - return -ENOMEM; + tty_standard_install(driver, tty); + pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL); + if (pti_tty_data == NULL) + return -ENOMEM; - if (idx == PTITTY_MINOR_START) - pti_tty_data->mc = pti_request_masterchannel(0, NULL); - else - pti_tty_data->mc = pti_request_masterchannel(2, NULL); + if (idx == PTITTY_MINOR_START) + pti_tty_data->mc = pti_request_masterchannel(0, NULL); + else + pti_tty_data->mc = pti_request_masterchannel(2, NULL); - if (pti_tty_data->mc == NULL) { - kfree(pti_tty_data); - return -ENXIO; - } - tty->driver_data = pti_tty_data; + if (pti_tty_data->mc == NULL) { + kfree(pti_tty_data); + return -ENXIO;
RE: [PATCH 2/3] Documentation: dt: binding: fsl: update property description for RCPM
Hi Rob > -Original Message- > From: Rob Herring > Sent: Tuesday, September 04, 2018 09:25 > To: Ran Wang > Cc: Leo Li ; Mark Rutland ; > linuxppc-dev@lists.ozlabs.org; linux-arm-ker...@lists.infradead.org; > devicet...@vger.kernel.org; linux-ker...@vger.kernel.org > Subject: Re: [PATCH 2/3] Documentation: dt: binding: fsl: update property > description for RCPM > > On Fri, Aug 31, 2018 at 11:52:18AM +0800, Ran Wang wrote: > > Add property 'big-endian' and supportted IP's configuration info. > > Remove property 'fsl,#rcpm-wakeup-cell'. > > "dt-bindings: soc: ..." for the subject > > It is obvious reading the diff you are removing fsl,#rcpm-wakeup-cell. > What is not obvious is why? The commit msg should answer that. Sure, I will add this in next version patch. > You also are mixing several things in this patch like adding ls1012 which you > don't mention. Please split. Got it, will split them and add more information in next version. Ran > > > > Signed-off-by: Ran Wang > > --- > > Documentation/devicetree/bindings/soc/fsl/rcpm.txt | 42 ++--- > -- > > 1 files changed, 13 insertions(+), 29 deletions(-)
[PATCH 1/2] powerpc/prom: Remove VLA in prom_check_platform_support()
In prom_check_platform_support() we retrieve and parse the "ibm,arch-vec-5-platform-support" property of the chosen node. Currently we use a variable length array however to avoid this use an array of constant length 8. This property is used to indicate the supported options of vector 5 bytes 23-26 of the ibm,architecture.vec node. Each of these options is a pair of bytes, thus for 4 options we have a max length of 8 bytes. Signed-off-by: Suraj Jitindar Singh --- arch/powerpc/kernel/prom_init.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 9b38a2e5dd35..ce5fc03dc69f 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -1131,12 +1131,15 @@ static void __init prom_check_platform_support(void) "ibm,arch-vec-5-platform-support"); if (prop_len > 1) { int i; - u8 vec[prop_len]; + u8 vec[8]; prom_debug("Found ibm,arch-vec-5-platform-support, len: %d\n", prop_len); + if (prop_len > sizeof(vec)) + prom_printf("WARNING: ibm,arch-vec-5-platform-support longer "\ + " than expected (len: %d)\n", prop_len); prom_getprop(prom.chosen, "ibm,arch-vec-5-platform-support", &vec, sizeof(vec)); - for (i = 0; i < prop_len; i += 2) { + for (i = 0; i < sizeof(vec); i += 2) { prom_debug("%d: index = 0x%x val = 0x%x\n", i / 2 , vec[i] , vec[i + 1]); -- 2.13.6
[PATCH 2/2] powerpc/pseries: Remove VLA from lparcfg_write()
In lparcfg_write we hard code kbuf_sz and then use this as the variable length of kbuf creating a variable length array. Since we're hard coding the length anyway just define the array using this as the length and remove the need for kbuf_sz, thus removing the variable length array. Signed-off-by: Suraj Jitindar Singh --- arch/powerpc/platforms/pseries/lparcfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c index 7c872dc01bdb..8bd590af488a 100644 --- a/arch/powerpc/platforms/pseries/lparcfg.c +++ b/arch/powerpc/platforms/pseries/lparcfg.c @@ -585,8 +585,7 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight) static ssize_t lparcfg_write(struct file *file, const char __user * buf, size_t count, loff_t * off) { - int kbuf_sz = 64; - char kbuf[kbuf_sz]; + char kbuf[64]; char *tmp; u64 new_entitled, *new_entitled_ptr = &new_entitled; u8 new_weight, *new_weight_ptr = &new_weight; @@ -595,7 +594,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf, if (!firmware_has_feature(FW_FEATURE_SPLPAR)) return -EINVAL; - if (count > kbuf_sz) + if (count > sizeof(kbuf)) return -EINVAL; if (copy_from_user(kbuf, buf, count)) -- 2.13.6
[PATCH 0/2] Remove Variable Length Arrays from powerpc code
This patch series removes two Variable Length Arrays (VLAs) from the powerpc code. Series based on v4.19-rc2 Suraj Jitindar Singh (2): powerpc/prom: Remove VLA in prom_check_platform_support() powerpc/pseries: Remove VLA from lparcfg_write() arch/powerpc/kernel/prom_init.c | 7 +-- arch/powerpc/platforms/pseries/lparcfg.c | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) -- 2.13.6
Re: [PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd instruction emulation
On Mon, Sep 03, 2018 at 08:49:35PM +0530, Sandipan Das wrote: > + case 538: /* cnttzw */ > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > + return -1; > + val = (unsigned int) regs->gpr[rd]; > + op->val = ( val ? __builtin_ctz(val) : 32 ); > + goto logical_done; > +#ifdef __powerpc64__ > + case 570: /* cnttzd */ > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > + return -1; > + val = regs->gpr[rd]; > + op->val = ( val ? __builtin_ctzl(val) : 64 ); > + goto logical_done; __builtin_ctz(val) is undefined for val == 0. Segher
Re: [PATCH 1/6] powerpc sstep: Add maddhd, maddhdu, maddld instruction emulation
On Mon, Sep 03, 2018 at 08:49:33PM +0530, Sandipan Das wrote: > +#ifdef __powerpc64__ > + case 4: > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > + return -1; > + > + switch (instr & 0x3f) { > + case 48:/* maddhd */ > + asm("maddhd %0,%1,%2,%3" : "=r" (op->val) : > + "r" (regs->gpr[ra]), "r" (regs->gpr[rb]), > + "r" (regs->gpr[rc])); > + goto compute_done; If running maddhd does not work, will running it in kernel mode work? I think you should *actually* emulate it. (Same for the next patch, "darn", but emulation of that is much more interesting). Segher
Re: Regression from patch 'tty: hvc: hvc_poll() break hv read loop'
On Wed, Sep 05, 2018 at 07:15:29AM +1000, Nicholas Piggin wrote: > On Tue, 4 Sep 2018 11:48:08 -0600 > Jason Gunthorpe wrote: > > > Hi Nicholas, > > > > I am testing 4.19-rc2 and I see bad behavior with my qemu hvc0 > > console.. > > > > Running interactive with qemu (qemu-2.11.2-1.fc28) on the console > > providing hvc0, using options like: > > > > -nographic > > -chardev stdio,id=stdio,mux=on,signal=off > > -mon chardev=stdio > > -device isa-serial,chardev=stdio > > -device virtio-serial-pci > > -device virtconsole,chardev=stdio > > > > I see the hvc0 console hang regularly, ie doing something like 'up > > arrow' in bash causes the hvc0 console to hang. Prior kernels worked > > OK. > > > > Any ideas? I'm not familiar with this code.. Thanks! > > Yes I have had another report, I'm working on a fix. Sorry it has taken > a while and thank you for the report. Okay, let me know when you have a fix and I will be able to test it for you! Thanks, Jason
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
On Tue, Sep 04, 2018 at 12:15:23AM +0200, Henrik Austad wrote: > This is a respin with a wider audience (all that get_maintainer returned) > and I know this spams a *lot* of people. Not sure what would be the correct > way, so my apologies for ruining your inbox. > > The 00-INDEX files are supposed to give a summary of all files present > in a directory, but these files are horribly out of date and their > usefulness is brought into question. Often a simple "ls" would reveal > the same information as the filenames are generally quite descriptive as > a short introduction to what the file covers (it should not surprise > anyone what Documentation/sched/sched-design-CFS.txt covers) > > A few years back it was mentioned that these files were no longer really > needed, and they have since then grown further out of date, so perhaps > it is time to just throw them out. > > A short status yields the following _outdated_ 00-INDEX files, first > counter is files listed in 00-INDEX but missing in the directory, last > is files present but not listed in 00-INDEX. > > List of outdated 00-INDEX: > Documentation: (4/10) > Documentation/sysctl: (0/1) > Documentation/timers: (1/0) > Documentation/blockdev: (3/1) > Documentation/w1/slaves: (0/1) > Documentation/locking: (0/1) > Documentation/devicetree: (0/5) > Documentation/power: (1/1) > Documentation/powerpc: (0/5) > Documentation/arm: (1/0) > Documentation/x86: (0/9) > Documentation/x86/x86_64: (1/1) > Documentation/scsi: (4/4) > Documentation/filesystems: (2/9) > Documentation/filesystems/nfs: (0/2) > Documentation/cgroup-v1: (0/2) > Documentation/kbuild: (0/4) > Documentation/spi: (1/0) > Documentation/virtual/kvm: (1/0) > Documentation/scheduler: (0/2) > Documentation/fb: (0/1) > Documentation/block: (0/1) > Documentation/networking: (6/37) > Documentation/vm: (1/3) > > Then there are 364 subdirectories in Documentation/ with several files that > are missing 00-INDEX alltogether (and another 120 with a single file and no > 00-INDEX). > > I don't really have an opinion to whether or not we /should/ have 00-INDEX, > but the above 00-INDEX should either be removed or be kept up to date. If > we should keep the files, I can try to keep them updated, but I rather not > if we just want to delete them anyway. > > As a starting point, remove all index-files and references to 00-INDEX and > see where the discussion is going. For the Documentation/vm Acked-by: Mike Rapoport > Again, sorry for the insanely wide distribution. > > Signed-off-by: Henrik Austad > Cc: Jonathan Corbet > Cc: Bjorn Helgaas > Cc: "Paul E. McKenney" > Cc: Josh Triplett > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Cc: Jens Axboe > Cc: Rob Herring > Cc: Mark Rutland > Cc: Bartlomiej Zolnierkiewicz > Cc: Linus Walleij > Cc: "David S. Miller" > Cc: Karsten Keil > Cc: Masahiro Yamada > Cc: Michal Marek > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Will Deacon > Cc: Ralf Baechle > Cc: Paul Burton > Cc: James Hogan > Cc: Paul Moore > Cc: "James E.J. Bottomley" > Cc: Helge Deller > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Pavel Machek > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Greg Kroah-Hartman > Cc: Jiri Slaby > Cc: Mark Brown > Cc: Thomas Gleixner > Cc: Paolo Bonzini > Cc: "Radim Krčmář" > Cc: Evgeniy Polyakov > Cc: "H. Peter Anvin" > Cc: x...@kernel.org > Cc: Henrik Austad > Cc: Andrew Morton > Cc: Ian Kent > Cc: Jacek Anaszewski > Cc: Mike Rapoport > Cc: Jan Kandziora > Cc: linux-...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: devicet...@vger.kernel.org > Cc: dri-de...@lists.freedesktop.org > Cc: linux-fb...@vger.kernel.org > Cc: linux-g...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: net...@vger.kernel.org > Cc: linux-kbu...@vger.kernel.org > Cc: linux-m...@linux-mips.org > Cc: linux-security-mod...@vger.kernel.org > Cc: linux-par...@vger.kernel.org > Cc: linux...@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: k...@vger.kernel.org > Signed-off-by: Henrik Austad > --- > Documentation/00-INDEX | 428 > > Documentation/PCI/00-INDEX | 26 -- > Documentation/RCU/00-INDEX | 34 --- > Documentation/RCU/rcu.txt | 4 - > Documentation/admin-guide/README.rst| 3 +- > Documentation/arm/00-INDEX | 50 > Documentation/block/00-INDEX| 34 --- > Documentation/blockdev/00-INDEX | 18 -- > Documentation/cdrom/00-INDEX| 11 - > Documentation/cgroup-v1/00-INDEX| 26 -- > Documentation/devicetree/00-INDEX | 12 - > Documentation/fb/00-INDEX | 75 -- > Documentation/filesystems/00-INDEX | 153 > Documentation/filesystems/nfs/0
Regression from patch 'tty: hvc: hvc_poll() break hv read loop'
Hi Nicholas, I am testing 4.19-rc2 and I see bad behavior with my qemu hvc0 console.. Running interactive with qemu (qemu-2.11.2-1.fc28) on the console providing hvc0, using options like: -nographic -chardev stdio,id=stdio,mux=on,signal=off -mon chardev=stdio -device isa-serial,chardev=stdio -device virtio-serial-pci -device virtconsole,chardev=stdio I see the hvc0 console hang regularly, ie doing something like 'up arrow' in bash causes the hvc0 console to hang. Prior kernels worked OK. Any ideas? I'm not familiar with this code.. Thanks! git bisect says this patch is to blame: # bad: [5b394b2ddf0347bef56e50c69a58773c94343ff3] Linux 4.19-rc1 # good: [845b397a7771f2d3504beff5521f452be0d22eec] IB/ucm: fix UCM link error # bad: [60c1f89241d49bacf71035470684a8d7b4bb46ea] Merge tag 'dma-mapping-4.19-2' of git://git.infradead.org/users/hch/dma-mapping # bad: [1290290c922fdcefbce8984e6e44b8f4e3a169b5] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma # bad: [6eaac34ff30e189fda28110298ca9fbfb2f51e28] Merge tag 'linux-watchdog-4.19-rc1' of git://www.linux-watchdog.org/linux-watchdog # good: [e4f6a44c4aeca9eda153302abb0c14d053914f72] staging:rtl8192u: Remove unused macro definitions - Style # bad: [5695d5d1970f975de059bb6dec76941440f62488] Merge tag 'usb-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb # bad: [f80a71b0c4111e26433744721ad68f05c169ad39] Merge tag 'drm-next-2018-08-17' of git://anongit.freedesktop.org/drm/drm # good: [cf175dc315f90185128fb061dc05b6fbb211aa2f] powerpc/64: Disable the speculation barrier from the command line # bad: [a2dc009afa9ae8b92305be7728676562a104cb40] powerpc/mm/book3s/radix: Add mapping statistics # good: [d6690b1a9b0dd95a6fbd166d9657e0cc80afbf99] powerpc: Allow CPU selection of e300core variants # good: [f2c6d0d1092e3da2bd36c768777e883fa3908548] powerpc/32: Include setup.h header file to fix warnings # good: [b3124ec2f9970c7374d34b00843d9791fca66afc] Merge branch 'fixes' into next # bad: [70b5c4ee8e3bf7ce107d6926d9c7d8ebb68578c2] Merge branch 'topic/hvc' into next # bad: [cfb5946b55f1dfd19e042feae1fbff6041e25a98] tty: hvc: hvc_poll() may sleep # bad: [ec97eaad1383ab2500fcf9a07ade6044fbcc67f5] tty: hvc: hvc_poll() break hv read loop # good: [a9bf5c8a271b9a954709b7ada1bd258f5cadf7ff] tty: hvc: use mutex instead of spinlock for hvc_structs lock # first bad commit: [ec97eaad1383ab2500fcf9a07ade6044fbcc67f5] tty: hvc: hvc_poll() break hv read loop >From ec97eaad1383ab2500fcf9a07ade6044fbcc67f5 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Tue, 1 May 2018 00:55:54 +1000 Subject: [PATCH] tty: hvc: hvc_poll() break hv read loop Avoid looping with the spinlock held while there is read data being returned from the hv driver. Instead note if the entire size returned by tty_buffer_request_room was read, and request another read poll. This limits the critical section lengths, and provides more even service to other consoles in case there is a pathological condition. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman --- drivers/tty/hvc/hvc_console.c | 88 ++- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index fddb63322c6786..745ac220fce84c 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -592,7 +592,7 @@ static u32 timeout = MIN_TIMEOUT; int hvc_poll(struct hvc_struct *hp) { struct tty_struct *tty; - int i, n, poll_mask = 0; + int i, n, count, poll_mask = 0; char buf[N_INBUF] __ALIGNED__; unsigned long flags; int read_total = 0; @@ -618,7 +618,7 @@ int hvc_poll(struct hvc_struct *hp) /* Now check if we can get data (are we throttled ?) */ if (tty_throttled(tty)) - goto throttled; + goto out; /* If we aren't notifier driven and aren't throttled, we always * request a reschedule @@ -627,56 +627,58 @@ int hvc_poll(struct hvc_struct *hp) poll_mask |= HVC_POLL_READ; /* Read data if any */ - for (;;) { - int count = tty_buffer_request_room(&hp->port, N_INBUF); - /* If flip is full, just reschedule a later read */ - if (count == 0) { + count = tty_buffer_request_room(&hp->port, N_INBUF); + + /* If flip is full, just reschedule a later read */ + if (count == 0) { + poll_mask |= HVC_POLL_READ; + goto out; + } + + n = hp->ops->get_chars(hp->vtermno, buf, count); + if (n <= 0) { + /* Hangup the tty when disconnected from host */ + if (n == -EPIPE) { + spin_unlock_irqrestore(&hp->lock, flags); + tty_hangup(tty); + spin_lock_irqsave(&hp->lock, flags); + } else i
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
On 9/3/18 4:15 PM, Henrik Austad wrote: > This is a respin with a wider audience (all that get_maintainer returned) > and I know this spams a *lot* of people. Not sure what would be the correct > way, so my apologies for ruining your inbox. > > The 00-INDEX files are supposed to give a summary of all files present > in a directory, but these files are horribly out of date and their > usefulness is brought into question. Often a simple "ls" would reveal > the same information as the filenames are generally quite descriptive as > a short introduction to what the file covers (it should not surprise > anyone what Documentation/sched/sched-design-CFS.txt covers) > > A few years back it was mentioned that these files were no longer really > needed, and they have since then grown further out of date, so perhaps > it is time to just throw them out. > > A short status yields the following _outdated_ 00-INDEX files, first > counter is files listed in 00-INDEX but missing in the directory, last > is files present but not listed in 00-INDEX. For the block related bits: Reviewed-by: Jens Axboe -- Jens Axboe
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
On Tue, 4 Sep 2018 13:30:30 +0200 Pavel Machek wrote: > I'd say this is still quite valueable, and it might be worth fixing, > rather then removing completely. I agree. Perhaps we should have a 00-DESCRIPTION file in each directory, and each file could start with a: DESCRIPTION: and then these files could be generated by those that have these tags. -- Steve
[PATCH v3] macintosh: Convert to using %pOFn instead of device_node.name
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Benjamin Herrenschmidt Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring --- v3: - Fix dev_name handling. Using "%.*p" syntax throws a warning (and probably doesn't work). drivers/macintosh/macio_asic.c| 8 +--- drivers/macintosh/macio_sysfs.c | 8 +++- drivers/macintosh/windfarm_smu_controls.c | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 07074820a167..58e676ca9622 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -362,7 +362,8 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, { struct macio_dev *dev; const u32 *reg; - + char name[MAX_NODE_NAME_SIZE + 1]; + if (np == NULL) return NULL; @@ -402,6 +403,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, #endif /* MacIO itself has a different reg, we use it's PCI base */ +snprintf(name, sizeof(name), "%pOFn", np); if (np == chip->of_node) { dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", chip->lbus.index, @@ -410,12 +412,12 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, #else 0, /* NuBus may want to do something better here */ #endif - MAX_NODE_NAME_SIZE, np->name); + MAX_NODE_NAME_SIZE, name); } else { reg = of_get_property(np, "reg", NULL); dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", chip->lbus.index, -reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); +reg ? *reg : 0, MAX_NODE_NAME_SIZE, name); } /* Setup interrupts & resources */ diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index ca4fcffe454b..d2451e58acb9 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c @@ -58,7 +58,13 @@ static ssize_t devspec_show(struct device *dev, static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(devspec); -macio_config_of_attr (name, "%s\n"); +static ssize_t name_show(struct device *dev, +struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%pOFn\n", dev->of_node); +} +static DEVICE_ATTR_RO(name); + macio_config_of_attr (type, "%s\n"); static struct attribute *macio_dev_attrs[] = { diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index d174c7437337..86d65462a61c 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c @@ -277,7 +277,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 0); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "RPM fan %s\n", fan->name); + "RPM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans); @@ -296,7 +296,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 1); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "PWM fan %s\n", fan->name); + "PWM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans); -- 2.17.1
Re: [PATCH 6/6] powerpc sstep: Add modsd, modud instruction emulation
On Mon, Sep 03, 2018 at 08:49:38PM +0530, Sandipan Das wrote: > +#ifdef __powerpc64__ > + case 265: /* modud */ > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > + return -1; > + op->val = regs->gpr[ra] % regs->gpr[rb]; > + goto compute_done; > +#endif The mod instruction has special cases that aren't handled by this C code, too (divide by 0, or signed division of the most negative number by -1). For the mod intruction the behaviour is undefined in those cases, but you probably should force some specific behaviour. You don't want the kernel to execute a trap instruction, etc. :-) Segher
Re: Regression from patch 'tty: hvc: hvc_poll() break hv read loop'
On Tue, 4 Sep 2018 11:48:08 -0600 Jason Gunthorpe wrote: > Hi Nicholas, > > I am testing 4.19-rc2 and I see bad behavior with my qemu hvc0 > console.. > > Running interactive with qemu (qemu-2.11.2-1.fc28) on the console > providing hvc0, using options like: > > -nographic > -chardev stdio,id=stdio,mux=on,signal=off > -mon chardev=stdio > -device isa-serial,chardev=stdio > -device virtio-serial-pci > -device virtconsole,chardev=stdio > > I see the hvc0 console hang regularly, ie doing something like 'up > arrow' in bash causes the hvc0 console to hang. Prior kernels worked > OK. > > Any ideas? I'm not familiar with this code.. Thanks! Yes I have had another report, I'm working on a fix. Sorry it has taken a while and thank you for the report. Thanks, Nick
[PATCH v2] macintosh: Convert to using %pOFn instead of device_node.name
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Benjamin Herrenschmidt Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring --- v2: Add setting dev_name in macio_asic.c drivers/macintosh/macio_asic.c| 8 drivers/macintosh/macio_sysfs.c | 8 +++- drivers/macintosh/windfarm_smu_controls.c | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 07074820a167..cf2d3b3dd599 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -403,19 +403,19 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, /* MacIO itself has a different reg, we use it's PCI base */ if (np == chip->of_node) { - dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", + dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*pOFn", chip->lbus.index, #ifdef CONFIG_PCI (unsigned int)pci_resource_start(chip->lbus.pdev, 0), #else 0, /* NuBus may want to do something better here */ #endif - MAX_NODE_NAME_SIZE, np->name); + MAX_NODE_NAME_SIZE, np); } else { reg = of_get_property(np, "reg", NULL); - dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", + dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*pOFn", chip->lbus.index, -reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); +reg ? *reg : 0, MAX_NODE_NAME_SIZE, np); } /* Setup interrupts & resources */ diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index ca4fcffe454b..d2451e58acb9 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c @@ -58,7 +58,13 @@ static ssize_t devspec_show(struct device *dev, static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(devspec); -macio_config_of_attr (name, "%s\n"); +static ssize_t name_show(struct device *dev, +struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%pOFn\n", dev->of_node); +} +static DEVICE_ATTR_RO(name); + macio_config_of_attr (type, "%s\n"); static struct attribute *macio_dev_attrs[] = { diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index d174c7437337..86d65462a61c 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c @@ -277,7 +277,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 0); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "RPM fan %s\n", fan->name); + "RPM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans); @@ -296,7 +296,7 @@ static int __init smu_controls_init(void) fct = smu_fan_create(fan, 1); if (fct == NULL) { printk(KERN_WARNING "windfarm: Failed to create SMU " - "PWM fan %s\n", fan->name); + "PWM fan %pOFn\n", fan); continue; } list_add(&fct->link, &smu_fans); -- 2.17.1
Re: [PATCH 2/3] Documentation: dt: binding: fsl: update property description for RCPM
On Fri, Aug 31, 2018 at 11:52:18AM +0800, Ran Wang wrote: > Add property 'big-endian' and supportted IP's configuration info. > Remove property 'fsl,#rcpm-wakeup-cell'. "dt-bindings: soc: ..." for the subject It is obvious reading the diff you are removing fsl,#rcpm-wakeup-cell. What is not obvious is why? The commit msg should answer that. You also are mixing several things in this patch like adding ls1012 which you don't mention. Please split. > > Signed-off-by: Ran Wang > --- > Documentation/devicetree/bindings/soc/fsl/rcpm.txt | 42 ++- > 1 files changed, 13 insertions(+), 29 deletions(-)
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
On Tue, Sep 04, 2018 at 12:15:23AM +0200, Henrik Austad wrote: > This is a respin with a wider audience (all that get_maintainer returned) > and I know this spams a *lot* of people. Not sure what would be the correct > way, so my apologies for ruining your inbox. > > The 00-INDEX files are supposed to give a summary of all files present > in a directory, but these files are horribly out of date and their > usefulness is brought into question. Often a simple "ls" would reveal > the same information as the filenames are generally quite descriptive as > a short introduction to what the file covers (it should not surprise > anyone what Documentation/sched/sched-design-CFS.txt covers) > > A few years back it was mentioned that these files were no longer really > needed, and they have since then grown further out of date, so perhaps > it is time to just throw them out. > > A short status yields the following _outdated_ 00-INDEX files, first > counter is files listed in 00-INDEX but missing in the directory, last > is files present but not listed in 00-INDEX. > > List of outdated 00-INDEX: > Documentation: (4/10) > Documentation/sysctl: (0/1) > Documentation/timers: (1/0) > Documentation/blockdev: (3/1) > Documentation/w1/slaves: (0/1) > Documentation/locking: (0/1) > Documentation/devicetree: (0/5) > Documentation/power: (1/1) > Documentation/powerpc: (0/5) > Documentation/arm: (1/0) > Documentation/x86: (0/9) > Documentation/x86/x86_64: (1/1) > Documentation/scsi: (4/4) > Documentation/filesystems: (2/9) > Documentation/filesystems/nfs: (0/2) > Documentation/cgroup-v1: (0/2) > Documentation/kbuild: (0/4) > Documentation/spi: (1/0) > Documentation/virtual/kvm: (1/0) > Documentation/scheduler: (0/2) > Documentation/fb: (0/1) > Documentation/block: (0/1) > Documentation/networking: (6/37) > Documentation/vm: (1/3) > > Then there are 364 subdirectories in Documentation/ with several files that > are missing 00-INDEX alltogether (and another 120 with a single file and no > 00-INDEX). > > I don't really have an opinion to whether or not we /should/ have 00-INDEX, > but the above 00-INDEX should either be removed or be kept up to date. If > we should keep the files, I can try to keep them updated, but I rather not > if we just want to delete them anyway. > > As a starting point, remove all index-files and references to 00-INDEX and > see where the discussion is going. For the RCU portions: Acked-by: Paul E. McKenney > Again, sorry for the insanely wide distribution. > > Signed-off-by: Henrik Austad > Cc: Jonathan Corbet > Cc: Bjorn Helgaas > Cc: "Paul E. McKenney" > Cc: Josh Triplett > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Cc: Jens Axboe > Cc: Rob Herring > Cc: Mark Rutland > Cc: Bartlomiej Zolnierkiewicz > Cc: Linus Walleij > Cc: "David S. Miller" > Cc: Karsten Keil > Cc: Masahiro Yamada > Cc: Michal Marek > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Will Deacon > Cc: Ralf Baechle > Cc: Paul Burton > Cc: James Hogan > Cc: Paul Moore > Cc: "James E.J. Bottomley" > Cc: Helge Deller > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Pavel Machek > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Greg Kroah-Hartman > Cc: Jiri Slaby > Cc: Mark Brown > Cc: Thomas Gleixner > Cc: Paolo Bonzini > Cc: "Radim Krčmář" > Cc: Evgeniy Polyakov > Cc: "H. Peter Anvin" > Cc: x...@kernel.org > Cc: Henrik Austad > Cc: Andrew Morton > Cc: Ian Kent > Cc: Jacek Anaszewski > Cc: Mike Rapoport > Cc: Jan Kandziora > Cc: linux-...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: devicet...@vger.kernel.org > Cc: dri-de...@lists.freedesktop.org > Cc: linux-fb...@vger.kernel.org > Cc: linux-g...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: net...@vger.kernel.org > Cc: linux-kbu...@vger.kernel.org > Cc: linux-m...@linux-mips.org > Cc: linux-security-mod...@vger.kernel.org > Cc: linux-par...@vger.kernel.org > Cc: linux...@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: k...@vger.kernel.org > Signed-off-by: Henrik Austad > --- > Documentation/00-INDEX | 428 > > Documentation/PCI/00-INDEX | 26 -- > Documentation/RCU/00-INDEX | 34 --- > Documentation/RCU/rcu.txt | 4 - > Documentation/admin-guide/README.rst| 3 +- > Documentation/arm/00-INDEX | 50 > Documentation/block/00-INDEX| 34 --- > Documentation/blockdev/00-INDEX | 18 -- > Documentation/cdrom/00-INDEX| 11 - > Documentation/cgroup-v1/00-INDEX| 26 -- > Documentation/devicetree/00-INDEX | 12 - > Documentation/fb/00-INDEX | 75 -- > Documentation/filesystems/00-INDEX | 153 > Documentation/filesystems/nfs/00
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
Hi! > The 00-INDEX files are supposed to give a summary of all files present > in a directory, but these files are horribly out of date and their > usefulness is brought into question. Often a simple "ls" would reveal > the same information as the filenames are generally quite descriptive as > a short introduction to what the file covers (it should not surprise > -SAK.txt > - - info on Secure Attention Keys. > -SM501.txt > - - Silicon Motion SM501 multimedia companion chip > -btmrvl.txt > - - info on Marvell Bluetooth driver usage. Well, I don't know what sm501 is, but description helps me. SAK is similar. .. as is btmrvl. I'd say this is still quite valueable, and it might be worth fixing, rather then removing completely. And yes, moving stuff to subdirectories and naming files reasonably would help, too. "btmrvl" is really bad name... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature
Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
On Tue, Sep 04, 2018 at 12:15:23AM +0200, Henrik Austad wrote: > This is a respin with a wider audience (all that get_maintainer returned) > and I know this spams a *lot* of people. Not sure what would be the correct > way, so my apologies for ruining your inbox. Acked-by: Mark Brown signature.asc Description: PGP signature
Re: [PATCH 01/25] tty: Change return type to void
Hello! On 9/4/2018 5:44 AM, Jaejoong Kim wrote: Many drivers with tty use the tty_stand_install(). But, there is no need to handle the error, since it always returns 0. So, change the return type of tty_standard_install() and tty_port_install() to void type and remove unnecessary exception handling where we use these functions. Signed-off-by: Jaejoong Kim --- drivers/tty/tty_io.c | 10 ++ drivers/tty/tty_port.c | 4 ++-- include/linux/tty.h| 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) [...] diff --git a/include/linux/tty.h b/include/linux/tty.h index c56e397..63cdac1 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -556,7 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); extern void tty_release_struct(struct tty_struct *tty, int idx); extern int tty_release(struct inode *inode, struct file *filp); extern void tty_init_termios(struct tty_struct *tty); -extern int tty_standard_install(struct tty_driver *driver, +extern void tty_standard_install(struct tty_driver *driver, struct tty_struct *tty); extern struct mutex tty_mutex; @@ -688,7 +688,7 @@ extern int tty_port_close_start(struct tty_port *port, extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); extern void tty_port_close(struct tty_port *port, struct tty_struct *tty, struct file *filp); -extern int tty_port_install(struct tty_port *port, struct tty_driver *driver, +extern void tty_port_install(struct tty_port *port, struct tty_driver *driver, struct tty_struct *tty); You need to update all the callers in the same patch -- the kernel must remain buildable after each patch but you seem to have spread that update among a lot of patches.. [...] MBR, Sergei
[PATCH] powerpc/pseries: Export VPA related data
This patch exports VPA related data such as stolen and donated CPU cycles through /proc/powerpc/lparcfg file. Signed-off-by: Aravinda Prasad --- arch/powerpc/include/asm/lppaca.h| 10 ++- arch/powerpc/platforms/pseries/lparcfg.c | 45 ++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index 7c23ce8..87e22f6 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h @@ -94,7 +94,15 @@ struct lppaca { volatile __be32 dispersion_count; /* dispatch changed physical cpu */ volatile __be64 cmo_faults; /* CMO page fault count */ volatile __be64 cmo_fault_time; /* CMO page fault time */ - u8 reserved10[104]; + volatile __be64 idle_stolen_purr; + volatile __be64 idle_stolen_spurr; + volatile __be64 busy_stolen_purr; + volatile __be64 busy_stolen_spurr; + volatile __be64 idle_donated_purr; + volatile __be64 idle_donated_spurr; + volatile __be64 busy_donated_purr; + volatile __be64 busy_donated_spurr; + u8 reserved10[40]; /* cacheline 4-5 */ diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c index 7c872dc..b986551 100644 --- a/arch/powerpc/platforms/pseries/lparcfg.c +++ b/arch/powerpc/platforms/pseries/lparcfg.c @@ -433,6 +433,50 @@ static void parse_em_data(struct seq_file *m) seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]); } +static void pseries_vpa_data(struct seq_file *m) +{ + int cpu; + unsigned long idle_stolen_purr = 0; + unsigned long idle_stolen_spurr = 0; + unsigned long busy_stolen_purr = 0; + unsigned long busy_stolen_spurr = 0; + unsigned long idle_donated_purr = 0; + unsigned long idle_donated_spurr = 0; + unsigned long busy_donated_purr = 0; + unsigned long busy_donated_spurr = 0; + + if (!firmware_has_feature(FW_FEATURE_SPLPAR)) + return; + + for_each_possible_cpu(cpu) { + idle_stolen_purr += + be64_to_cpu(lppaca_of(cpu).idle_stolen_purr); + idle_stolen_spurr += + be64_to_cpu(lppaca_of(cpu).idle_stolen_spurr); + busy_stolen_purr += + be64_to_cpu(lppaca_of(cpu).busy_stolen_purr); + busy_stolen_spurr += + be64_to_cpu(lppaca_of(cpu).busy_stolen_spurr); + idle_donated_purr += + be64_to_cpu(lppaca_of(cpu).idle_donated_purr); + idle_donated_spurr += + be64_to_cpu(lppaca_of(cpu).idle_donated_spurr); + busy_donated_purr += + be64_to_cpu(lppaca_of(cpu).busy_donated_purr); + busy_donated_spurr += + be64_to_cpu(lppaca_of(cpu).busy_donated_spurr); + } + + seq_printf(m, "idle_stolen_purr=%lu\n", idle_stolen_purr); + seq_printf(m, "idle_stolen_spurr=%lu\n", idle_stolen_spurr); + seq_printf(m, "busy_stolen_purr=%lu\n", busy_stolen_purr); + seq_printf(m, "busy_stolen_spurr=%lu\n", busy_stolen_spurr); + seq_printf(m, "idle_donated_purr=%lu\n", idle_donated_purr); + seq_printf(m, "idle_donated_spurr=%lu\n", idle_donated_spurr); + seq_printf(m, "busy_donated_purr=%lu\n", busy_donated_purr); + seq_printf(m, "busy_donated_spurr=%lu\n", busy_donated_spurr); +} + static int pseries_lparcfg_data(struct seq_file *m, void *v) { int partition_potential_processors; @@ -491,6 +535,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) seq_printf(m, "slb_size=%d\n", mmu_slb_size); #endif parse_em_data(m); + pseries_vpa_data(m); return 0; }
Re: [PATCH] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size
On 09/04/2018 01:46 PM, Nicholas Piggin wrote: THP paths can defer splitting compound pages until after the actual remap and TLB flushes to split a huge PMD/PUD. This causes radix partition scope page table mappings to get out of synch with the host qemu page table mappings. May be we can improve this further? With deferred_split_huge_page() during partial unmap we split the huge pmd entries but defer splitting the compound page to shrinker (9a982250f773cc8c76f1eee68a770b7cbf2faf78). That means we can find the page as huge/compound page even when the actual mapping is not. Instead of looking at whether the page is compound or not, always walk the page table and find the pte shift so that we map it correctly in the partition scoped table. Reviewed-by: Aneesh Kumar K.V This results in random memory corruption in the guest when running with THP. The easiest way to reproduce is use KVM baloon to free up a lot of memory in the guest and then shrink the balloon to give the memory back, while some work is being done in the guest. Cc: Paul Mackerras Cc: David Gibson Cc: "Aneesh Kumar K.V" Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_mmu_radix.c | 88 ++ 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 0af1c0aea1fe..d8792445d95a 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -525,8 +525,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, unsigned long ea, unsigned long dsisr) { struct kvm *kvm = vcpu->kvm; - unsigned long mmu_seq, pte_size; - unsigned long gpa, gfn, hva, pfn; + unsigned long mmu_seq; + unsigned long gpa, gfn, hva; struct kvm_memory_slot *memslot; struct page *page = NULL; long ret; @@ -623,9 +623,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, */ hva = gfn_to_hva_memslot(memslot, gfn); if (upgrade_p && __get_user_pages_fast(hva, 1, 1, &page) == 1) { - pfn = page_to_pfn(page); upgrade_write = true; } else { + unsigned long pfn; + /* Call KVM generic code to do the slow-path check */ pfn = __gfn_to_pfn_memslot(memslot, gfn, false, NULL, writing, upgrade_p); @@ -639,63 +640,42 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, } } - /* See if we can insert a 1GB or 2MB large PTE here */ - level = 0; - if (page && PageCompound(page)) { - pte_size = PAGE_SIZE << compound_order(compound_head(page)); - if (pte_size >= PUD_SIZE && - (gpa & (PUD_SIZE - PAGE_SIZE)) == - (hva & (PUD_SIZE - PAGE_SIZE))) { - level = 2; - pfn &= ~((PUD_SIZE >> PAGE_SHIFT) - 1); - } else if (pte_size >= PMD_SIZE && - (gpa & (PMD_SIZE - PAGE_SIZE)) == - (hva & (PMD_SIZE - PAGE_SIZE))) { - level = 1; - pfn &= ~((PMD_SIZE >> PAGE_SHIFT) - 1); - } - } - /* -* Compute the PTE value that we need to insert. +* Read the PTE from the process' radix tree and use that +* so we get the shift and attribute bits. */ - if (page) { - pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE | - _PAGE_ACCESSED; - if (writing || upgrade_write) - pgflags |= _PAGE_WRITE | _PAGE_DIRTY; - pte = pfn_pte(pfn, __pgprot(pgflags)); + local_irq_disable(); + ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); + pte = *ptep; + local_irq_enable(); + + /* Get pte level from shift/size */ + if (shift == PUD_SHIFT && + (gpa & (PUD_SIZE - PAGE_SIZE)) == + (hva & (PUD_SIZE - PAGE_SIZE))) { + level = 2; + } else if (shift == PMD_SHIFT && + (gpa & (PMD_SIZE - PAGE_SIZE)) == + (hva & (PMD_SIZE - PAGE_SIZE))) { + level = 1; } else { - /* -* Read the PTE from the process' radix tree and use that -* so we get the attribute bits. -*/ - local_irq_disable(); - ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); - pte = *ptep; - local_irq_enable(); - if (shift == PUD_SHIFT && - (gpa & (PUD_SIZE - PAGE_SIZE)) == - (hva & (PUD_SIZE - PAGE_SIZE))) { -
Re: [RFC PATCH 2/3] powerpc/mm/iommu: Allow large IOMMU page size only for hugetlb backing
On 09/04/2018 09:36 AM, David Gibson wrote: On Mon, Sep 03, 2018 at 10:07:32PM +0530, Aneesh Kumar K.V wrote: THP pages can get split during different code paths. An incremented reference count do imply we will not split the compound page. But the pmd entry can be converted to level 4 pte entries. Keep the code simpler by allowing large IOMMU page size only if the guest ram is backed by hugetlb pages. Signed-off-by: Aneesh Kumar K.V So, I oked this in earlier discussion, but I had another thought and now I'm not so sure. --- arch/powerpc/mm/mmu_context_iommu.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c index c9ee9e23845f..f472965f7638 100644 --- a/arch/powerpc/mm/mmu_context_iommu.c +++ b/arch/powerpc/mm/mmu_context_iommu.c @@ -212,21 +212,9 @@ long mm_iommu_get(struct mm_struct *mm, unsigned long ua, unsigned long entries, } populate: pageshift = PAGE_SHIFT; - if (mem->pageshift > PAGE_SHIFT && PageCompound(page)) { - pte_t *pte; + if (mem->pageshift > PAGE_SHIFT && PageHuge(page)) { We can definitely only support large IOMMU pages with static hugepages, not THPs, so the change from PageCompound to PageHuge is definitely correct and a good idea. struct page *head = compound_head(page); - unsigned int compshift = compound_order(head); - unsigned int pteshift; - - local_irq_save(flags); /* disables as well */ - pte = find_linux_pte(mm->pgd, cur_ua, NULL, &pteshift); - - /* Double check it is still the same pinned page */ - if (pte && pte_page(*pte) == head && - pteshift == compshift + PAGE_SHIFT) - pageshift = max_t(unsigned int, pteshift, - PAGE_SHIFT); - local_irq_restore(flags); + pageshift = compound_order(head) + PAGE_SHIFT; But, my concern with this part is: are we totally certain there's no way to get part of a hugetlbfs page mapped with regular sized PTEs (probably in addition to the expected hugetlb mapping). We don't map hugetlb pages that way. They are always pmd mapped on book3s64. I'm thinking weirdness like mremap(), mapping another hugetlb using process's address space via /proc/*/mem or maybe something even more exotic. Now, it's possible that we don't really care here - even if it's not technically right for this mapping, we could argue that as long as the process has access to part of the hugepage, the whole thing is fair game for a DMA mapping. In that case merely double checking that this mapping is properly aligned would suffice (i.e. that: (ua >> PAGE_SHIFT) == (page's index within the compound page) } mem->pageshift = min(mem->pageshift, pageshift); mem->hpas[i] = page_to_pfn(page) << PAGE_SHIFT; -aneesh
[PATCH] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size
THP paths can defer splitting compound pages until after the actual remap and TLB flushes to split a huge PMD/PUD. This causes radix partition scope page table mappings to get out of synch with the host qemu page table mappings. This results in random memory corruption in the guest when running with THP. The easiest way to reproduce is use KVM baloon to free up a lot of memory in the guest and then shrink the balloon to give the memory back, while some work is being done in the guest. Cc: Paul Mackerras Cc: David Gibson Cc: "Aneesh Kumar K.V" Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_mmu_radix.c | 88 ++ 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 0af1c0aea1fe..d8792445d95a 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -525,8 +525,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, unsigned long ea, unsigned long dsisr) { struct kvm *kvm = vcpu->kvm; - unsigned long mmu_seq, pte_size; - unsigned long gpa, gfn, hva, pfn; + unsigned long mmu_seq; + unsigned long gpa, gfn, hva; struct kvm_memory_slot *memslot; struct page *page = NULL; long ret; @@ -623,9 +623,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, */ hva = gfn_to_hva_memslot(memslot, gfn); if (upgrade_p && __get_user_pages_fast(hva, 1, 1, &page) == 1) { - pfn = page_to_pfn(page); upgrade_write = true; } else { + unsigned long pfn; + /* Call KVM generic code to do the slow-path check */ pfn = __gfn_to_pfn_memslot(memslot, gfn, false, NULL, writing, upgrade_p); @@ -639,63 +640,42 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, } } - /* See if we can insert a 1GB or 2MB large PTE here */ - level = 0; - if (page && PageCompound(page)) { - pte_size = PAGE_SIZE << compound_order(compound_head(page)); - if (pte_size >= PUD_SIZE && - (gpa & (PUD_SIZE - PAGE_SIZE)) == - (hva & (PUD_SIZE - PAGE_SIZE))) { - level = 2; - pfn &= ~((PUD_SIZE >> PAGE_SHIFT) - 1); - } else if (pte_size >= PMD_SIZE && - (gpa & (PMD_SIZE - PAGE_SIZE)) == - (hva & (PMD_SIZE - PAGE_SIZE))) { - level = 1; - pfn &= ~((PMD_SIZE >> PAGE_SHIFT) - 1); - } - } - /* -* Compute the PTE value that we need to insert. +* Read the PTE from the process' radix tree and use that +* so we get the shift and attribute bits. */ - if (page) { - pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE | - _PAGE_ACCESSED; - if (writing || upgrade_write) - pgflags |= _PAGE_WRITE | _PAGE_DIRTY; - pte = pfn_pte(pfn, __pgprot(pgflags)); + local_irq_disable(); + ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); + pte = *ptep; + local_irq_enable(); + + /* Get pte level from shift/size */ + if (shift == PUD_SHIFT && + (gpa & (PUD_SIZE - PAGE_SIZE)) == + (hva & (PUD_SIZE - PAGE_SIZE))) { + level = 2; + } else if (shift == PMD_SHIFT && + (gpa & (PMD_SIZE - PAGE_SIZE)) == + (hva & (PMD_SIZE - PAGE_SIZE))) { + level = 1; } else { - /* -* Read the PTE from the process' radix tree and use that -* so we get the attribute bits. -*/ - local_irq_disable(); - ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); - pte = *ptep; - local_irq_enable(); - if (shift == PUD_SHIFT && - (gpa & (PUD_SIZE - PAGE_SIZE)) == - (hva & (PUD_SIZE - PAGE_SIZE))) { - level = 2; - } else if (shift == PMD_SHIFT && - (gpa & (PMD_SIZE - PAGE_SIZE)) == - (hva & (PMD_SIZE - PAGE_SIZE))) { - level = 1; - } else if (shift && shift != PAGE_SHIFT) { - /* Adjust PFN */ - unsigned long mask = (1ul << shift) - PAGE_SIZE; - pte = __pte(pte_val(pte) | (hva & mask)); - } - pte = __pte(pte_val(pte) | _PAGE_EXEC | _PAGE_ACCESSED); -