Re: CodingStyle: Clarify and complete chapter 7
>>> A common type of bug to be aware of is "one err bugs" which look like this: >>> >>> -err: >>> + err: >>> kfree(foo->bar); >>> kfree(foo); >>> return ret; >>> >>> The bug in this code is that on some exit paths "foo" is NULL. Normally >>> the >> >> ...except that kfree() can handle null pointers just fine, so this isn't >> actually a bug, right? Someday when somebody has time it would be good to >> come up with a better example. > > But if foo is NULL, An important condition … > foo->bar is not NULL I wonder about this information. Which run-time environment will provide this behaviour? > and so kfree will have a problem with it. I find that the parameter evaluation will result in side effects (because of a null pointer access) which are usually unwanted. So the execution of this function call will eventually not start. > So this is a bug. How do you think about further software development possibilities to improve corresponding exception handling? How much can the selection of jump labels influence the software design? Regards, Markus
Re: [PATCH v3 45/51] x86: remove 64-byte gap at end of irq stack
On Sun, Aug 14, 2016 at 12:52:40AM -0700, Andy Lutomirski wrote: > On Fri, Aug 12, 2016 at 7:29 AM, Josh Poimboeufwrote: > > There has been a 64-byte gap at the end of the irq stack for at least 12 > > years. It predates git history, and I can't find any good reason for > > it. Remove it. What's the worst that could happen? > > I can't think of any reason this would matter. > > For that matter, do you have any idea why irq_stack_union is a union > or why we insist on sticking it at %gs:0? Sure, the *canary* needs to > live at a fixed offset (because GCC is daft, sigh), but I don't see > what that has to do with the rest of the IRQ stack. Good question. I have no idea... -- Josh
[PATCH v2] dma-buf: Wait on the reservation object when sync'ing before CPU access
Rendering operations to the dma-buf are tracked implicitly via the reservation_object (dmabuf->resv). This is used to allow poll() to wait upon outstanding rendering (or just query the current status of rendering). The dma-buf sync ioctl allows userspace to prepare the dma-buf for CPU access, which should include waiting upon rendering. (Some drivers may need to do more work to ensure that the dma-buf mmap is coherent as well as complete.) v2: Always wait upon the reservation object implicitly. We choose to do it after the native handler in case it can do so more efficiently. Testcase: igt/prime_vgem Testcase: igt/gem_concurrent_blit # *vgem* Signed-off-by: Chris WilsonCc: Sumit Semwal Cc: Daniel Vetter Cc: Eric Anholt Cc: linux-me...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: linaro-mm-...@lists.linaro.org Cc: linux-kernel@vger.kernel.org --- drivers/dma-buf/dma-buf.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index ddaee60ae52a..cf04d249a6a4 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -586,6 +586,22 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, } EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment); +static int __dma_buf_begin_cpu_access(struct dma_buf *dmabuf, + enum dma_data_direction direction) +{ + bool write = (direction == DMA_BIDIRECTIONAL || + direction == DMA_TO_DEVICE); + struct reservation_object *resv = dmabuf->resv; + long ret; + + /* Wait on any implicit rendering fences */ + ret = reservation_object_wait_timeout_rcu(resv, write, true, + MAX_SCHEDULE_TIMEOUT); + if (ret < 0) + return ret; + + return 0; +} /** * dma_buf_begin_cpu_access - Must be called before accessing a dma_buf from the @@ -608,6 +624,13 @@ int dma_buf_begin_cpu_access(struct dma_buf *dmabuf, if (dmabuf->ops->begin_cpu_access) ret = dmabuf->ops->begin_cpu_access(dmabuf, direction); + /* Ensure that all fences are waited upon - but we first allow +* the native handler the chance to do so more efficiently if it +* chooses. A double invocation here will be reasonably cheap no-op. +*/ + if (ret == 0) + ret = __dma_buf_begin_cpu_access(dmabuf, direction); + return ret; } EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access); -- 2.8.1
Re: [PATCH v3 10/13] sched/fair: Compute task/cpu utilization at wake-up more correctly
On Mon, Aug 15, 2016 at 04:23:42PM +0200, Peter Zijlstra wrote: > On Mon, Jul 25, 2016 at 02:34:27PM +0100, Morten Rasmussen wrote: > > To solve this problem, this patch introduces task_util_wake() which > > computes the decayed task utilization based on the last update of the > > previous cpu's last load-tracking update. It is done without having to > > take the rq lock, similar to how it is done in remove_entity_load_avg(). > > But unlike that function, it doesn't actually use __update_load_avg(). > Why not? Fair question :) We currently exploit the fact that the task utilization is _not_ updated in wake-up balancing to make sure we don't under-estimate the capacity requirements for tasks that have slept for a while. If we update it, we loose the non-decayed 'peak' utilization, but I guess we could just store it somewhere when we do the wake-up decay. I thought there was a better reason when I wrote the patch, but I don't recall right now. I will look into it again and see if we can use __update_load_avg() to do a proper update instead of doing things twice.
RE: [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Monday, August 15, 2016 11:49 AM > To: net...@vger.kernel.org > Cc: de...@linuxdriverproject.org; linux-kernel@vger.kernel.org; Haiyang > Zhang; KY Srinivasan ; > Stephen Hemminger > Subject: [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in > netvsc_netdev_event() > > Bonding driver sets IFF_BONDING on both master (the bonding device) and > slave (the real NIC) devices and in netvsc_netdev_event() we want to skip > master devices only. Currently, there is an uncertainty when a slave > interface is removed: if bonding module comes first in netdev_chain it > clears IFF_BONDING flag on the netdev and netvsc_netdev_event() > correctly > handles NETDEV_UNREGISTER event, but in case netvsc comes first on the > chain it sees the device with IFF_BONDING still attached and skips it. As > we still hold vf_netdev pointer to the device we crash on the next inject. > > Signed-off-by: Vitaly Kuznetsov Thanks! Acked-by: Haiyang Zhang
Re: [PATCH] iio: magnetometer: mag3110: claim direct mode during raw reads
On 01/08/16 16:48, Alison Schofield wrote: > Driver was checking for direct mode but not locking it. Use > claim/release helper functions to guarantee the device stays > in direct mode during raw reads. > > Signed-off-by: Alison Schofield> Cc: Daniel Baluta > --- > drivers/iio/magnetometer/mag3110.c | 21 + > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/magnetometer/mag3110.c > b/drivers/iio/magnetometer/mag3110.c > index f2be4a0..90574ff 100644 > --- a/drivers/iio/magnetometer/mag3110.c > +++ b/drivers/iio/magnetometer/mag3110.c > @@ -154,34 +154,39 @@ static int mag3110_read_raw(struct iio_dev *indio_dev, > > switch (mask) { > case IIO_CHAN_INFO_RAW: > - if (iio_buffer_enabled(indio_dev)) > - return -EBUSY; > + ret = iio_device_claim_direct_mode(indio_dev); > + if (ret) > + return ret; > > switch (chan->type) { > case IIO_MAGN: /* in 0.1 uT / LSB */ > ret = mag3110_read(data, buffer); > if (ret < 0) > - return ret; > + goto release; > *val = sign_extend32( > be16_to_cpu(buffer[chan->scan_index]), 15); > - return IIO_VAL_INT; > + ret = IIO_VAL_INT; No break? > case IIO_TEMP: /* in 1 C / LSB */ > mutex_lock(>lock); > ret = mag3110_request(data); > if (ret < 0) { > mutex_unlock(>lock); > - return ret; > + goto release; > } > ret = i2c_smbus_read_byte_data(data->client, > MAG3110_DIE_TEMP); > mutex_unlock(>lock); > if (ret < 0) > - return ret; > + goto release; > *val = sign_extend32(ret, 7); > - return IIO_VAL_INT; > + ret = IIO_VAL_INT; No break here either > default: > - return -EINVAL; > + ret = -EINVAL; > } > +release: > + iio_device_release_direct_mode(indio_dev); > + return ret; > + > case IIO_CHAN_INFO_SCALE: > switch (chan->type) { > case IIO_MAGN: >
Re: [PATCH -next] drm/mgag200: fix error return code in mgag200fb_create()
On Mon, Aug 15, 2016 at 03:03:51PM +, Wei Yongjun wrote: > Fix to return error code -ENOMEM from the vmalloc() error handling > case instead of 0, as done elsewhere in this function. > > Fixes: aec9e12953e7 ("drm/mgag200: Fix error handling paths in fbdev driver") > Signed-off-by: Wei YongjunApplied to drm-misc, thanks. -Daniel > --- > drivers/gpu/drm/mgag200/mgag200_fb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c > b/drivers/gpu/drm/mgag200/mgag200_fb.c > index 81325f6..88dd221 100644 > --- a/drivers/gpu/drm/mgag200/mgag200_fb.c > +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c > @@ -183,8 +183,10 @@ static int mgag200fb_create(struct drm_fb_helper *helper, > } > > sysram = vmalloc(size); > - if (!sysram) > + if (!sysram) { > + ret = -ENOMEM; > goto err_sysram; > + } > > info = drm_fb_helper_alloc_fbi(helper); > if (IS_ERR(info)) { > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v2] iio: humidity: hdc100x: add HDC1000 and HDC1008 to Kconfig
On 25/07/16 19:50, Alison Schofield wrote: > hdc100x supports Texas Instruments HDC1000 and HDC1008 relative > humidity and temperature sensors. Add these product names to > Kconfig. > > Signed-off-by: Alison Schofield> Cc: Daniel Baluta Thanks for sorting this out! Applied to the togreg branch of iio.git - pushed out as testing etc etc. Jonathan > --- > Changes in v2: > - removed names from i2c_device_id struct. (keep as hdc100x only) > - updated commit msg and changelog > > drivers/iio/humidity/Kconfig | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig > index 738a86d..f155386 100644 > --- a/drivers/iio/humidity/Kconfig > +++ b/drivers/iio/humidity/Kconfig > @@ -26,11 +26,11 @@ config HDC100X > tristate "TI HDC100x relative humidity and temperature sensor" > depends on I2C > help > - Say yes here to build support for the TI HDC100x series of > - relative humidity and temperature sensors. > + Say yes here to build support for the Texas Instruments > + HDC1000 and HDC1008 relative humidity and temperature sensors. > > - To compile this driver as a module, choose M here: the module > - will be called hdc100x. > + To compile this driver as a module, choose M here: the module > + will be called hdc100x. > > config HTU21 > tristate "Measurement Specialties HTU21 humidity & temperature sensor" >
Re: [PATCH 0/6] Apple device properties
On Mon, Aug 15, 2016 at 12:54:14PM +0100, Matt Fleming wrote: > On Tue, 09 Aug, at 03:38:16PM, Lukas Wunner wrote: > > @@ -208,7 +201,10 @@ struct efi_config { > > __pure const struct efi_config *__efi_early(void); > > > > #define efi_call_early(f, ...) \ > > - __efi_early()->call(__efi_early()->f, __VA_ARGS__); > > + __efi_early()->call(__efi_early()->is64 ? \ > > + ((efi_boot_services_64_t *)__efi_early()->boot_services)->f : \ > > + ((efi_boot_services_32_t *)__efi_early()->boot_services)->f,\ > > + __VA_ARGS__); > > > > You cannot use pointers from the firmware directly in mixed mode > because the kernel is compiled for 64-bits but the firmware is using > 32-bit addresses, so dereferencing a pointer causes a 64-bit load. Please behold the resulting binary code, which uses a 32-bit load, not a 64-bit load (note the "mov edi, dword [ds:rax+0x2c]"). This is a call to AllocatePool *with* my patch: 0x22c1 movrax, qword [ds:efi_early] 0x22c8 addrdx, 0x10 ; buffer size argument 0x22cc cmpbyte [ds:rax+0x28], 0x0; !efi_early->is64 ? 0x22d0 movr8, qword [ds:rax+0x20]; efi_early->call() 0x22d4 movrax, qword [ds:rax+0x10] ; efi_early->boot_services 0x22d8 je 0x2410 0x22de movrdi, qword [ds:rax+0x40] ; allocate_pool (64 bit) 0x22e2 xoreax, eax 0x22e4 movrcx, r13 ; buffer argument 0x22e7 movesi, 0x2 ; EfiLoaderData argument 0x22ec call r8 ... 0x2410 movedi, dword [ds:rax+0x2c] ; allocate_pool (32 bit) 0x2413 jmp0x22e2 The same *without* my patch: 0x1d41 movr8, qword [ds:efi_early] 0x1d48 addr15, 0x40 0x1d4c movrcx, qword [ss:rsp-0x10+arg_20] ; buffer argument 0x1d51 movrdx, r15 ; buffer size argument 0x1d54 movesi, 0x2 ; EfiLoaderData argument 0x1d59 movrdi, qword [ds:r8+0x10]; allocate_pool 0x1d5d call qword [ds:r8+0x58] ; efi_early->call So it looks to me like my patch should work just fine on 32-bit, even though I cannot verify it through testing. The ARM folks afford invocation of arbitrary boot services, it just seemed natural to me to allow the same for x86. The portion of the stub code which is shared between arches cannot use more than the 8 boot services supported by x86 even though ARM would be capable of using all of them. Of course the binary code with my patch is longer, less readable, and needs to follow multiple indirections and I can understand if you would rather stay with the current approach for these reasons. But I would like to understand the "cannot jump through pointers at runtime" argument because the binary code looks to me like it should work on 32 bit. I guess I must be missing something obvious? Thanks, Lukas
Re: [GIT PULL] [PATCH v4 00/26] Delete CURRENT_TIME and CURRENT_TIME_SEC macros
On Sat, Aug 13, 2016 at 03:48:12PM -0700, Deepa Dinamani wrote: > The series is aimed at getting rid of CURRENT_TIME and CURRENT_TIME_SEC > macros. > The macros are not y2038 safe. There is no plan to transition them into being > y2038 safe. > ktime_get_* api's can be used in their place. And, these are y2038 safe. Who are you execting to pull this huge patch series? Why not just introduce the new api call, wait for that to be merged, and then push the individual patches through the different subsystems? After half of those get ignored, then provide a single set of patches that can go through Andrew or my trees. thanks, greg k-h
Re: [PATCH 0/2] Drivers: hv: vmbus: make bus ids in sysfs persistent
KY Srinivasanwrites: >> -Original Message- >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] >> Sent: Thursday, August 11, 2016 2:17 AM >> To: KY Srinivasan >> Cc: de...@linuxdriverproject.org; linux-kernel@vger.kernel.org; Haiyang Zhang >> >> Subject: Re: [PATCH 0/2] Drivers: hv: vmbus: make bus ids in sysfs persistent >> >> KY Srinivasan writes: >> >> >> -Original Message- >> >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] >> >> Sent: Tuesday, August 9, 2016 1:46 AM >> >> To: de...@linuxdriverproject.org >> >> Cc: linux-kernel@vger.kernel.org; Haiyang Zhang >> >> ; KY Srinivasan >> >> Subject: [PATCH 0/2] Drivers: hv: vmbus: make bus ids in sysfs >> >> persistent >> >> >> >> Bus ids for VMBus devices in /sys/bus/vmbus/devices/ are not >> >> guaranteed to be persistent across reboot or kernel restart and this >> >> causes problems for some tools. E.g. kexec tools use these ids to identify >> NIC on kdump. >> >> Fix the issue by using relid from channel offer as the unique id >> >> instead of an auto incremented counter. >> > >> > Relids are not persistent. It is only valid between a channel offer >> > message and a relid released message (or an unload or initiate contact >> > message, which invalidates all channels). This is an opaque number >> > that the root generates and uses to track channels. There is no >> > guarantee that the same type of channel (networking, storage, etc) >> > will get the same relid on each reboot. >> > >> >> Thanks for the info, >> >> can we use device_id (offermsg.offer.if_instance.b) instead? > > I think you could; I am going to verify and get back to you on this. Thanks! > Sometime back I removed all the non-determinism in the vmbus device > ID generation. Now, the current scheme of generating the device IDs does > result in persistent IDs across boot (as long as the host presents the devices > to the guest in the same order across boots). Do you have this fix? Yes, I think I do. The issue I'm trying to address happens rearly on kdump when we get devices present to us in a different order. -- Vitaly
Re: [PATCH v2] iio: accel: bma180: use iio helper function to guarantee direct mode
On 25/07/16 20:11, Alison Schofield wrote: > Replace the code that guarantees the device stays in direct mode > with iio_device_claim_direct_mode() which does same. > > Signed-off-by: Alison Schofield> Cc: Daniel Baluta Applied. Thanks, Jonathan > --- > Changes in v2: > - put back private data lock I had removed in v1. > > drivers/iio/accel/bma180.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c > index e3f88ba..0890934 100644 > --- a/drivers/iio/accel/bma180.c > +++ b/drivers/iio/accel/bma180.c > @@ -469,13 +469,14 @@ static int bma180_read_raw(struct iio_dev *indio_dev, > > switch (mask) { > case IIO_CHAN_INFO_RAW: > + ret = iio_device_claim_direct_mode(indio_dev); > + if (ret) > + return ret; > + > mutex_lock(>mutex); > - if (iio_buffer_enabled(indio_dev)) { > - mutex_unlock(>mutex); > - return -EBUSY; > - } > ret = bma180_get_data_reg(data, chan->scan_index); > mutex_unlock(>mutex); > + iio_device_release_direct_mode(indio_dev); > if (ret < 0) > return ret; > *val = sign_extend32(ret >> chan->scan_type.shift, >
Re: [PATCH 07/15] lustre: ->kss_scratch... are unused now
On Sat, Jul 23, 2016 at 02:37:04AM -0400, Oleg Drokin wrote: > From: Al Viro> > Signed-off-by: Al Viro > --- > drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 4 > 1 file changed, 4 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > index d5efb42..84a915c 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > @@ -86,10 +86,6 @@ struct ksock_sched { /* per > scheduler state */ > int kss_nconns; /* # connections assigned to >* this scheduler */ > struct ksock_sched_info *kss_info; /* owner of it */ > - union { > - struct bio_vec kss_scratch_bvec[LNET_MAX_IOV]; > - struct kvec kss_scratch_iov[LNET_MAX_IOV]; kss_scratch_iov is still being used in the tree :( Oleg, can you fix this up based on the current staging-testing branch and resend the rest of this series? Also, whenever you forward on patches to me, be sure to add your signed-off-by to it, you forgot to do that on Al's patches... thanks, greg k-h
Re: [PATCH v3 45/51] x86: remove 64-byte gap at end of irq stack
On Sun, Aug 14, 2016 at 08:50:57AM -0400, Brian Gerst wrote: > On Sun, Aug 14, 2016 at 3:52 AM, Andy Lutomirskiwrote: > > On Fri, Aug 12, 2016 at 7:29 AM, Josh Poimboeuf wrote: > >> There has been a 64-byte gap at the end of the irq stack for at least 12 > >> years. It predates git history, and I can't find any good reason for > >> it. Remove it. What's the worst that could happen? > > > > I can't think of any reason this would matter. > > > > For that matter, do you have any idea why irq_stack_union is a union > > or why we insist on sticking it at %gs:0? Sure, the *canary* needs to > > live at a fixed offset (because GCC is daft, sigh), but I don't see > > what that has to do with the rest of the IRQ stack. > > > > --Andy > > Because the IRQ stack requires page alignment so it was convenient to > put it at the start of the per-cpu area. I don't think at the time I > wrote this there was specific support for page-aligned objects in > per-cpu memory. Since stacks grow down, it was tolerable to reserve a > few bytes at the bottom for the canary. Hm. Sounds like another good opportunity for a cleanup (though it's well outside the scope of this patch set). > What would be great is if we could leverage the new GCC plugin tools > to reimplement stack protector in a manner that is more compatible > with the kernel environment. It would make the stack canary a true > per-cpu variable instead of the hard-coded TLS-based location it is > now. That would make 64-bit be able to use normal delta per-cpu > offsets instead of zero-based, and would allow 32-bit to always do > lazy GS. > > -- > Brian Gerst -- Josh
Re: [PATCH] pinctrl: exynos: remove duplicate calls in irq handler
On Mon, Aug 15, 2016 at 06:17:07PM +0800, perr wrote: > Because chained_irq_enter() has already called chip->irq_mask() and > chip->irq_ack(), also chained_irq_exit() will call chip->irq_unmask(), > so it's not necessary to call chip->irq_*() here. > > Signed-off-by: perr> > --- > drivers/pinctrl/samsung/pinctrl-exynos.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > Looks correct so for the patch itself: Reviewed-by: Krzysztof Kozlowski However, your name "Perr" confuses me a little bit. For the Signed-off-by statement, as mentioned in Documentation/SubmittingPatches, a real name is required. The name should match the author. Would you be so kind as to use a full, real name? Unless Perr is your full, real name... then sorry for the trouble. Best regards, Krzysztof
Re: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in
On Wed, Jul 06, 2016 at 03:11:13PM +0900, Daeseok Youn wrote: > The dgnc_block_til_ready() is only used in dgnc_tty_open(). > The unit data(struct un_t) was stored into tty->driver_data in > dgnc_tty_open(). > And also tty and un were tested about NULL so these variables doesn't > need to check for NULL in dgnc_block_til_ready(). > > Signed-off-by: Daeseok Youn> --- > RESEND: This patch was not merged for a long time, if there is any reason > why this patch could NOT be merged into staging tree, let me know. > There were no comment for this patch. > I cannot understand why this patch have to wait long time to merge. > And I also sent emails to mailing-lists for reminding this patch... > please let me know, what is the problem to merge this patch into staging tree. Please note, staging patches are at the bottom of my priority queue. Combined with a vacation, conferences, and a merge window and there are a lot of pending staging patches in my to-review queue. thanks for your patience. greg k-h
[PATCH] MAINTAINERS: atmel-isc: add entry for Atmel ISC
Add the MAINTAINERS' entry for Microchip / Atmel Image Sensor Controller. Signed-off-by: Nicolas FerreCc: Songjun Wu --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 45c98485c3f0..84786643ba4c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7750,6 +7750,14 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git S: Supported F: arch/microblaze/ +MICROCHIP / ATMEL ISC DRIVER +M: Songjun Wu +L: linux-me...@vger.kernel.org +S: Supported +F: drivers/media/platform/atmel/atmel-isc.c +F: drivers/media/platform/atmel/atmel-isc-regs.h +F: devicetree/bindings/media/atmel-isc.txt + MICROSOFT SURFACE PRO 3 BUTTON DRIVER M: Chen Yu L: platform-driver-...@vger.kernel.org -- 2.9.0
Re: [PATCH 1/2] mtd: nand: timings: Fix tADL_min for ONFI 4.0 chips
On Tue, 14 Jun 2016 16:21:06 +0200 Boris Brezillonwrote: > ONFI 4.0 spec defines different values for the tADL_min timing. > Since we don't want to have different timings depending on the ONFI > version, we just set tADL_min to the maximum value (the one specified > in the ONFI 4.0 spec). Applied both. > > Signed-off-by: Boris Brezillon > --- > drivers/mtd/nand/nand_timings.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c > index e81470a..c0941d5 100644 > --- a/drivers/mtd/nand/nand_timings.c > +++ b/drivers/mtd/nand/nand_timings.c > @@ -16,7 +16,7 @@ > static const struct nand_sdr_timings onfi_sdr_timings[] = { > /* Mode 0 */ > { > - .tADL_min = 20, > + .tADL_min = 40, > .tALH_min = 2, > .tALS_min = 5, > .tAR_min = 25000, > @@ -53,7 +53,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = { > }, > /* Mode 1 */ > { > - .tADL_min = 10, > + .tADL_min = 40, > .tALH_min = 1, > .tALS_min = 25000, > .tAR_min = 1, > @@ -90,7 +90,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = { > }, > /* Mode 2 */ > { > - .tADL_min = 10, > + .tADL_min = 40, > .tALH_min = 1, > .tALS_min = 15000, > .tAR_min = 1, > @@ -127,7 +127,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = > { > }, > /* Mode 3 */ > { > - .tADL_min = 10, > + .tADL_min = 40, > .tALH_min = 5000, > .tALS_min = 1, > .tAR_min = 1, > @@ -164,7 +164,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = > { > }, > /* Mode 4 */ > { > - .tADL_min = 7, > + .tADL_min = 40, > .tALH_min = 5000, > .tALS_min = 1, > .tAR_min = 1, > @@ -201,7 +201,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = > { > }, > /* Mode 5 */ > { > - .tADL_min = 7, > + .tADL_min = 40, > .tALH_min = 5000, > .tALS_min = 1, > .tAR_min = 1,
Re: [PATCH 8/9] MIPS: xilfpga: Add DT node for AXI emaclite
Hi Zubair, On Mon, Aug 15, 2016 at 02:55:34PM +0100, Zubair Lutfullah Kakakhel wrote: > The xilfpga platform has a Xilinx AXI emaclite block. > > Add the DT node to use it. > > Signed-off-by: Zubair Lutfullah Kakakhel> --- > arch/mips/boot/dts/xilfpga/nexys4ddr.dts | 27 +++ > 1 file changed, 27 insertions(+) > > diff --git a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts > b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts > index 3658e21..58bc62f 100644 > --- a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts > +++ b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts > @@ -42,6 +42,33 @@ > xlnx,tri-default = <0x>; > } ; > > + axi_ethernetlite: ethernet@10e0 { > + compatible = "xlnx,xps-ethernetlite-3.00.a"; This one also isn't documented. > + device_type = "network"; > + interrupt-parent = <_intc>; > + interrupts = <1>; > + local-mac-address = [08 86 4C 0D F7 09]; I'm pretty sure you don't want this in the mainline dts file. thx, Jason. > + phy-handle = <>; > + reg = <0x10e0 0x1>; > + xlnx,duplex = <0x1>; > + xlnx,include-global-buffers = <0x1>; > + xlnx,include-internal-loopback = <0x0>; > + xlnx,include-mdio = <0x1>; > + xlnx,instance = "axi_ethernetlite_inst"; > + xlnx,rx-ping-pong = <0x1>; > + xlnx,s-axi-id-width = <0x1>; > + xlnx,tx-ping-pong = <0x1>; > + xlnx,use-internal = <0x0>; > + mdio { > + #address-cells = <1>; > + #size-cells = <0>; > + phy0: phy@1 { > + device_type = "ethernet-phy"; > + reg = <1>; > + }; > + }; > + }; > + > axi_uart16550: serial@1040 { > compatible = "ns16550a"; > reg = <0x1040 0x1>; > -- > 1.9.1 >
[PATCH v2 1/4] net: ethernet: ti: davinci_cpdma: split descs num between all channels
Currently the tx channels share same pool of descriptors. Thus one channel can block another if pool is emptied by one. But, the shaper should decide which channel is allowed to send packets. To avoid such impact of one channel on another, let every channel to have its own peace of pool. Signed-off-by: Ivan Khoronzhuk--- drivers/net/ethernet/ti/cpsw.c | 61 - drivers/net/ethernet/ti/davinci_cpdma.c | 47 +++-- drivers/net/ethernet/ti/davinci_cpdma.h | 2 +- 3 files changed, 84 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index b4d3b41..a4c1538 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1212,6 +1212,40 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) } } +static int cpsw_fill_rx_channels(struct net_device *ndev) +{ + struct cpsw_priv *priv = netdev_priv(ndev); + struct cpsw_common *cpsw = priv->cpsw; + struct sk_buff *skb; + int ch_buf_num; + int i, ret; + + ch_buf_num = cpdma_chan_get_rx_buf_num(cpsw->rxch); + for (i = 0; i < ch_buf_num; i++) { + skb = __netdev_alloc_skb_ip_align(ndev, + cpsw->rx_packet_max, + GFP_KERNEL); + if (!skb) { + cpsw_err(priv, ifup, "cannot allocate skb\n"); + return -ENOMEM; + } + + ret = cpdma_chan_submit(cpsw->rxch, skb, skb->data, + skb_tailroom(skb), 0); + if (ret < 0) { + cpsw_err(priv, ifup, +"cannot submit skb to rx channel, error %d\n", +ret); + kfree_skb(skb); + return ret; + } + } + + cpsw_info(priv, ifup, "submitted %d rx descriptors\n", ch_buf_num); + + return ch_buf_num; +} + static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_common *cpsw) { u32 slave_port; @@ -1232,7 +1266,7 @@ static int cpsw_ndo_open(struct net_device *ndev) { struct cpsw_priv *priv = netdev_priv(ndev); struct cpsw_common *cpsw = priv->cpsw; - int i, ret; + int ret; u32 reg; ret = pm_runtime_get_sync(cpsw->dev); @@ -1264,8 +1298,6 @@ static int cpsw_ndo_open(struct net_device *ndev) ALE_ALL_PORTS, ALE_ALL_PORTS, 0, 0); if (!cpsw_common_res_usage_state(cpsw)) { - int buf_num; - /* setup tx dma to fixed prio and zero offset */ cpdma_control_set(cpsw->dma, CPDMA_TX_PRIO_FIXED, 1); cpdma_control_set(cpsw->dma, CPDMA_RX_BUFFER_OFFSET, 0); @@ -1292,26 +1324,9 @@ static int cpsw_ndo_open(struct net_device *ndev) enable_irq(cpsw->irqs_table[0]); } - buf_num = cpdma_chan_get_rx_buf_num(cpsw->dma); - for (i = 0; i < buf_num; i++) { - struct sk_buff *skb; - - ret = -ENOMEM; - skb = __netdev_alloc_skb_ip_align(priv->ndev, - cpsw->rx_packet_max, GFP_KERNEL); - if (!skb) - goto err_cleanup; - ret = cpdma_chan_submit(cpsw->rxch, skb, skb->data, - skb_tailroom(skb), 0); - if (ret < 0) { - kfree_skb(skb); - goto err_cleanup; - } - } - /* continue even if we didn't manage to submit all -* receive descs -*/ - cpsw_info(priv, ifup, "submitted %d rx descriptors\n", i); + ret = cpsw_fill_rx_channels(ndev); + if (ret < 0) + goto err_cleanup; if (cpts_register(cpsw->dev, cpsw->cpts, cpsw->data.cpts_clock_mult, diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index cf72b33..ec560ab 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -104,6 +104,7 @@ struct cpdma_ctlr { struct cpdma_desc_pool *pool; spinlock_t lock; struct cpdma_chan *channels[2 * CPDMA_MAX_CHANNELS]; + int chan_num; }; struct cpdma_chan { @@ -256,6 +257,7 @@ struct cpdma_ctlr *cpdma_ctlr_create(struct cpdma_params *params) ctlr->state = CPDMA_STATE_IDLE; ctlr->params = *params; ctlr->dev = params->dev; + ctlr->chan_num = 0; spin_lock_init(>lock); ctlr->pool =
Re: [PATCH stable-4.4 1/3] mm: memcontrol: fix cgroup creation failure after many small jobs
On Mon, Aug 15, 2016 at 05:06:44PM +0200, Michal Hocko wrote: > @@ -4173,11 +4213,17 @@ static struct mem_cgroup *mem_cgroup_alloc(void) > > memcg->stat = alloc_percpu(struct mem_cgroup_stat_cpu); > if (!memcg->stat) > - goto out_free; > + goto out_idr; Spurious left-over from the previous version?
Re: [PATCH v7 1/2] mtd: nand_bbt: Move BBT block selection logic out of write_bbt()
On Mon, 15 Aug 2016 09:47:40 -0500 Kyle Roeschleywrote: > On Sat, Aug 13, 2016 at 12:37:03AM +0200, Boris Brezillon wrote: > > On Fri, 12 Aug 2016 16:58:22 -0500 > > Kyle Roeschley wrote: > > > [...] > > > + while (chip < nrchips) { > > > > I'm probably missing something, but why are you turning the for loop > > into a while loop in this patch? The commit message does not mention > > that, and I don't see why you need it before you actually start > > reworking the code to recover from BBT write failures (which is done in > > patch 2). > > > > You had changed it in patch 2 (http://code.bulix.org/e16nvo-104988) and I just > shuffled it to the first patch since it seemed to make sense as additional > code > cleanup. Well, this is not exactly a cleanup, it's needed because of the rework done in patch 2: we no longer want the for loop to automatically increment the chip variable (if we fail to write the BBT on a specific die, we retry until we succeed or run out of free valid erase blocks). Now, if you really want to make it part of patch 1, at least explain why you're doing that (in preparation of BBT write failure handling). > I'll go ahead and drop it though if you don't want it in. > Note that I don't want you to completely drop this change, just put it back in patch 2 or explain why you're doing it in patch 1 in your commit message.
Re: [PATCH stable-4.4 1/3] mm: memcontrol: fix cgroup creation failure after many small jobs
Updated patch --- >From ac6657609db69a5a591b96a4b0fd18140408f41e Mon Sep 17 00:00:00 2001 From: Johannes WeinerDate: Wed, 20 Jul 2016 15:44:57 -0700 Subject: [PATCH] mm: memcontrol: fix cgroup creation failure after many small jobs commit 73f576c04b9410ed19660f74f97521bee6e1c546 upstream. The memory controller has quite a bit of state that usually outlives the cgroup and pins its CSS until said state disappears. At the same time it imposes a 16-bit limit on the CSS ID space to economically store IDs in the wild. Consequently, when we use cgroups to contain frequent but small and short-lived jobs that leave behind some page cache, we quickly run into the 64k limitations of outstanding CSSs. Creating a new cgroup fails with -ENOSPC while there are only a few, or even no user-visible cgroups in existence. Although pinning CSSs past cgroup removal is common, there are only two instances that actually need an ID after a cgroup is deleted: cache shadow entries and swapout records. Cache shadow entries reference the ID weakly and can deal with the CSS having disappeared when it's looked up later. They pose no hurdle. Swap-out records do need to pin the css to hierarchically attribute swapins after the cgroup has been deleted; though the only pages that remain swapped out after offlining are tmpfs/shmem pages. And those references are under the user's control, so they are manageable. This patch introduces a private 16-bit memcg ID and switches swap and cache shadow entries over to using that. This ID can then be recycled after offlining when the CSS remains pinned only by objects that don't specifically need it. This script demonstrates the problem by faulting one cache page in a new cgroup and deleting it again: set -e mkdir -p pages for x in `seq 128000`; do [ $((x % 1000)) -eq 0 ] && echo $x mkdir /cgroup/foo echo $$ >/cgroup/foo/cgroup.procs echo trex >pages/$x echo $$ >/cgroup/cgroup.procs rmdir /cgroup/foo done When run on an unpatched kernel, we eventually run out of possible IDs even though there are no visible cgroups: [root@ham ~]# ./cssidstress.sh [...] 65000 mkdir: cannot create directory '/cgroup/foo': No space left on device After this patch, the IDs get released upon cgroup destruction and the cache and css objects get released once memory reclaim kicks in. [han...@cmpxchg.org: init the IDR] Link: http://lkml.kernel.org/r/20160621154601.ga22...@cmpxchg.org Fixes: b2052564e66d ("mm: memcontrol: continue cache reclaim from offlined groups") Link: http://lkml.kernel.org/r/20160617162516.gd19...@cmpxchg.org Signed-off-by: Johannes Weiner Reported-by: John Garcia Reviewed-by: Vladimir Davydov Acked-by: Tejun Heo Cc: Nikolay Borisov Cc: [3.19+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Michal Hocko --- include/linux/memcontrol.h | 8 mm/memcontrol.c| 91 +- mm/slab_common.c | 4 +- 3 files changed, 83 insertions(+), 20 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index cd0e2413c358..435fd8426b8a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -174,6 +174,11 @@ struct mem_cgroup_thresholds { struct mem_cgroup_threshold_ary *spare; }; +struct mem_cgroup_id { + int id; + atomic_t ref; +}; + /* * The memory controller data structure. The memory controller controls both * page cache and RSS per cgroup. We would eventually like to provide @@ -183,6 +188,9 @@ struct mem_cgroup_thresholds { struct mem_cgroup { struct cgroup_subsys_state css; + /* Private memcg ID. Used to ID objects that outlive the cgroup */ + struct mem_cgroup_id id; + /* Accounted resources */ struct page_counter memory; struct page_counter memsw; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 67648e6b2ac8..e139c982b143 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -272,21 +272,7 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) { - return memcg->css.id; -} - -/* - * A helper function to get mem_cgroup from ID. must be called under - * rcu_read_lock(). The caller is responsible for calling - * css_tryget_online() if the mem_cgroup is used for charging. (dropping - * refcnt from swap can be called against removed memcg.) - */ -static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id) -{ - struct cgroup_subsys_state *css; - - css = css_from_id(id, _cgrp_subsys); - return mem_cgroup_from_css(css); + return memcg->id.id; } /* Writing them here to avoid
Re: [PATCH 1/2] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
On 08/08/16 12:05, Vignesh R wrote: > It is possible that two or more ADC channels can be simultaneously > requested for raw samples, in which case there can be race in access to > FIFO data resulting in loss of samples. > If am335x_tsc_se_set_once() is called again from tiadc_read_raw(), when > ADC is still acquired to sample one of the channels, the second process > might be put into uninterruptible sleep state. Fix these issues, by > protecting FIFO access and channel configurations with a mutex. Since > tiadc_read_raw() might take anywhere between few microseconds to few > milliseconds to finish execution (depending on averaging and delay > values supplied via DT), its better to use mutex instead of spinlock. > > Signed-off-by: Vignesh RHi, Thanks for the patch. As this is clearly a fix for a long standing issue, I'd like to send it for stable inclusion. Would you mind doing a bit of detective work to added a Fixes tag to say which original patch introduced the issue? I'm going to start pushing back on this in general as it's helpful to the stable maintainers if we provide this info whenever possible. Thanks, Jonathan > --- > drivers/iio/adc/ti_am335x_adc.c | 14 +++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c > index 8a368756881b..bed9977a1863 100644 > --- a/drivers/iio/adc/ti_am335x_adc.c > +++ b/drivers/iio/adc/ti_am335x_adc.c > @@ -32,6 +32,7 @@ > > struct tiadc_device { > struct ti_tscadc_dev *mfd_tscadc; > + struct mutex fifo1_lock; /* to protect fifo access */ > int channels; > u8 channel_line[8]; > u8 channel_step[8]; > @@ -359,6 +360,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, > int *val, int *val2, long mask) > { > struct tiadc_device *adc_dev = iio_priv(indio_dev); > + int ret = IIO_VAL_INT; > int i, map_val; > unsigned int fifo1count, read, stepid; > bool found = false; > @@ -372,6 +374,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, > if (!step_en) > return -EINVAL; > > + mutex_lock(_dev->fifo1_lock); > fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); > while (fifo1count--) > tiadc_readl(adc_dev, REG_FIFO1); > @@ -388,7 +391,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, > > if (time_after(jiffies, timeout)) { > am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); > - return -EAGAIN; > + ret = -EAGAIN; > + goto err_unlock; > } > } > map_val = adc_dev->channel_step[chan->scan_index]; > @@ -414,8 +418,11 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, > am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); > > if (found == false) > - return -EBUSY; > - return IIO_VAL_INT; > + ret = -EBUSY; > + > +err_unlock: > + mutex_unlock(_dev->fifo1_lock); > + return ret; > } > > static const struct iio_info tiadc_info = { > @@ -483,6 +490,7 @@ static int tiadc_probe(struct platform_device *pdev) > > tiadc_step_config(indio_dev); > tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD); > + mutex_init(_dev->fifo1_lock); > > err = tiadc_channel_init(indio_dev, adc_dev->channels); > if (err < 0) >
Re: [PATCH] x86/efi-bgrt: remove the check of the version field
On Mon, Aug 15, 2016 at 01:56:43PM +0100, Matt Fleming wrote: > On Tue, 09 Aug, at 01:25:46PM, Icenowy Zheng wrote: > > Some broken firmwares have a wrongly filled version field in BGRT table. > > (See http://wiki.osdev.org/Broken_UEFI_implementations ) > > > > As we know, these firmwares can also provide correct BGRT image, although > > the table is wrong. > > > > After removing the check of the version field, the kernel can now extract > > the image correctly, and the information is also correct. > > > > Tested on a Thinkpad E531 (68854UC). > > > > Signed-off-by: Icenowy Zheng> > --- > > arch/x86/platform/efi/efi-bgrt.c | 5 - > > 1 file changed, 5 deletions(-) > > > > diff --git a/arch/x86/platform/efi/efi-bgrt.c > > b/arch/x86/platform/efi/efi-bgrt.c > > index 6a2f569..f492ea0 100644 > > --- a/arch/x86/platform/efi/efi-bgrt.c > > +++ b/arch/x86/platform/efi/efi-bgrt.c > > @@ -47,11 +47,6 @@ void __init efi_bgrt_init(void) > >bgrt_tab->header.length, sizeof(*bgrt_tab)); > > return; > > } > > - if (bgrt_tab->version != 1) { > > - pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n", > > - bgrt_tab->version); > > - return; > > - } > > if (bgrt_tab->status & 0xfe) { > > pr_notice("Ignoring BGRT: reserved status bits are non-zero > > %u\n", > >bgrt_tab->status); > > This would be less scary if we checked for known broken and known good > version values instead of removing the check altogether, i.e. 0 and 1. > > The whole point of the version field is that it tells us about the > layout of the BGRT table, so it's not exactly a useless check. Agreed. It seems likely that BIOSes would have incorrectly left the version at 0. It seems less likely that they'd set it to some other random value. So, I'd suggest changing the check to pr_debug and continue for 0, continue for 1, and pr_notice and abort for anything else.
Re: [PATCH 19/58] staging: lustre: llite: add md_op_data parameter to ll_get_dir_page
On Thu, Jul 21, 2016 at 10:44:12PM -0400, James Simmons wrote: > From: wang di> > Pass in struct md_op_data for ll_get_dir_page function. > > Signed-off-by: wang di > Reviewed-on: http://review.whamcloud.com/7043 > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531 > Reviewed-by: John L. Hammond > Reviewed-by: Jinshan Xiong > Reviewed-by: Andreas Dilger > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/llite/dir.c |8 > .../staging/lustre/lustre/llite/llite_internal.h |4 ++-- > drivers/staging/lustre/lustre/llite/statahead.c| 15 +++ > 3 files changed, 17 insertions(+), 10 deletions(-) This patch fails to apply, so I have to stop here in the patch series. So I'm guesing your second patch series also will fail to apply, so can you resend all of the outstanding patches you have sent me after rebasing on my staging-testing branch? thanks, greg k-h
Re: [PATCH] checkpatch: Look for symbolic permissions and suggest octal instead
On Tue, 2016-08-02 at 16:39 -0700, Joe Perches wrote: > S_ uses should be avoided where octal is more intelligible. ping? Should CodingStyle and Documentation/filesystems change too? > Signed-off-by: Joe Perches> --- > scripts/checkpatch.pl | 49 +++-- > 1 file changed, 43 insertions(+), 6 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 1d5b09d..1140940 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -541,6 +541,32 @@ our $mode_perms_world_writable = qr{ > 0[0-7][0-7][2367] > }x; > > +our %mode_permission_string_types = ( > + "S_IRWXU" => 0700, > + "S_IRUSR" => 0400, > + "S_IWUSR" => 0200, > + "S_IXUSR" => 0100, > + "S_IRWXG" => 0070, > + "S_IRGRP" => 0040, > + "S_IWGRP" => 0020, > + "S_IXGRP" => 0010, > + "S_IRWXO" => 0007, > + "S_IROTH" => 0004, > + "S_IWOTH" => 0002, > + "S_IXOTH" => 0001, > + "S_IRWXUGO" => 0777, > + "S_IRUGO" => 0444, > + "S_IWUGO" => 0222, > + "S_IXUGO" => 0111, > +); > + > +#Create a search pattern for all these strings to speed up a loop below > +our $mode_perms_string_search = ""; > +foreach my $entry (keys %mode_permission_string_types) { > + $mode_perms_string_search .= '|' if ($mode_perms_string_search ne ""); > + $mode_perms_string_search .= $entry; > +} > + > our $allowed_asm_includes = qr{(?x: > irq| > memory| > @@ -5996,20 +6022,31 @@ sub process { > $arg_pos--; > $skip_args = > "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}"; > } > - my $test = > "\\b$func\\s*\\(${skip_args}([\\d]+)\\s*[,\\)]"; > + my $test = > "\\b$func\\s*\\(${skip_args}($FuncArg(?:\\|\\s*$FuncArg)*)\\s*[,\\)]"; > if ($line =~ /$test/) { > my $val = $1; > $val = $6 if ($skip_args ne ""); > - > - if ($val !~ /^0$/ && > - (($val =~ /^$Int$/ && $val !~ > /^$Octal$/) || > - length($val) ne 4)) { > + if (($val =~ /^$Int$/ && $val !~ > /^$Octal$/) || > + ($val =~ /^$Octal$/ && length($val) > ne 4)) { > ERROR("NON_OCTAL_PERMISSIONS", > "Use 4 digit octal (0777) > not decimal permissions\n" . $herecurr); > - } elsif ($val =~ /^$Octal$/ && > (oct($val) & 02)) { > + } > + if ($val =~ /^$Octal$/ && (oct($val) & > 02)) { > ERROR("EXPORTED_WORLD_WRITABLE", > "Exporting writable files > is usually an error. Consider more restrictive permissions.\n" . $herecurr); > } > + if ($val =~ > /\b$mode_perms_string_search\b/) { > + my $to = 0; > + while ($val =~ > /\b($mode_perms_string_search)\b(?:\s*\|\s*)?\s*/g) { > + $to |= > $mode_permission_string_types{$1}; > + } > + my $new = sprintf("%04o", $to); > + if (WARN("SYMBOLIC_PERMS", > + "Symbolic permissions > are not preferred. Consider using octal permissions $new.\n" . $herecurr) && > + $fix) { > + $fixed[$fixlinenr] =~ > s/\Q$val\E/$new/; > + } > + } > } > } > }
Re: [PATCH v4 1/4] mfd: mxs-lradc: Add support for mxs-lradc MFD
On 05/08/16 08:02, Lee Jones wrote: > On Thu, 04 Aug 2016, Alexander Stein wrote: > >> On Thursday 04 August 2016 15:28:18, Ksenija Stanojevic wrote: >>> Add core files for mxs-lradc MFD driver. >>> >>> Note: this patch won't compile in iio/testing without this patch: >>> a8f447be8056 ("mfd: Add resource managed APIs for mfd_add_devices") >>> >>> Signed-off-by: Ksenija Stanojevic>>> --- >>> [...] >>> +static int mxs_lradc_probe(struct platform_device *pdev) >>> +{ >>> + const struct of_device_id *of_id; >>> + struct device *dev = >dev; >>> + struct device_node *node = dev->of_node; >>> + struct mxs_lradc *lradc; >>> + struct resource *iores; >>> + struct mfd_cell *cells = NULL; >>> + int ret = 0; >>> + u32 ts_wires = 0; >>> + >>> + lradc = devm_kzalloc(>dev, sizeof(*lradc), GFP_KERNEL); >>> + if (!lradc) >>> + return -ENOMEM; >>> + >>> + of_id = of_match_device(mxs_lradc_dt_ids, >dev); >>> + lradc->soc = (enum mxs_lradc_id)of_id->data; >>> + >>> + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); >>> + lradc->base = devm_ioremap_resource(dev, iores); >> >> Out of couriosity: Is it common to pass already ioremapped addresses to (MFD >> cell) platform drivers? I would have expected, and done myself, that ioremap >> is done in the driver itself, same as the IRQ. > > Yes, this is exactly what should happen. > Lee, you've confused me with this answer. Yes, it is common or Yes it should have been done the way Alexander suggested? Jonathan
Re: [PATCH v3 1/4] hwmon: iio_hwmon: delay probing with late_initcall
On Mon, Aug 15, 2016 at 04:40:21PM +0100, Jonathan Cameron wrote: > On 26/07/16 17:04, Guenter Roeck wrote: > > On Tue, Jul 26, 2016 at 12:00:33PM +0200, Alexander Stein wrote: > >> On Tuesday 26 July 2016 11:33:59, Quentin Schulz wrote: > >>> On 26/07/2016 11:05, Alexander Stein wrote: > On Tuesday 26 July 2016 10:24:48, Quentin Schulz wrote: > > On 26/07/2016 10:21, Alexander Stein wrote: > >> On Tuesday 26 July 2016 09:43:44, Quentin Schulz wrote: > >>> iio_channel_get_all returns -ENODEV when it cannot find either > >>> phandles > >>> and > >>> properties in the Device Tree or channels whose consumer_dev_name > >>> matches > >>> iio_hwmon in iio_map_list. The iio_map_list is filled in by iio > >>> drivers > >>> which might be probed after iio_hwmon. > >> > >> Would it work if iio_channel_get_all returning ENODEV is used for > >> returning > >> EPROBE_DEFER in iio_channel_get_all? Using late initcalls for > >> driver/device > >> dependencies seems not right for me at this place. > > > > Then what if the iio_channel_get_all is called outside of the probe of a > > driver? We'll have to change the error code, things we are apparently > > trying to avoid (see v2 patches' discussions). > > Maybe I didn't express my idea enough. I don't want to change the > behavior > of iio_channel_get_all at all. Just the result evaluation of > iio_channel_get_all in iio_hwmon_probe. I have something link the patch > below in mind. > > Best regards, > Alexander > --- > diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c > index b550ba5..e32d150 100644 > --- a/drivers/hwmon/iio_hwmon.c > +++ b/drivers/hwmon/iio_hwmon.c > @@ -73,8 +73,12 @@ static int iio_hwmon_probe(struct platform_device > *pdev) > > name = dev->of_node->name; > > channels = iio_channel_get_all(dev); > > - if (IS_ERR(channels)) > - return PTR_ERR(channels); > + if (IS_ERR(channels)) { > + if (PTR_ERR(channels) == -ENODEV) > + return -EPROBE_DEFER; > + else > + return PTR_ERR(channels); > + } > > st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); > if (st == NULL) { > >>> > >>> Indeed, I misunderstood what you told me. > >>> > >>> Actually, the patch you proposed is part of my v1 > >>> (https://lkml.org/lkml/2016/6/28/203) and v2 > >>> (https://lkml.org/lkml/2016/7/15/215). > >>> Jonathan and Guenter didn't really like the idea of changing the -ENODEV > >>> in -EPROBE_DEFER. > >> > >> Thanks for the links. > >> > >>> What I thought you were proposing was to change the -ENODEV return code > >>> inside iio_channel_get_all. This cannot be an option since the function > >>> might be called outside of a probe (it is not yet, but might be in the > >>> future?). > >> > >> AFAICS this is a helper function not knowing about device probing itself. > >> And > >> it should stay at that. > >> > >>> Of what I understood, two possibilities are then possible (proposed > >>> either by Guenter or Jonathan): either rework the iio framework to > >>> register iio map array earlier or to use late_initcall instead of init > >>> for the driver consuming the iio channels. > >> > >> Interestingly using this problem would not arise due to module > >> dependencies. > >> But using late_initcall would mean this needs to be done on any driver > >> using > >> iio channels? I would rather keep those consumers simple. > >> > > Me too, but that would imply a solution in iio. The change you propose above > > isn't exactly simple either, and would also be needed in each consumer > > driver. > > > > Just for the record, I dislike the late_initcall solution as well, but I > > prefer > > it over blindly converting ENODEV to EPROBE_DEFER. > I'm falling on the other side on this one right now. Though I'd be tempted > to renaming the function to something like iio_channel_get_all_or_defer > to make it explicit that it can result in deferred probing. > Would this new function return -EPROBE_DEFER instead of -ENODEV ? Thanks, Guenter
[PATCH 1/1 linux-next RESEND] ARM: multi_v7_defconfig: update XILINX_VDMA
Commit fde57a7c4474 ("dmaengine: xilinx: Rename driver and config") renamed config XILINX_VDMA to config XILINX_DMA Update defconfig accordingly. Signed-off-by: Fabian Frederick--- Sending to arm-soc (suggested by Shawn Guo) arch/arm/configs/multi_v7_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 7db8dce..d3ef852 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -784,7 +784,7 @@ CONFIG_MXS_DMA=y CONFIG_DMA_BCM2835=y CONFIG_DMA_OMAP=y CONFIG_QCOM_BAM_DMA=y -CONFIG_XILINX_VDMA=y +CONFIG_XILINX_DMA=y CONFIG_DMA_SUN6I=y CONFIG_STAGING=y CONFIG_SENSORS_ISL29018=y -- 2.8.1
[RFC PATCH 04/16] DM: Ensure that the read request is within the device range.
If a read request is not within the device range return error. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index 17221a1..bf18028 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -1025,6 +1025,12 @@ static void dm_icomp_read_one_extent(struct dm_icomp_req *req, u64 block, { struct dm_icomp_io_range *io; + if (block+(data_sectors>>DMCP_BLOCK_SECTOR_SHIFT) >= + req->info->data_blocks) { + req->result = -EIO; + return; + } + io = dm_icomp_create_io_range(req, data_sectors << 9, logical_sectors << 9); if (!io) { @@ -1063,7 +1069,9 @@ again: block_index = first_block_index + (logical_sectors >> DMCP_BLOCK_SECTOR_SHIFT); - if ((block_index << DMCP_BLOCK_SECTOR_SHIFT) < bio_end_sector(req->bio)) + if (((block_index << DMCP_BLOCK_SECTOR_SHIFT) < +bio_end_sector(req->bio)) && + ((block_index) < req->info->data_blocks)) goto again; /* A shortcut if all data is in already */ -- 1.7.1
[RFC PATCH 08/16] DM: Tag a magicmarker at the end of each compressed segment.
We store the size of the compressed segment, on the sector boundary. And later use that location to determine the size of the compressed segment. However if that location is corrupted for any reason we would'nt know. Hence add a magicmarker to catch for such corruptions. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c | 24 drivers/md/dm-inplace-compress.h |1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index fe4a4c1..04decdd 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -984,19 +984,21 @@ static int dm_icomp_io_range_compress(struct dm_icomp_info *info, DMWARN("CO Error %d ", ret); atomic64_add(decomp_len, >uncompressed_write_size); - if (ret || decomp_len < actual_comp_len + sizeof(u32) + 512) { + if (ret || decomp_len < actual_comp_len + 2*sizeof(u32) + 512) { *comp_len = decomp_len; atomic64_add(*comp_len, >compressed_write_size); return 1; } *comp_len = round_up(actual_comp_len, 512); - if (*comp_len - actual_comp_len < sizeof(u32)) + if (*comp_len - actual_comp_len < 2*sizeof(u32)) *comp_len += 512; atomic64_add(*comp_len, >compressed_write_size); addr = io->comp_data + *comp_len; addr--; *addr = cpu_to_le32(actual_comp_len); + addr--; + *addr = cpu_to_le32(DMCP_COMPRESS_MAGIC); return 0; } @@ -1020,13 +1022,19 @@ static int dm_icomp_io_range_decompress(struct dm_icomp_info *info, addr = comp_data + comp_len; addr--; comp_len = le32_to_cpu(*addr); + addr--; - tfm = info->tfm[get_cpu()]; - ret = crypto_comp_decompress(tfm, comp_data, comp_len, - decomp_data, _len); - put_cpu(); - if (ret) - return -EINVAL; + if (comp_len == decomp_len) + return 1; + if (le32_to_cpu(*addr) == DMCP_COMPRESS_MAGIC) { + tfm = info->tfm[get_cpu()]; + ret = crypto_comp_decompress(tfm, comp_data, comp_len, + decomp_data, _len); + put_cpu(); + if (ret) + return -EINVAL; + } else + memset(decomp_data, 0, decomp_len); return 0; } diff --git a/drivers/md/dm-inplace-compress.h b/drivers/md/dm-inplace-compress.h index 86c0ce6..1ce7a6e 100644 --- a/drivers/md/dm-inplace-compress.h +++ b/drivers/md/dm-inplace-compress.h @@ -3,6 +3,7 @@ #include #define DMCP_SUPER_MAGIC 0x106526c206506c09 +#define DMCP_COMPRESS_MAGIC 0xfaceecaf struct dm_icomp_super_block { __le64 magic; __le64 meta_blocks; -- 1.7.1
Re: [PATCH v3 1/4] iio: adc: rockchip_saradc: reset saradc controller before programming it
On 15/08/16 18:41, Jonathan Cameron wrote: > On 27/07/16 15:24, Caesar Wang wrote: >> SARADC controller needs to be reset before programming it, otherwise >> it will not function properly. >> >> Signed-off-by: Caesar Wang>> Cc: Jonathan Cameron >> Cc: Heiko Stuebner >> Cc: Rob Herring >> Cc: linux-...@vger.kernel.org >> Cc: linux-rockc...@lists.infradead.org >> Tested-by: Guenter Roeck >> > Hi > > Patch is fine (I'll fix up the wording issue) however... > > I'm not clear on the severity of the issue. Is this something > we should be pushing for stable? To add to this, it's only useful to take this for stable if we are also fine taking the device tree updates to make it actually do something! > > Jonathan >> --- >> >> Changes in v3: >> - %s/devm_reset_control_get_optional()/devm_reset_control_get() >> - add Guente's test tag. >> >> Changes in v2: >> - Make the reset as an optional property, since it should work >> with old devicetrees as well. >> >> .../bindings/iio/adc/rockchip-saradc.txt | 7 + >> drivers/iio/adc/Kconfig| 1 + >> drivers/iio/adc/rockchip_saradc.c | 30 >> ++ >> 3 files changed, 38 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt >> b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt >> index bf99e2f..205593f 100644 >> --- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt >> +++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt >> @@ -16,6 +16,11 @@ Required properties: >> - vref-supply: The regulator supply ADC reference voltage. >> - #io-channel-cells: Should be 1, see ../iio-bindings.txt >> >> +Optional properties: >> +- resets: Must contain an entry for each entry in reset-names if need >> support >> + this option. See ../reset/reset.txt for details. >> +- reset-names: Must include the name "saradc-apb". >> + >> Example: >> saradc: saradc@2006c000 { >> compatible = "rockchip,saradc"; >> @@ -23,6 +28,8 @@ Example: >> interrupts = ; >> clocks = < SCLK_SARADC>, < PCLK_SARADC>; >> clock-names = "saradc", "apb_pclk"; >> +resets = < SRST_SARADC>; >> +reset-names = "saradc-apb"; >> #io-channel-cells = <1>; >> vref-supply = <>; >> }; >> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >> index 1de31bd..7675772 100644 >> --- a/drivers/iio/adc/Kconfig >> +++ b/drivers/iio/adc/Kconfig >> @@ -389,6 +389,7 @@ config QCOM_SPMI_VADC >> config ROCKCHIP_SARADC >> tristate "Rockchip SARADC driver" >> depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) >> +depends on RESET_CONTROLLER >> help >>Say yes here to build support for the SARADC found in SoCs from >>Rockchip. >> diff --git a/drivers/iio/adc/rockchip_saradc.c >> b/drivers/iio/adc/rockchip_saradc.c >> index f9ad6c2..85d7012 100644 >> --- a/drivers/iio/adc/rockchip_saradc.c >> +++ b/drivers/iio/adc/rockchip_saradc.c >> @@ -21,6 +21,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> #include >> #include >> >> @@ -53,6 +55,7 @@ struct rockchip_saradc { >> struct clk *clk; >> struct completion completion; >> struct regulator*vref; >> +struct reset_control*reset; >> const struct rockchip_saradc_data *data; >> u16 last_val; >> }; >> @@ -190,6 +193,16 @@ static const struct of_device_id >> rockchip_saradc_match[] = { >> }; >> MODULE_DEVICE_TABLE(of, rockchip_saradc_match); >> >> +/** >> + * Reset SARADC Controller. >> + */ >> +static void rockchip_saradc_reset_controller(struct reset_control *reset) >> +{ >> +reset_control_assert(reset); >> +usleep_range(10, 20); >> +reset_control_deassert(reset); >> +} >> + >> static int rockchip_saradc_probe(struct platform_device *pdev) >> { >> struct rockchip_saradc *info = NULL; >> @@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device >> *pdev) >> if (IS_ERR(info->regs)) >> return PTR_ERR(info->regs); >> >> +/* >> + * The reset should be an optional property, as it should work >> + * with old devicetrees as well >> + */ >> +info->reset = devm_reset_control_get(>dev, "saradc-apb"); >> +if (IS_ERR(info->reset)) { >> +ret = PTR_ERR(info->reset); >> +if (ret != -ENOENT) >> +return ret; >> + >> +dev_dbg(>dev, "no reset control found\n"); >> +info->reset = NULL; >> +} >> + >> init_completion(>completion); >> >> irq = platform_get_irq(pdev, 0); >> @@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device >> *pdev) >> return PTR_ERR(info->vref); >> } >> >> +
[PATCH] libnvdimm: Fix nvdimm_probe error on NVDIMM-N
'ndctl list --buses --dimms' does not list any NVDIMM-Ns since they are considered as idle. ndctl checks if any driver is attached to nmem device. nvdimm_probe() always fails in nvdimm_init_nsarea() since NVDIMM-Ns do not implement optinal ND_CMD_GET_CONFIG_DATA command. Change nvdimm_probe() to accept the case that the CONFIG_DATA command is not implemented for NVDIMM-Ns. The driver attaches without ndd, which keeps it no-op to the device. Reported-by: Brian BoylstonSigned-off-by: Toshi Kani Cc: Dan Williams --- drivers/nvdimm/dimm.c | 10 ++ drivers/nvdimm/dimm_devs.c | 27 --- drivers/nvdimm/nd.h|1 + 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c index 71d12bb..07e09c2 100644 --- a/drivers/nvdimm/dimm.c +++ b/drivers/nvdimm/dimm.c @@ -26,6 +26,13 @@ static int nvdimm_probe(struct device *dev) struct nvdimm_drvdata *ndd; int rc; + rc = nvdimm_check_config_data(dev); + if (rc == -ENOENT) + /* not required for non-aliased nvdimm, ex. NVDIMM-N */ + return 0; + else + return rc; + ndd = kzalloc(sizeof(*ndd), GFP_KERNEL); if (!ndd) return -ENOMEM; @@ -72,6 +79,9 @@ static int nvdimm_remove(struct device *dev) { struct nvdimm_drvdata *ndd = dev_get_drvdata(dev); + if (!ndd) + return 0; + nvdimm_bus_lock(dev); dev_set_drvdata(dev, NULL); nvdimm_bus_unlock(dev); diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index d9bba5e..fee82d3 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -28,28 +28,33 @@ static DEFINE_IDA(dimm_ida); * Retrieve bus and dimm handle and return if this bus supports * get_config_data commands */ -static int __validate_dimm(struct nvdimm_drvdata *ndd) +int nvdimm_check_config_data(struct device *dev) { - struct nvdimm *nvdimm; - - if (!ndd) - return -EINVAL; - - nvdimm = to_nvdimm(ndd->dev); + struct nvdimm *nvdimm = to_nvdimm(dev); if (!nvdimm->cmd_mask) - return -ENXIO; + goto err; if (!test_bit(ND_CMD_GET_CONFIG_DATA, >cmd_mask)) - return -ENXIO; + goto err; return 0; + + err: + if (nvdimm->flags & NDD_ALIASING) + return -ENXIO; + else + return -ENOENT; } static int validate_dimm(struct nvdimm_drvdata *ndd) { - int rc = __validate_dimm(ndd); + int rc; - if (rc && ndd) + if (!ndd) + return -EINVAL; + + rc = nvdimm_check_config_data(ndd->dev); + if (rc) dev_dbg(ndd->dev, "%pf: %s error: %d\n", __builtin_return_address(0), __func__, rc); return rc; diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index 8024a0e..38d6f03 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -191,6 +191,7 @@ void nvdimm_exit(void); void nd_region_exit(void); struct nvdimm; struct nvdimm_drvdata *to_ndd(struct nd_mapping *nd_mapping); +int nvdimm_check_config_data(struct device *dev); int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd); int nvdimm_init_config_data(struct nvdimm_drvdata *ndd); int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
Re: [PATCH] iio: orientation: Add BNO055 9-axis Absolute Orientation Sensor driver
On 27/07/16 01:22, navin patidar wrote: > Oh, I didn't know that Vlad already have submitted a patch for BNO055. > My patch doesn't do any thing new so please drop my patch. > > regards, > --navin-patidar You have my utmost sympathies! Sadly this happens to us all from time to time. Jonathan > > On Tue, Jul 26, 2016 at 11:46 AM, Peter Meerwald-Stadler >wrote: >> Hallo Navin, >> >>> Thanks for reviewing the patch. I will send the updated patch. >> >> I am sorry to have overlooked a previous patch by Vlad Dogaru, see >> http://comments.gmane.org/gmane.linux.kernel.iio/24643, for the BNO055 >> >> there have been a number of issues, it has not been accepted yet >> >> I think our policy is first come, first served; I have compared the two >> patches, maybe you can collaborate on a common proposal? >> >> regards, p. >> >>> regards, >>> --navin-patidar >>> >>> On Tue, Jul 26, 2016 at 1:07 AM, Peter Meerwald-Stadler >>> wrote: >>> > BNO055 provides the following motion sensors data: > > * Gyroscope > * Accelerometer > * Magnetometer > * Absolute Orientation (Quaternion) comments below > Signed-off-by: navin patidar > --- > drivers/iio/orientation/Kconfig | 10 + > drivers/iio/orientation/Makefile | 1 + > drivers/iio/orientation/bno055.c | 422 +++ > 3 files changed, 433 insertions(+) > create mode 100644 drivers/iio/orientation/bno055.c > > diff --git a/drivers/iio/orientation/Kconfig b/drivers/iio/orientation/Kconfig > index e3aa1e5..9ac21ee 100644 > --- a/drivers/iio/orientation/Kconfig > +++ b/drivers/iio/orientation/Kconfig > @@ -28,4 +28,14 @@ config HID_SENSOR_DEVICE_ROTATION > device rotation. The output of a device rotation sensor > is presented using quaternion format. > > +config BNO055 > + tristate "BOSCH BNO055 Absolute Orientation" > + depends on I2C > + select REGMAP_I2C > + help > + Say yes here to build support for BOSCH BNO55 9-axis absolute orientation sensor > + driver connected via I2C. > + This driver can also be built as a module. If so, the module > + will be called bno055. > + > endmenu > diff --git a/drivers/iio/orientation/Makefile b/drivers/iio/orientation/Makefile > index 4734dab..7d00037 100644 > --- a/drivers/iio/orientation/Makefile > +++ b/drivers/iio/orientation/Makefile > @@ -5,3 +5,4 @@ > # When adding new entries keep the list in alphabetical order > obj-$(CONFIG_HID_SENSOR_INCLINOMETER_3D) += hid-sensor-incl-3d.o > obj-$(CONFIG_HID_SENSOR_DEVICE_ROTATION) += hid-sensor-rotation.o > +obj-$(CONFIG_BNO055) += bno055.o > diff --git a/drivers/iio/orientation/bno055.c b/drivers/iio/orientation/bno055.c > new file mode 100644 > index 000..48b9e93 > --- /dev/null > +++ b/drivers/iio/orientation/bno055.c > @@ -0,0 +1,422 @@ > +/* > + * Copyright (c) 2016 Intel Corporation > + * > + * Driver for Bosch Sensortec BNO055 digital motion sensor. > + * > + * 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. > + * I find it useful to state the 7-bit i2c chip address here > + */ > + > +#define pr_fmt(fmt) "bno055: " fmt > + > +#include > +#include > +#include > +#include > +#include > +#include > + drop one newline > + > +#define BNO055_CHIP_ID 0xA0 > +#define REG_MAG_RADIUS_MSB 0x6A please consistently prefix with BNO055_ > + > +/* BNO055 configuration registers */ > +#define REG_PWR_MODE 0x3E > +#define REG_OPR_MODE 0x3D > +#define REG_UNIT_SEL 0x3B > +#define REG_AXIS_MAP_SIGN0x42 > +#define REG_AXIS_MAP_CONFIG 0x41 > +#define REG_UNIT_SEL 0x3B > +#define REG_SYS_TRIGGER 0x3F > +#define BNO055_REG_PAGE_ID 0x07 > +#define BNO055_REG_ID0x00 > + > +/* BNO055 status registers */ > +#define SYS_STATUS 0x39 > +#define INT_STATUS 0x37 > +#define CALIB_STATUS 0x35 > + > +/* BNO055 data registers */ drop newline > + > +#define GRV_DATA_Z_MSB 0x33 > +#define GRV_DATA_Z_LSB 0x32 > +#define GRV_DATA_Y_MSB 0x31 > +#define GRV_DATA_Y_LSB 0x30 > +#define GRV_DATA_X_MSB 0x2F > +#define GRV_DATA_X_LSB 0x2E do we really need all those register #defines? they are not used and noone wants to read just the LSB... > + > +#define LIA_DATA_Z_MSB 0x2D > +#define LIA_DATA_Z_LSB 0x2C
[PATCH 18/22] IB/mlx4/mcg: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "mcg_wq" queues work items >work and >timeout_work. The workqueue "clean_wq" queues work item mcg_clean_task. Both have been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/mlx4/mcg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 8f7ad07..7d30be0 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c @@ -1045,7 +1045,7 @@ int mlx4_ib_mcg_port_init(struct mlx4_ib_demux_ctx *ctx) atomic_set(>tid, 0); sprintf(name, "mlx4_ib_mcg%d", ctx->port); - ctx->mcg_wq = create_singlethread_workqueue(name); + ctx->mcg_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!ctx->mcg_wq) return -ENOMEM; @@ -1246,7 +1246,7 @@ void clean_vf_mcast(struct mlx4_ib_demux_ctx *ctx, int slave) int mlx4_ib_mcg_init(void) { - clean_wq = create_singlethread_workqueue("mlx4_ib_mcg"); + clean_wq = alloc_ordered_workqueue("mlx4_ib_mcg", WQ_MEM_RECLAIM); if (!clean_wq) return -ENOMEM; -- 2.1.4
[PATCH 20/22] IB/ipoib: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() replaces deprecated create_singlethread_workqueue(). The workqueue "ipoib_workqueue" that is used for all flush operstions for the device. WQ_MEM_RECLAIM has not been set since it is not being used on a memory reclaim path. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 5f58c41..a8043a3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -2197,7 +2197,8 @@ static int __init ipoib_init_module(void) * its private workqueue, and we only queue up flush events * on our global flush workqueue. This avoids the deadlocks. */ - ipoib_workqueue = create_singlethread_workqueue("ipoib_flush"); + ipoib_workqueue = alloc_ordered_workqueue("ipoib_flush", + WQ_MEM_RECLAIM); if (!ipoib_workqueue) { ret = -ENOMEM; goto err_fs; -- 2.1.4
[PATCH v2] MAINTAINERS: Switch to kernel.org account for Krzysztof Kozlowski
Change my email address to kernel.org account instead of Samsung one. Also switch Maxim MUIC charger drivers from supported to maintained mode. Signed-off-by: Krzysztof KozlowskiCc: Kukjin Kim Cc: linux-samsung-...@vger.kernel.org --- Changes since v1: 1. Update also mailmap after Joe Perches suggestion. Affected drivers/subsystems: 1. arch/arm, 2. mfd, 3. power, 4. regulator, 5. clk, 6. rtc, 7. extcon, 8. pinctrl, 9. sound/soc, However if there are no objections, I can push it through my tree (to arm-soc folks). --- .mailmap| 1 + MAINTAINERS | 14 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.mailmap b/.mailmap index 2a91c14c80bf..b18912c5121e 100644 --- a/.mailmap +++ b/.mailmap @@ -88,6 +88,7 @@ Kay Sievers Kenneth W Chen Konstantin Khlebnikov Koushik +Krzysztof Kozlowski Krzysztof Kozlowski Kuninori Morimoto Leonid I Ananiev diff --git a/MAINTAINERS b/MAINTAINERS index 45c98485c3f0..d437e0123bac 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1623,7 +1623,7 @@ N:rockchip ARM/SAMSUNG EXYNOS ARM ARCHITECTURES M: Kukjin Kim -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) L: linux-samsung-...@vger.kernel.org (moderated for non-subscribers) S: Maintained @@ -7465,9 +7465,9 @@ F: Documentation/devicetree/bindings/sound/max9860.txt F: sound/soc/codecs/max9860.* MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski L: linux...@vger.kernel.org -S: Supported +S: Maintained F: drivers/power/supply/max14577_charger.c F: drivers/power/supply/max77693_charger.c @@ -7481,7 +7481,7 @@ F:include/dt-bindings/*/*max77802.h MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS M: Chanwoo Choi -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski L: linux-kernel@vger.kernel.org S: Supported F: drivers/*/max14577*.c @@ -9258,7 +9258,7 @@ F:drivers/pinctrl/sh-pfc/ PIN CONTROLLER - SAMSUNG M: Tomasz Figa -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski M: Sylwester Nawrocki L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) L: linux-samsung-...@vger.kernel.org (moderated for non-subscribers) @@ -10189,7 +10189,7 @@ S: Maintained F: drivers/platform/x86/samsung-laptop.c SAMSUNG AUDIO (ASoC) DRIVERS -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski M: Sangbeom Kim M: Sylwester Nawrocki L: alsa-de...@alsa-project.org (moderated for non-subscribers) @@ -10204,7 +10204,7 @@ F: drivers/video/fbdev/s3c-fb.c SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS M: Sangbeom Kim -M: Krzysztof Kozlowski +M: Krzysztof Kozlowski L: linux-kernel@vger.kernel.org L: linux-samsung-...@vger.kernel.org S: Supported -- 2.7.4
Re: [PATCH v7 1/2] mtd: nand_bbt: Move BBT block selection logic out of write_bbt()
On Sat, Aug 13, 2016 at 12:37:03AM +0200, Boris Brezillon wrote: > On Fri, 12 Aug 2016 16:58:22 -0500 > Kyle Roeschleywrote: > [...] > > + while (chip < nrchips) { > > I'm probably missing something, but why are you turning the for loop > into a while loop in this patch? The commit message does not mention > that, and I don't see why you need it before you actually start > reworking the code to recover from BBT write failures (which is done in > patch 2). > You had changed it in patch 2 (http://code.bulix.org/e16nvo-104988) and I just shuffled it to the first patch since it seemed to make sense as additional code cleanup. I'll go ahead and drop it though if you don't want it in. -- Kyle Roeschley Software Engineer National Instruments
BUG and WARN kernel log levels
Hi, So, I noticed that asm-gemeric/bug.h defines BUG() without a log level: #ifndef HAVE_ARCH_BUG #define BUG() do { \ printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ Seems like it should have one? Also, I think we might want to examine WARN() a bit... it doesn't have a log level either, but only a fraction of callers set one: $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep -v KERN_ | wc -l 2735 $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep KERN_ | wc -l 77 If I'm reading checkpatch.pl correctly, it doesn't warn about missing log levels on WARN calls, but I think it should. How do you think is best to clean this up? Mainly, I'd like to add a format string to BUG, or introduce a new BUGish call that takes a format... -Kees -- Kees Cook Nexus Security
Re: [PATCH] fjes: Delete owner assignment
From: SF Markus ElfringDate: Mon, 15 Aug 2016 08:44:19 +0200 > From: Markus Elfring > Date: Mon, 15 Aug 2016 08:34:56 +0200 > > The field "owner" is set by core. Thus delete an extra initialisation. > > Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci > Signed-off-by: Markus Elfring Applied, thank you.
[PATCH v4 11/13] media: platform: pxa_camera: add debug register access
Add pxa_camera registers access through advanced video debugging. Signed-off-by: Robert Jarzmik--- drivers/media/platform/soc_camera/pxa_camera.c | 32 ++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 395cd398c32b..fb89b85f59ab 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -1342,6 +1342,34 @@ static int pxa_camera_check_frame(u32 width, u32 height) (width & 0x01); } +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int pxac_vidioc_g_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct pxa_camera_dev *pcdev = video_drvdata(file); + + if (reg->reg > CIBR2) + return -ERANGE; + + reg->val = __raw_readl(pcdev->base + reg->reg); + reg->size = sizeof(__u32); + return 0; +} + +static int pxac_vidioc_s_register(struct file *file, void *priv, + const struct v4l2_dbg_register *reg) +{ + struct pxa_camera_dev *pcdev = video_drvdata(file); + + if (reg->reg > CIBR2) + return -ERANGE; + if (reg->size != sizeof(__u32)) + return -EINVAL; + __raw_writel(reg->val, pcdev->base + reg->reg); + return 0; +} +#endif + static int pxac_vidioc_enum_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_fmtdesc *f) { @@ -1592,6 +1620,10 @@ static const struct v4l2_ioctl_ops pxa_camera_ioctl_ops = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_streamon= vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = pxac_vidioc_g_register, + .vidioc_s_register = pxac_vidioc_s_register, +#endif }; static struct v4l2_clk_ops pxa_camera_mclk_ops = { -- 2.1.4
[PATCH v4 13/13] media: platform: pxa_camera: move pxa_camera out of soc_camera
As the conversion to a v4l2 standalone device is finished, move pxa_camera one directory up and finish severing any dependency to soc_camera. Signed-off-by: Robert Jarzmik--- drivers/media/platform/Kconfig |8 + drivers/media/platform/Makefile|1 + drivers/media/platform/pxa_camera.c| 2096 drivers/media/platform/soc_camera/Kconfig |8 - drivers/media/platform/soc_camera/Makefile |1 - drivers/media/platform/soc_camera/pxa_camera.c | 2096 6 files changed, 2105 insertions(+), 2105 deletions(-) create mode 100644 drivers/media/platform/pxa_camera.c delete mode 100644 drivers/media/platform/soc_camera/pxa_camera.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index f25344bc7912..299af1977d61 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -91,6 +91,14 @@ config VIDEO_OMAP3_DEBUG ---help--- Enable debug messages on OMAP 3 camera controller driver. +config VIDEO_PXA27x + tristate "PXA27x Quick Capture Interface driver" + depends on VIDEO_DEV && PXA27x && HAS_DMA + select VIDEOBUF2_DMA_SG + select SG_SPLIT + ---help--- + This is a v4l2 driver for the PXA27x Quick Capture Interface + config VIDEO_S3C_CAMIF tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 21771c1a13fb..e38918bbe0d0 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/ +obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o soc_camera/soc_mediabus.o obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c new file mode 100644 index ..868c6ad4784c --- /dev/null +++ b/drivers/media/platform/pxa_camera.c @@ -0,0 +1,2096 @@ +/* + * V4L2 Driver for PXA camera host + * + * Copyright (C) 2006, Sascha Hauer, Pengutronix + * Copyright (C) 2008, Guennadi Liakhovetski + * Copyright (C) 2016, Robert Jarzmik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#define PXA_CAM_VERSION "0.0.6" +#define PXA_CAM_DRV_NAME "pxa27x-camera" + +#define DEFAULT_WIDTH 640 +#define DEFAULT_HEIGHT 480 + +/* Camera Interface */ +#define CICR0 0x +#define CICR1 0x0004 +#define CICR2 0x0008 +#define CICR3 0x000C +#define CICR4 0x0010 +#define CISR 0x0014 +#define CIFR 0x0018 +#define CITOR 0x001C +#define CIBR0 0x0028 +#define CIBR1 0x0030 +#define CIBR2 0x0038 + +#define CICR0_DMAEN(1 << 31) /* DMA request enable */ +#define CICR0_PAR_EN (1 << 30) /* Parity enable */ +#define CICR0_SL_CAP_EN(1 << 29) /* Capture enable for slave mode */ +#define CICR0_ENB (1 << 28) /* Camera interface enable */ +#define CICR0_DIS (1 << 27) /* Camera interface disable */ +#define CICR0_SIM (0x7 << 24) /* Sensor interface mode mask */ +#define CICR0_TOM (1 << 9)/* Time-out mask */ +#define CICR0_RDAVM(1 << 8)/* Receive-data-available mask */ +#define CICR0_FEM (1 << 7)/* FIFO-empty mask */ +#define CICR0_EOLM (1 << 6)/* End-of-line mask */ +#define CICR0_PERRM(1 << 5)/* Parity-error mask */ +#define CICR0_QDM (1 << 4)/* Quick-disable mask */ +#define CICR0_CDM (1 << 3)/* Disable-done mask */ +#define CICR0_SOFM (1 << 2)/* Start-of-frame mask */ +#define CICR0_EOFM (1 << 1)/* End-of-frame mask */ +#define CICR0_FOM (1 << 0)/* FIFO-overrun mask */ + +#define CICR1_TBIT (1 << 31) /* Transparency bit */ +#define CICR1_RGBT_CONV(0x3 << 29) /* RGBT conversion mask */ +#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */ +#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */ +#define CICR1_RGB_F(1 << 11) /* RGB format */ +#define
[PATCH v4 02/13] media: mt9m111: use only the SRGB colorspace
mt9m111 being a camera sensor, its colorspace should always be SRGB, for both RGB based formats or YCbCr based ones. Signed-off-by: Robert Jarzmik--- drivers/media/i2c/soc_camera/mt9m111.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index a7efaa5964d1..b7c4f371bae1 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -188,10 +188,10 @@ struct mt9m111_datafmt { }; static const struct mt9m111_datafmt mt9m111_colour_fmts[] = { - {MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_YVYU8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_JPEG}, + {MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_YVYU8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB}, -- 2.1.4
[PATCH v4 12/13] media: platform: pxa_camera: change stop_streaming semantics
Instead of the legacy behavior where it was required to wait for all video buffers to be finished by the hardware, use a cancel like strategy : as soon as the stop_streaming() call is done, abort all DMA transfers, report the already buffers as failed and return. This makes stop_streaming() more a "cancel capture" than a "wait for end of capture" semantic. Signed-off-by: Robert Jarzmik--- drivers/media/platform/soc_camera/pxa_camera.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index fb89b85f59ab..868c6ad4784c 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -523,7 +523,8 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) } static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, - struct pxa_buffer *buf) + struct pxa_buffer *buf, + enum vb2_buffer_state state) { struct vb2_buffer *vb = >vbuf.vb2_buf; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); @@ -645,7 +646,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, } buf->active_dma &= ~act_dma; if (!buf->active_dma) { - pxa_camera_wakeup(pcdev, buf); + pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_DONE); pxa_camera_check_link_miss(pcdev, last_buf->cookie[chan], last_issued); } @@ -1087,7 +1088,15 @@ static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) static void pxac_vb2_stop_streaming(struct vb2_queue *vq) { - vb2_wait_for_all_buffers(vq); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + struct pxa_buffer *buf, *tmp; + + dev_dbg(pcdev_to_dev(pcdev), "%s active=%p\n", + __func__, pcdev->active); + pxa_camera_stop_capture(pcdev); + + list_for_each_entry_safe(buf, tmp, >capture, queue) + pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_ERROR); } static struct vb2_ops pxac_vb2_ops = { -- 2.1.4
[PATCH 1/7] ext2: tell DAX the size of allocation holes
When DAX calls ext2_get_block() and the file offset points to a hole we currently don't set bh_result->b_size. When we re-enable PMD faults DAX will need bh_result->b_size to tell it the size of the hole so it can decide whether to fault in a 4 KiB zero page or a 2 MiB zero page. For ext2 we always want DAX to use 4 KiB zero pages, so we just tell DAX that all holes are 4 KiB in size. Signed-off-by: Ross Zwisler--- fs/ext2/inode.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index d5c7d09..c6d9763 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -773,6 +773,12 @@ int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_ if (ret > 0) { bh_result->b_size = (ret << inode->i_blkbits); ret = 0; + } else if (ret == 0 && IS_DAX(inode)) { + /* +* We have hit a hole. Tell DAX it is 4k in size so that it +* uses PTE faults. +*/ + bh_result->b_size = PAGE_SIZE; } return ret; -- 2.9.0
Re: [PATCH stable-4.4 1/3] mm: memcontrol: fix cgroup creation failure after many small jobs
On Mon, Aug 15, 2016 at 05:35:17PM +0200, Michal Hocko wrote: > Updated patch Thanks for this, and the updated patch series, I've now replaced the previous versions with this series. greg k-h
[PATCH] EDAC, mpc85xx: Fix PCIe error capture
According to the reference manual of MPC8572 and T4240, bit 31 of PEX_ERR_CAP_STAT is W1C (write 1 to clear). This patch adds the corresponding write to PEX_ERR_CAP_STAT in order to fix the PCIe error capture. Tested on a T4240 processor. Signed-off-by: Tillmann Heidsieck--- drivers/edac/mpc85xx_edac.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index ca63d0da8889..f5283f5c07cb 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c @@ -187,14 +187,14 @@ static void mpc85xx_pci_check(struct edac_pci_ctl_info *pci) static void mpc85xx_pcie_check(struct edac_pci_ctl_info *pci) { struct mpc85xx_pci_pdata *pdata = pci->pvt_info; - u32 err_detect; + u32 err_detect, err_cap_stat; err_detect = in_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR); + err_cap_stat = in_be32(pdata->pci_vbase + MPC85XX_PCI_GAS_TIMR); pr_err("PCIe error(s) detected\n"); pr_err("PCIe ERR_DR register: 0x%08x\n", err_detect); - pr_err("PCIe ERR_CAP_STAT register: 0x%08x\n", - in_be32(pdata->pci_vbase + MPC85XX_PCI_GAS_TIMR)); + pr_err("PCIe ERR_CAP_STAT register: 0x%08x\n", err_cap_stat); pr_err("PCIe ERR_CAP_R0 register: 0x%08x\n", in_be32(pdata->pci_vbase + MPC85XX_PCIE_ERR_CAP_R0)); pr_err("PCIe ERR_CAP_R1 register: 0x%08x\n", @@ -206,6 +206,9 @@ static void mpc85xx_pcie_check(struct edac_pci_ctl_info *pci) /* clear error bits */ out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR, err_detect); + + /* reset error capture */ + out_be32(pdata->pci_vbase + MPC85XX_PCI_GAS_TIMR, err_cap_stat | 0x1); } static int mpc85xx_pcie_find_capability(struct device_node *np) @@ -344,6 +347,9 @@ static int mpc85xx_pci_err_probe(struct platform_device *op) /* clear error bits */ out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_DR, ~0); + /* reset error capture */ + out_be32(pdata->pci_vbase + MPC85XX_PCI_GAS_TIMR, 0x1); + if (edac_pci_add_device(pci, pdata->edac_idx) > 0) { edac_dbg(3, "failed edac_pci_add_device()\n"); goto err; -- 2.9.3
Re: [PATCH] power:bq27xxx: 27000/10 read FLAGS register as single
Hi, On Mon, Jul 18, 2016 at 06:12:09PM +0200, H. Nikolaus Schaller wrote: > The bq27000 and bq27010 have a single byte FLAGS register. > Other gauges have 16 bit FLAGS registers. > > For reading the FLAGS register it is sufficient to read the single > register instead of reading RSOC at the next higher address as > well and then ignore the high byte. > > This does not change functionality but optimizes i2c and hdq > traffic. Thanks, queued into power-supply's -next branch. -- Sebastian signature.asc Description: PGP signature
[PATCH 1/2] staging: lustre: Add include path to Makefile
Start to rationalize include paths in source code files. Signed-off-by: Joe Perches--- drivers/staging/lustre/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/lustre/Makefile b/drivers/staging/lustre/Makefile index 95ffe33..9d00237 100644 --- a/drivers/staging/lustre/Makefile +++ b/drivers/staging/lustre/Makefile @@ -1,2 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/include/ +subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include/ + obj-$(CONFIG_LNET) += lnet/ obj-$(CONFIG_LUSTRE_FS)+= lustre/ -- 2.8.0.rc4.16.g56331f8
[PATCH 0/2] staging: lustre: #include neatening
Make it a bit easier to grep and help a future move out of staging. Joe Perches (2): staging: lustre: Add include path to Makefile staging: lustre: Remove .. paths from '#include "' uses drivers/staging/lustre/Makefile | 3 +++ drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +++--- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 8 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/fail.c | 2 +- drivers/staging/lustre/lnet/libcfs/hash.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c| 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_mem.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c | 4 ++-- drivers/staging/lustre/lnet/libcfs/linux/linux-curproc.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c | 2 +- drivers/staging/lustre/lnet/libcfs/module.c | 10 +- drivers/staging/lustre/lnet/libcfs/prng.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.h | 2 +- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 4 ++-- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lo.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 4 ++-- drivers/staging/lustre/lnet/lnet/net_fault.c| 4 ++-- drivers/staging/lustre/lnet/lnet/nidstrings.c | 4 ++-- drivers/staging/lustre/lnet/lnet/peer.c | 4 ++-- drivers/staging/lustre/lnet/lnet/router.c | 2 +- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 6 +++--- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 8 drivers/staging/lustre/lnet/selftest/console.c | 4 ++-- drivers/staging/lustre/lnet/selftest/console.h | 8 drivers/staging/lustre/lnet/selftest/rpc.h | 2 +- drivers/staging/lustre/lnet/selftest/selftest.h | 10 +- drivers/staging/lustre/lustre/fid/fid_internal.h| 2 +- drivers/staging/lustre/lustre/fid/fid_lib.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +- drivers/staging/lustre/lustre/fld/fld_internal.h| 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/include/interval_tree.h | 2 +- drivers/staging/lustre/lustre/include/linux/lustre_lite.h | 2 +- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_disk.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_fid.h | 2 +- drivers/staging/lustre/lustre/include/lustre_fld.h | 2 +- drivers/staging/lustre/lustre/include/lustre_handles.h | 2 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 2 +- drivers/staging/lustre/lustre/include/lustre_mds.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 6 +++--- drivers/staging/lustre/lustre/include/obd_cksum.h | 4 ++--
[RFC PATCH 05/16] DM: allocation/free helper routines.
Helper functions to allocate/reallocate and free memory. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index bf18028..c11567c 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -774,6 +774,23 @@ static void dm_icomp_get_req(struct dm_icomp_req *req) atomic_inc(>io_pending); } +static void *dm_icomp_kmalloc(size_t size, gfp_t flags) +{ + return kmalloc(size, flags); +} + +static void *dm_icomp_krealloc(void *addr, size_t size, +size_t orig_size, gfp_t flags) +{ + return krealloc(addr, size, flags); +} + +static void dm_icomp_kfree(void *addr, unsigned int size) +{ + kfree(addr); +} + + static void dm_icomp_free_io_range(struct dm_icomp_io_range *io) { kfree(io->decomp_data); -- 1.7.1
[RFC PATCH 01/16] DM: dm-inplace-compress: an inplace compressed DM target
From: Shaohua LiThis is a simple DM target supporting inplace compression. Its best suited for SSD. The underlying disk must support 512B sector size, the target only supports 4k sector size. Disk layout: |super|...meta...|..data...| Store unit is 4k (a block). Super is 1 block, which stores meta and data size and compression algorithm. Meta is a bitmap. For each data block, there are 5 bits meta. Data: Data of a block is compressed. Compressed data is round up to 512B, which is the payload. In disk, payload is stored at the beginning of logical sector of the block. Let's look at an example. Say we store data to block A, which is in sector B(A*8), its orginal size is 4k, compressed size is 1500. Compressed data (CD) will use 3 sectors (512B). The 3 sectors are the payload. Payload will be stored at sector B. --- ... | CD1 | CD2 | CD3 | | | | || ... --- ^B^B+1 ^B+2 ^B+7 ^B+8 For this block, we will not use sector B+3 to B+7 (a hole). We use 4 meta bits to present payload size. The compressed size (1500) isn't stored in meta directly. Instead, we store it at the last 32bits of payload. In this example, we store it at the end of sector B+2. If compressed size + sizeof(32bits) crosses a sector, payload size will increase one sector. If payload uses 8 sectors, we store uncompressed data directly. If IO size is bigger than one block, we can store the data as an extent. Data of the whole extent will compressed and stored in the similar way like above. The first block of the extent is the head, all others are the tail. If extent is 1 block, the block is head. We have 1 bit of meta to present if a block is head or tail. If 4 meta bits of head block can't store extent payload size, we will borrow tail block meta bits to store payload size. Max allowd extent size is 128k, so we don't compress/decompress too big size data. Meta: Modifying data will modify meta too. Meta will be written(flush) to disk depending on meta write policy. We support writeback and writethrough mode. In writeback mode, meta will be written to disk in an interval or a FLUSH request. In writethrough mode, data and meta data will be written to disk together. Advantages: 1. Simple. Since we store compressed data in-place, we don't need complicated disk data management. 2. Efficient. For each 4k, we only need 5 bits meta. 1T data will use less than 200M meta, so we can load all meta into memory. And actual compression size is in payload. So if IO doesn't need RMW and we use writeback meta flush, we don't need extra IO for meta. Disadvantages: 1. hole. Since we store compressed data in-place, there are a lot of holes (in above example, B+3 - B+7) Hole can impact IO, because we can't do IO merge. 2. 1:1 size. Compression doesn't change disk size. If disk is 1T, we can only store 1T data even we do compression. But this is for SSD only. Generally SSD firmware has a FTL layer to map disk sectors to flash nand. High end SSD firmware has filesystem-like FTL. 1. hole. Disk has a lot of holes, but SSD FTL can still store data continuous in nand. Even if we can't do IO merge in OS layer, SSD firmware can do it. 2. 1:1 size. On one side, we write compressed data to SSD, which means less data is written to SSD. This will be very helpful to improve SSD garbage collection, and so write speed and life cycle. So even this is a problem, the target is still helpful. On the other side, advanced SSD FTL can easily do thin provision. For example, if nand is 1T and we let SSD report it as 2T, and use the SSD as compressed target. In such SSD, we don't have the 1:1 size issue. So even if SSD FTL cannot map non-continuous disk sectors to continuous nand, the compression target can still function well. Signed-off-by: Shaohua Li Signed-off-by: Ram Pai --- drivers/md/Kconfig |6 + drivers/md/Makefile |1 + drivers/md/dm-inplace-compress.c | 1487 ++ drivers/md/dm-inplace-compress.h | 140 4 files changed, 1634 insertions(+), 0 deletions(-) create mode 100644 drivers/md/dm-inplace-compress.c create mode 100644 drivers/md/dm-inplace-compress.h diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 02a5345..cdb1984 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -343,6 +343,12 @@ config DM_MIRROR Allow volume managers to mirror logical volumes, also needed for live data migration tools such as 'pvmove'. +config DM_INPLACE_COMPRESS + tristate "Inplace Compression target" + depends on BLK_DEV_DM + ---help--- + Allow volume managers to compress data for SSD. + config DM_LOG_USERSPACE tristate "Mirror userspace logging" depends on DM_MIRROR && NET diff --git a/drivers/md/Makefile b/drivers/md/Makefile index
[RFC PATCH 07/16] DM: Optimize memory allocated to hold compressed buffer.
On an average the compressed size is less than 50% of the original buffer. Use this knowledge to optimize the amount of space allocated to hold the compressed buffer. If the allocated size is determined to be insufficient than reallocate the required size. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c | 39 ++ drivers/md/dm-inplace-compress.h | 11 ++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index 5c39169..fe4a4c1 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -19,10 +19,12 @@ static struct dm_icomp_compressor_data compressors[] = { [DMCP_COMP_ALG_LZO] = { .name = "lzo", .comp_len = lzo_comp_len, + .max_comp_len = lzo_max_comp_len, }, [DMCP_COMP_ALG_842] = { .name = "842", .comp_len = nx842_comp_len, + .max_comp_len = nx842_max_comp_len, }, }; static int default_compressor = -1; @@ -848,6 +850,14 @@ static inline int dm_icomp_compressor_len(struct dm_icomp_info *info, int len) return len; } +static inline int dm_icomp_compressor_maxlen(struct dm_icomp_info *info, + int len) +{ + if (compressors[info->comp_alg].max_comp_len) + return compressors[info->comp_alg].max_comp_len(len); + return len; +} + /* * caller should set region.sector, region.count. bi_rw. IO always to/from * comp_data @@ -919,6 +929,25 @@ static void dm_icomp_bio_copy(struct bio *bio, off_t bio_off, void *buf, } } +static int dm_icomp_mod_to_max_io_range(struct dm_icomp_info *info, +struct dm_icomp_io_range *io) +{ + unsigned int maxlen = dm_icomp_compressor_maxlen(info, io->decomp_len); + + if (maxlen <= io->comp_len) + return -ENOSPC; + io->io_req.mem.ptr.addr = io->comp_data = + dm_icomp_krealloc(io->comp_data, maxlen, + io->comp_len, GFP_NOIO); + if (!io->comp_data) { + DMWARN("UNFORTUNE allocation failure "); + io->comp_len = 0; + return -ENOSPC; + } + io->comp_len = maxlen; + return 0; +} + /* * return value: * < 0 : error @@ -940,7 +969,17 @@ static int dm_icomp_io_range_compress(struct dm_icomp_info *info, ret = crypto_comp_compress(tfm, decomp_data, decomp_len, io->comp_data, _comp_len); + if (ret || actual_comp_len > io->comp_len) { + ret = dm_icomp_mod_to_max_io_range(info, io); + if (!ret) { + actual_comp_len = io->comp_len; + ret = crypto_comp_compress(tfm, decomp_data, decomp_len, + io->comp_data, _comp_len); + } + } + put_cpu(); + if (ret < 0) DMWARN("CO Error %d ", ret); diff --git a/drivers/md/dm-inplace-compress.h b/drivers/md/dm-inplace-compress.h index b61ff0d..86c0ce6 100644 --- a/drivers/md/dm-inplace-compress.h +++ b/drivers/md/dm-inplace-compress.h @@ -17,15 +17,26 @@ struct dm_icomp_super_block { struct dm_icomp_compressor_data { char *name; int (*comp_len)(int comp_len); + int (*max_comp_len)(int comp_len); }; static inline int lzo_comp_len(int comp_len) { + return lzo1x_worst_compress(comp_len) >> 1; +} + +static inline int lzo_max_comp_len(int comp_len) +{ return lzo1x_worst_compress(comp_len); } static inline int nx842_comp_len(int comp_len) { + return (comp_len>>4)*7; /* less than half: 7/16 */ +} + +static inline int nx842_max_comp_len(int comp_len) +{ return comp_len; } -- 1.7.1
[RFC PATCH 10/16] DM: Try to use the bio buffer for decompression instead of allocating one.
The read path allocates a temporary buffer to hold decompressed data, which is than copied into the caller's bio buffer. Instead of allocating a temporary buffer to hold the decompressed data, decompress the data in the caller's bio buffer. This can be done only if the destination in the bio-buffer is contigious within the same bio-segment. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c | 143 ++--- drivers/md/dm-inplace-compress.h |2 + 2 files changed, 102 insertions(+), 43 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index c56d9b7..f6b95e3 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -792,11 +792,34 @@ static void dm_icomp_kfree(void *addr, unsigned int size) kfree(addr); } +static void dm_icomp_release_decomp_buffer(struct dm_icomp_io_range *io) +{ + if (!io->decomp_data) + return; -static void dm_icomp_free_io_range(struct dm_icomp_io_range *io) + if (io->decomp_kmap) + kunmap(io->decomp_real_data); + else + dm_icomp_kfree(io->decomp_real_data, io->decomp_req_len); + io->decomp_data = io->decomp_real_data = NULL; + io->decomp_len = 0; + io->decomp_kmap = false; +} + +static void dm_icomp_release_comp_buffer(struct dm_icomp_io_range *io) { - dm_icomp_kfree(io->decomp_data, io->decomp_len); + if (!io->comp_data) + return; dm_icomp_kfree(io->comp_data, io->comp_len); + + io->comp_data = NULL; + io->comp_len = 0; +} + +static void dm_icomp_free_io_range(struct dm_icomp_io_range *io) +{ + dm_icomp_release_decomp_buffer(io); + dm_icomp_release_comp_buffer(io); kmem_cache_free(dm_icomp_io_range_cachep, io); } @@ -890,7 +913,9 @@ static struct dm_icomp_io_range *dm_icomp_create_io_range( io->req = req; io->decomp_data = NULL; + io->decomp_real_data = NULL; io->decomp_len = 0; + io->decomp_kmap = false; io->decomp_req_len = 0; return io; } @@ -909,15 +934,43 @@ static struct dm_icomp_io_range *dm_icomp_create_io_read_range( return io; } -static int dm_icomp_update_io_read_range(struct dm_icomp_io_range *io) +static int dm_icomp_update_io_read_range(struct dm_icomp_io_range *io, + struct bio *bio, ssize_t bio_off) { + struct bvec_iter iter; + struct bio_vec bv; + bool just_use = false; + if (io->decomp_len) return 0; + /* use a bio buffer long enough to hold the uncompressed data */ + bio_for_each_segment(bv, bio, iter) { + int avail_len; + int length = bv.bv_len; + + if (!just_use && bio_off >= length) { + bio_off -= length; + continue; + } + avail_len = just_use ? length : length-bio_off; + if (avail_len >= io->decomp_req_len) { + io->decomp_real_data = kmap(bv.bv_page); + io->decomp_data = io->decomp_real_data + bio_off; + io->decomp_len = io->decomp_req_len = avail_len; + io->decomp_kmap = true; + return 0; + } + just_use = true; + } + + /* none available. :( Allocate one */ io->decomp_data = dm_icomp_kmalloc(io->decomp_req_len, GFP_NOIO); if (!io->decomp_data) return 1; + io->decomp_real_data = io->decomp_data; io->decomp_len = io->decomp_req_len; + io->decomp_kmap = false; return 0; } @@ -978,24 +1031,34 @@ static struct dm_icomp_io_range *dm_icomp_create_io_write_range( struct dm_icomp_req *req) { struct dm_icomp_io_range *io; + struct bio *bio = req->bio; sector_t size = bio_sectors(req->bio)<<9; + int segments = bio_segments(bio); int comp_len = dm_icomp_compressor_len(req->info, size); void *addr; - addr = dm_icomp_kmalloc(size, GFP_NOIO); + if (segments == 1) { + struct bio_vec bv = bio_iovec(bio); + + addr = kmap(bv.bv_page); + } else + addr = dm_icomp_kmalloc(size, GFP_NOIO); + if (!addr) return NULL; io = dm_icomp_create_io_range(req, comp_len); if (!io) { - dm_icomp_kfree(addr, size); + (segments == 1) ? kunmap(addr) : dm_icomp_kfree(addr, size); return NULL; } - io->decomp_data = addr; + io->decomp_data = io->decomp_real_data = addr; io->decomp_len = size; - dm_icomp_bio_copy(req->bio, 0, io->decomp_data, size, true); + io->decomp_kmap = (segments == 1); + if (!io->decomp_kmap) + dm_icomp_bio_copy(req->bio, 0, io->decomp_data,
[RFC PATCH 03/16] DM: Error if enough space is not available.
if enough space is not available to create a block of the specified size error out. Signed-off-by: Ram Pai--- drivers/md/dm-inplace-compress.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-inplace-compress.c b/drivers/md/dm-inplace-compress.c index 70d6c0e..17221a1 100644 --- a/drivers/md/dm-inplace-compress.c +++ b/drivers/md/dm-inplace-compress.c @@ -453,6 +453,12 @@ static int dm_icomp_read_or_create_super(struct dm_icomp_info *info) info->data_blocks = data_blocks; info->data_start = (1 + meta_blocks) << DMCP_BLOCK_SECTOR_SHIFT; + if ((data_blocks << DMCP_BLOCK_SECTOR_SHIFT) < info->ti->len) { + info->ti->error = + "Insufficient sectors to satisfy requested size"; + return -ENOMEM; + } + addr = kzalloc(DMCP_BLOCK_SIZE, GFP_KERNEL); if (!addr) { info->ti->error = "Cannot allocate super"; -- 1.7.1
Re: [PATCH v3 1/4] iio: adc: rockchip_saradc: reset saradc controller before programming it
On 27/07/16 15:24, Caesar Wang wrote: > SARADC controller needs to be reset before programming it, otherwise > it will not function properly. > > Signed-off-by: Caesar Wang> Cc: Jonathan Cameron > Cc: Heiko Stuebner > Cc: Rob Herring > Cc: linux-...@vger.kernel.org > Cc: linux-rockc...@lists.infradead.org > Tested-by: Guenter Roeck > Hi Patch is fine (I'll fix up the wording issue) however... I'm not clear on the severity of the issue. Is this something we should be pushing for stable? Jonathan > --- > > Changes in v3: > - %s/devm_reset_control_get_optional()/devm_reset_control_get() > - add Guente's test tag. > > Changes in v2: > - Make the reset as an optional property, since it should work > with old devicetrees as well. > > .../bindings/iio/adc/rockchip-saradc.txt | 7 + > drivers/iio/adc/Kconfig| 1 + > drivers/iio/adc/rockchip_saradc.c | 30 > ++ > 3 files changed, 38 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt > b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt > index bf99e2f..205593f 100644 > --- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt > +++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt > @@ -16,6 +16,11 @@ Required properties: > - vref-supply: The regulator supply ADC reference voltage. > - #io-channel-cells: Should be 1, see ../iio-bindings.txt > > +Optional properties: > +- resets: Must contain an entry for each entry in reset-names if need support > + this option. See ../reset/reset.txt for details. > +- reset-names: Must include the name "saradc-apb". > + > Example: > saradc: saradc@2006c000 { > compatible = "rockchip,saradc"; > @@ -23,6 +28,8 @@ Example: > interrupts = ; > clocks = < SCLK_SARADC>, < PCLK_SARADC>; > clock-names = "saradc", "apb_pclk"; > + resets = < SRST_SARADC>; > + reset-names = "saradc-apb"; > #io-channel-cells = <1>; > vref-supply = <>; > }; > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 1de31bd..7675772 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -389,6 +389,7 @@ config QCOM_SPMI_VADC > config ROCKCHIP_SARADC > tristate "Rockchip SARADC driver" > depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) > + depends on RESET_CONTROLLER > help > Say yes here to build support for the SARADC found in SoCs from > Rockchip. > diff --git a/drivers/iio/adc/rockchip_saradc.c > b/drivers/iio/adc/rockchip_saradc.c > index f9ad6c2..85d7012 100644 > --- a/drivers/iio/adc/rockchip_saradc.c > +++ b/drivers/iio/adc/rockchip_saradc.c > @@ -21,6 +21,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > @@ -53,6 +55,7 @@ struct rockchip_saradc { > struct clk *clk; > struct completion completion; > struct regulator*vref; > + struct reset_control*reset; > const struct rockchip_saradc_data *data; > u16 last_val; > }; > @@ -190,6 +193,16 @@ static const struct of_device_id rockchip_saradc_match[] > = { > }; > MODULE_DEVICE_TABLE(of, rockchip_saradc_match); > > +/** > + * Reset SARADC Controller. > + */ > +static void rockchip_saradc_reset_controller(struct reset_control *reset) > +{ > + reset_control_assert(reset); > + usleep_range(10, 20); > + reset_control_deassert(reset); > +} > + > static int rockchip_saradc_probe(struct platform_device *pdev) > { > struct rockchip_saradc *info = NULL; > @@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device > *pdev) > if (IS_ERR(info->regs)) > return PTR_ERR(info->regs); > > + /* > + * The reset should be an optional property, as it should work > + * with old devicetrees as well > + */ > + info->reset = devm_reset_control_get(>dev, "saradc-apb"); > + if (IS_ERR(info->reset)) { > + ret = PTR_ERR(info->reset); > + if (ret != -ENOENT) > + return ret; > + > + dev_dbg(>dev, "no reset control found\n"); > + info->reset = NULL; > + } > + > init_completion(>completion); > > irq = platform_get_irq(pdev, 0); > @@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device > *pdev) > return PTR_ERR(info->vref); > } > > + if (info->reset) > + rockchip_saradc_reset_controller(info->reset); > + > /* >* Use a default value for the converter clock. >* This may become user-configurable in the future. >
RE: [PATCH v2 1/4] net: ethernet: ti: davinci_cpdma: split descs num between all channels
> Currently the tx channels share same pool of descriptors. Thus one channel can > block another if pool is emptied by one. But, the shaper should decide which > channel is allowed to send packets. To avoid such impact of one channel on > another, let every channel to have its own peace of pool. Piece. > +/** > + * cpdma_chan_split_pool - Splits ctrl pool between all channels. > + * Has to be called under ctlr lock > + * > + */ No need for the extra empty comment line. > + /* calculate average size of pool slice */ > + ch_desc_num = pool->num_desc / ctlr->chan_num; > + > + /* split ctlr pool */ > + for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) { > + chan = ctlr->channels[i]; > + if (chan) > + chan->desc_num = ch_desc_num; Is this 'if' needed? If there's some route where the channel can be NULL, You're splitting the value incorrectly.
Re: [PATCH 00/23] Remove deprecated create_workqueue instances
Please ignore this mail. Bhaktipriya On Mon, Aug 15, 2016 at 11:23 PM, Bhaktipriya Shridharwrote: > This patch set removes the instances of deprecated > create_singlethread_workqueue (scheduled for removal) in drivers/infiniband > by making the appropriate conversions. > > Bhaktipriya Shridhar (23): > drm/ttm: Remove deprecated create_singlethread_workqueue > IB/sa : Remove deprecated create_singlethread_workqueue > IB/mad: Remove deprecated create_singlethread_workqueue > IB/multicast: Remove deprecated create_singlethread_workqueue > IB/ucma: Remove deprecated create_singlethread_workqueue > IB/cma: Remove deprecated create_singlethread_workqueue > IB/addr: Remove deprecated create_singlethread_workqueue > IB/iwcm: Remove deprecated create_singlethread_workqueue > iw_cxgb3: Remove deprecated create_singlethread_workqueue > IB/qib: Remove deprecated create_singlethread_workqueue > iw_cxgb4: Remove deprecated create_singlethread_workqueue > IB/mthca: Remove deprecated create_singlethread_workqueue > i40iw_main: Remove deprecated create_singlethread_workqueue > i40iw_cm: Remove deprecated create_singlethread_workqueue > IB/mlx5: Remove deprecated create_singlethread_workqueue > IB/mlx5/odp: Remove deprecated create_singlethread_workqueue > IB/mlx4: Remove deprecated create_singlethread_workqueue > IB/mlx4/mad: Remove deprecated create_singlethread_workqueue > IB/mlx4/mcg: Remove deprecated create_singlethread_workqueue > IB/nes: Remove deprecated create_singlethread_workqueue > IB/ipoib: Remove deprecated create_singlethread_workqueue > IB/ipoib_verbs: Remove deprecated create_singlethread_workqueue > IB/mlx4/alias_GUID: Remove deprecated create_singlethread_workqueue > > drivers/gpu/drm/ttm/ttm_memory.c | 7 ++- > drivers/infiniband/core/addr.c | 2 +- > drivers/infiniband/core/cma.c | 2 +- > drivers/infiniband/core/iwcm.c | 2 +- > drivers/infiniband/core/mad.c | 2 +- > drivers/infiniband/core/multicast.c| 2 +- > drivers/infiniband/core/sa_query.c | 2 +- > drivers/infiniband/core/ucma.c | 3 ++- > drivers/infiniband/hw/cxgb3/iwch_cm.c | 2 +- > drivers/infiniband/hw/cxgb4/cm.c | 2 +- > drivers/infiniband/hw/i40iw/i40iw_cm.c | 7 +-- > drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +- > drivers/infiniband/hw/mlx4/alias_GUID.c| 2 +- > drivers/infiniband/hw/mlx4/mad.c | 4 ++-- > drivers/infiniband/hw/mlx4/main.c | 2 +- > drivers/infiniband/hw/mlx4/mcg.c | 4 ++-- > drivers/infiniband/hw/mlx5/mr.c| 2 +- > drivers/infiniband/hw/mlx5/odp.c | 4 ++-- > drivers/infiniband/hw/mthca/mthca_catas.c | 2 +- > drivers/infiniband/hw/nes/nes_cm.c | 4 ++-- > drivers/infiniband/hw/qib/qib_init.c | 4 ++-- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 ++- > drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +- > 23 files changed, 35 insertions(+), 33 deletions(-) > > -- > 2.1.4 >
Re: [PATCHv2 3/4] pci: Determine actual VPD size on first access
Benjamin Herrenschmidtwrote: We may want some kind of "strict" vs. "relaxed" model here to differenciate the desktop user wanting to give a function to his/her windows partition and doesn't care about strict isolation vs. the cloud data center. I don't think desktop users appreciate hangs any more than anyone else, and that is one of the symptoms that can arise here without the vfio coordination. -- Mark Rustad, Networking Division, Intel Corporation signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [V4 PATCH 2/2] mips/panic: Replace smp_send_stop() with kdump friendly version in panic path
On 08/15/2016 12:06 PM, Corey Minyard wrote: On 08/15/2016 06:35 AM, 河合英宏 / KAWAI,HIDEHIRO wrote: Hi Corey, From: Corey Minyard [mailto:cminy...@mvista.com] Sent: Friday, August 12, 2016 10:56 PM I'll try to test this, but I have one comment inline... Thank you very much! On 08/11/2016 10:17 PM, Dave Young wrote: On 08/10/16 at 05:09pm, Hidehiro Kawai wrote: [snip] diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c index 610f0f3..1723b17 100644 --- a/arch/mips/kernel/crash.c +++ b/arch/mips/kernel/crash.c @@ -47,9 +47,14 @@ static void crash_shutdown_secondary(void *passed_regs) static void crash_kexec_prepare_cpus(void) { +static int cpus_stopped; unsigned int msecs; +unsigned int ncpus; -unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ +if (cpus_stopped) +return; Wouldn't you want an atomic operation and some special handling here to ensure that only one CPU does this? So if a CPU comes in here and another CPU is already in the process stopping the CPUs it won't result in a deadlock. Because this function can be called only one panicking CPU, there is no problem. There are two paths which crash_kexec_prepare_cpus is called. Path 1 (panic path): panic() crash_smp_send_stop() crash_kexec_prepare_cpus() Path 2 (oops path): crash_kexec() __crash_kexec() machine_crash_shutdown() default_machine_crash_shutdown() // for MIPS crash_kexec_prepare_cpus() Here, panic() and crash_kexec() run exclusively via panic_cpu atomic variable. So we can use cpus_stopped as normal variable. Ok, if the code can only be entered once, what's the purpose of cpus_stopped? I guess that's what confused me. You are right, the panic_cpu atomic should keep this on a single CPU. Never mind, I see the path through panic() where that is required. My question below still remains, though. -corey Also, panic() will call panic_smp_self_stop() if it finds another CPU has already called panic, which will just spin with interrupts off by default. I didn't see a definition for it in MIPS, wouldn't it need to be overridden to avoid a deadlock? -corey Best regards, Hidehiro Kawai
[PATCH 06/22] IB/addr: Remove deprecated create_singlethread_workqueue
The workqueue "addr_wq" queues a single work item and hence doesn't require ordering. Also, it is being used on a memory reclaim path. Hence, it has been converted to use alloc_workqueue with WQ_MEM_RECLAIM set. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/core/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 1374541..b136d3a 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -800,7 +800,7 @@ static struct notifier_block nb = { int addr_init(void) { - addr_wq = create_singlethread_workqueue("ib_addr"); + addr_wq = alloc_workqueue("ib_addr", WQ_MEM_RECLAIM, 0); if (!addr_wq) return -ENOMEM; -- 2.1.4
[PATCH 09/22] IB/qib: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "qib" queues work item >s_work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/qib/qib_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index f253111..1730aa8 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c @@ -614,8 +614,8 @@ static int qib_create_workqueues(struct qib_devdata *dd) snprintf(wq_name, sizeof(wq_name), "qib%d_%d", dd->unit, pidx); - ppd->qib_wq = - create_singlethread_workqueue(wq_name); + ppd->qib_wq = alloc_ordered_workqueue(wq_name, + WQ_MEM_RECLAIM); if (!ppd->qib_wq) goto wq_error; } -- 2.1.4
[PATCH 16/22] IB/mlx4: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "wq" queues work items [i]->work, >work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/mlx4/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 42a4607..f3876b79 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -3023,7 +3023,7 @@ static int __init mlx4_ib_init(void) { int err; - wq = create_singlethread_workqueue("mlx4_ib"); + wq = alloc_ordered_workqueue("mlx4_ib", WQ_MEM_RECLAIM); if (!wq) return -ENOMEM; -- 2.1.4
Re: [PATCH] block: Fix secure erase
> --- a/block/elevator.c > +++ b/block/elevator.c > @@ -366,7 +366,10 @@ void elv_dispatch_sort(struct request_queue *q, struct > request *rq) > list_for_each_prev(entry, >queue_head) { > struct request *pos = list_entry_rq(entry); > > - if ((req_op(rq) == REQ_OP_DISCARD) != (req_op(pos) == > REQ_OP_DISCARD)) > + if ((req_op(rq) == REQ_OP_DISCARD || > + req_op(rq) == REQ_OP_SECURE_ERASE) != > + (req_op(pos) == REQ_OP_DISCARD || > + req_op(pos) == REQ_OP_SECURE_ERASE)) > break; This really should be a: if (req_op(rq) != req_op(pos)) I'l lleave it up to Jens if he wants that in this patch or not, otherwise I'll send an incremental patch. Otherwise this looks fine: Reviewed-by: Christoph Hellwig
[PATCH 17/22] IB/mlx4/mad: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "wq" queues work item >work and the workqueue "ud_wq" queues work item [i]->work. Both the workqueues have been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/mlx4/mad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 9c2e53d..35b1260 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -2070,7 +2070,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, } snprintf(name, sizeof name, "mlx4_ibt%d", port); - ctx->wq = create_singlethread_workqueue(name); + ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!ctx->wq) { pr_err("Failed to create tunnelling WQ for port %d\n", port); ret = -ENOMEM; @@ -2078,7 +2078,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, } snprintf(name, sizeof name, "mlx4_ibud%d", port); - ctx->ud_wq = create_singlethread_workqueue(name); + ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!ctx->ud_wq) { pr_err("Failed to create up/down WQ for port %d\n", port); ret = -ENOMEM; -- 2.1.4
[PATCH 19/22] IB/nes: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() replaces deprecated create_singlethread_workqueue(). The workqueue "event_wq" queues work item >event_work and the workqueue "disconn_wq" queues work item work (maps to g_cm_core->disconn_wq). WQ_MEM_RECLAIM has not been set since the workqueues are not being used on a memory reclaim path. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/nes/nes_cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 7f0aa23..57db9b3 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c @@ -2692,12 +2692,12 @@ static struct nes_cm_core *nes_cm_alloc_core(void) nes_debug(NES_DBG_CM, "Init CM Core completed -- cm_core=%p\n", cm_core); nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n"); - cm_core->event_wq = create_singlethread_workqueue("nesewq"); + cm_core->event_wq = alloc_ordered_workqueue("nesewq", 0); if (!cm_core->event_wq) goto out_free_cmcore; cm_core->post_event = nes_cm_post_event; nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n"); - cm_core->disconn_wq = create_singlethread_workqueue("nesdwq"); + cm_core->disconn_wq = alloc_ordered_workqueue("nesdwq", 0); if (!cm_core->disconn_wq) goto out_free_wq; -- 2.1.4
Re: [PATCH] block: Fix secure erase
On Mon, Aug 15, 2016 at 11:43:12AM -0500, Shaun Tancheff wrote: > Hmm ... Since REQ_SECURE implied REQ_DISCARD doesn't this > mean that we should include REQ_OP_SECURE_ERASE checking > wherever REQ_OP_DISCARD is being checked now in drivers/scsi/sd.c ? > > (It's only in 3 spots so it's a quickie patch) SCSI doesn't support secure erase operations. Only MMC really supports it, plus the usual cargo culting in Xen blkfront that's probably never been tested..
[PATCH] Documentation/x86_64: Fix a thread stack size
current information about THREAD_SIZE value is obsoleted. This patch fixes this. Signed-off-by: Alexander Kuleshov--- Documentation/x86/kernel-stacks | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/x86/kernel-stacks b/Documentation/x86/kernel-stacks index 9a0aa4d..f4b4197 100644 --- a/Documentation/x86/kernel-stacks +++ b/Documentation/x86/kernel-stacks @@ -6,7 +6,8 @@ Most of the text from Keith Owens, hacked by AK x86_64 page size (PAGE_SIZE) is 4K. Like all other architectures, x86_64 has a kernel stack for every -active thread. These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big. +active thread. These thread stacks are THREAD_SIZE (PAGE_SIZE << 2) +or (PAGE_SIZE << 3) if the CONFIG_KASAN is enabled. These stacks contain useful data as long as a thread is alive or a zombie. While the thread is in user space the kernel stack is empty except for the thread_info structure at the bottom. -- 2.8.0.rc3.1353.gea9bdc0
Re: [PATCH] Map in physical addresses in efi_map_region_fixed
On Mon, Aug 15, 2016 at 05:07:09PM +0200, Borislav Petkov wrote: > On Mon, Aug 15, 2016 at 01:42:58PM +0100, Matt Fleming wrote: > > (Cc'ing Boris and Dave) > > > > On Fri, 05 Aug, at 06:59:35PM, Alex Thorlton wrote: > > > This is a simple change to add in the physical mappings as well as the > > > virtual mappings in efi_map_region_fixed. The motivation here is to > > > get access to EFI runtime code that is only available via the 1:1 > > > mappings on a kexec'd kernel. > > So I don't understand: the whole jumping through hoops so that we have > stable virtual mappings just so that the kexec-ed kernel can call EFI > runtime, is now useless?! Well, anyone who is using the mappings in -4G down range still needs your code to map their stuff into the appropriate spot in the kexec'd kernel, so anybody who is doing things in the most up-to-date manner still makes use of your new code, right? AFAIK, we pass up the efi_runtime_map to the kexec'd kernel, and then process the memory descriptors one by one, mapping in their virtual addresses during kexec_enter_virtual_mode. All of this relies on your efforts to pass up the virtual mappings. The only thing we're adding here is the physical mappings, to match what is availble in the primary kernel. > What if the physical address is occupied by the kexec kernel? Ah, that's a good question. I usually don't force the placement of my crashkernel, so I can't exactly comment intelligently on what will happen in that situation. I will look into this, but in our case, I believe that the primary kernel would either fail to boot, or fail to load the kexec kernel if we placed it over the range where are EFI code gets mapped in, which I think is an issue even without this patch. IIRC, the crashkernel memory gets reserved really early, so I'd imagine we'd hit the former problem, since we will try to remap into that same space in uv_bios_init. This is sort of a hand-wavey answer - I will investigate the his further to make sure that I'm not making any stupid assumptions (there's a good chance that I am :) > Why do you guys need the physical mapping all of a sudden? It's not that we need it all of the sudden, necessarily, it's just that we've had to make other changes to make things work with the new, (almost) completely isolated, EFI page tables. We ended up choosing the lesser of two evils, and have decided to temporarily rely on the physical address of our runtime code, instead of continuing to rely on EFI_OLD_MEMMAP. I guess what I'm saying is, if we hadn't been relying on some semi-undefined behavior in the EFI memory mapping scheme, we would've been relying on the physical address for quite a while, since nobody would have been mapping in the virtual address for us. It's important to note that we've been dancing back and forth between workarounds for some slightly inorrect assumptions, and some actual bug fixes. We're working to get everything 100% compatible with the new memory mapping schemes, but there're a few pieces of the puzzle we haven't gotten around to yet. > Your patch is basically rendering all the effort moot and we could've > saved ourselves all that trouble of doing all that virtual address > mapping and done the 1:1 thing. > > Which really is probably simpler since we have an EFI-specific page > table and running EFI in the kexec-ed kernel would mean basically > recreating it. > > What am I missing? I don't think it renders all of your effort worthless. It just allows those who haven't had a chance to completely update their code to work with the new mapping schemes a way to utilize EFI runtime callbacks, in a kexec'd kernel. I do understand that, in a perfect world, we would be able to just hop right in and use your memory mapping scheme. At the same time, I don't see how this is that much different from what we already do in the primary, non-kexec'd kernel. If there are strong objections to this change, I won't pursue it further. We will be able to achieve the same effect once we've had a chance to update our code to register a callback with SetVirtualAddressMap to fix up our function pointer. This is on my upcoming to-do list, but it'll be a little bit before I have a chance to get it finished. Thanks for the input, Boris! - Alex
[PATCH v4 07/13] media: platform: pxa_camera: make printk consistent
Make all print consistent by always using : - dev_xxx(pcdev_to_dev(pcdev), ) This prepares the soc_camera adherence removal by making these call rely on only pcdev, and not the soc_camera icd structure. Signed-off-by: Robert Jarzmik--- drivers/media/platform/soc_camera/pxa_camera.c | 70 -- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 171e3c57615c..f3922a99405b 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -236,6 +236,14 @@ struct pxa_cam { static const char *pxa_cam_driver_description = "PXA_Camera"; +static struct pxa_camera_dev *icd_to_pcdev(struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + struct pxa_camera_dev *pcdev = ici->priv; + + return pcdev; +} + /* * Videobuf operations */ @@ -465,7 +473,6 @@ static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev, static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, enum pxa_camera_active_dma act_dma) { - struct device *dev = pcdev_to_dev(pcdev); struct pxa_buffer *buf, *last_buf; unsigned long flags; u32 camera_status, overrun; @@ -476,7 +483,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, spin_lock_irqsave(>lock, flags); camera_status = __raw_readl(pcdev->base + CISR); - dev_dbg(dev, "camera dma irq, cisr=0x%x dma=%d\n", + dev_dbg(pcdev_to_dev(pcdev), "camera dma irq, cisr=0x%x dma=%d\n", camera_status, act_dma); overrun = CISR_IFO_0; if (pcdev->channels == 3) @@ -522,7 +529,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, NULL, _issued); if (camera_status & overrun && last_status != DMA_COMPLETE) { - dev_dbg(dev, "FIFO overrun! CISR: %x\n", + dev_dbg(pcdev_to_dev(pcdev), "FIFO overrun! CISR: %x\n", camera_status); pxa_camera_stop_capture(pcdev); list_for_each_entry(buf, >capture, queue) @@ -545,7 +552,6 @@ static u32 mclk_get_divisor(struct platform_device *pdev, struct pxa_camera_dev *pcdev) { unsigned long mclk = pcdev->mclk; - struct device *dev = >dev; u32 div; unsigned long lcdclk; @@ -555,7 +561,8 @@ static u32 mclk_get_divisor(struct platform_device *pdev, /* mclk <= ciclk / 4 (27.4.2) */ if (mclk > lcdclk / 4) { mclk = lcdclk / 4; - dev_warn(dev, "Limiting master clock to %lu\n", mclk); + dev_warn(pcdev_to_dev(pcdev), +"Limiting master clock to %lu\n", mclk); } /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ @@ -565,7 +572,7 @@ static u32 mclk_get_divisor(struct platform_device *pdev, if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) pcdev->mclk = lcdclk / (2 * (div + 1)); - dev_dbg(dev, "LCD clock %luHz, target freq %luHz, divisor %u\n", + dev_dbg(pcdev_to_dev(pcdev), "LCD clock %luHz, target freq %luHz, divisor %u\n", lcdclk, mclk, div); return div; @@ -662,7 +669,9 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) static int pxa_camera_add_device(struct soc_camera_device *icd) { - dev_info(icd->parent, "PXA Camera driver attached to camera %d\n", + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + + dev_info(pcdev_to_dev(pcdev), "PXA Camera driver attached to camera %d\n", icd->devnum); return 0; @@ -670,7 +679,9 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) static void pxa_camera_remove_device(struct soc_camera_device *icd) { - dev_info(icd->parent, "PXA Camera driver detached from camera %d\n", + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + + dev_info(pcdev_to_dev(pcdev), "PXA Camera driver detached from camera %d\n", icd->devnum); } @@ -1082,7 +1093,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) common_flags = soc_mbus_config_compatible(, bus_flags); if (!common_flags) { - dev_warn(icd->parent, + dev_warn(pcdev_to_dev(pcdev), "Flags incompatible: camera 0x%x, host 0x%lx\n", cfg.flags, bus_flags); return -EINVAL; @@ -1123,7 +1134,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) cfg.flags = common_flags; ret = sensor_call(pcdev,
[PATCH v4 10/13] media: platform: pxa_camera: make a standalone v4l2 device
This patch removes the soc_camera API dependency from pxa_camera. In the current status : - all previously captures are working the same on pxa270 - the s_crop() call was removed, judged not working (see what happens soc_camera_s_crop() when get_crop() == NULL) - if the pixel clock is provided by then sensor, ie. not MCLK, the dual stage change is not handled yet. => there is no in-tree user of this, so I'll let it that way - the MCLK is not yet finished, it's as in the legacy way, ie. activated at video device opening and closed at video device closing. In a subsequence patch pxa_camera_mclk_ops should be used, and platform data MCLK ignored. It will be the sensor's duty to request the clock and enable it, which will end in pxa_camera_mclk_ops. Signed-off-by: Robert Jarzmik--- Since v1: - function namings were cleaned into pxac_XXX_() - function were regrouped in the 3 big categories : - device probing/removal : pxa_camera_*() - videobuf2 : pxac_vb2_*() - v42l file operations : pxac_vidioc_*() - internal driver functions : pxa_camera_*() : to be found a cute pattern for RFC v3 Since v2: - split functions - start_streaming() implemented Since v3: - conflict in void *alloc_ctxt by struct device *alloc_devs change - ctrl_handler for video device added - 2 ioctrl disables removed - disable sensor module removal, it will be loaded forever ... --- drivers/media/platform/soc_camera/Kconfig | 2 +- drivers/media/platform/soc_camera/pxa_camera.c | 752 + include/linux/platform_data/media/camera-pxa.h | 2 + 3 files changed, 517 insertions(+), 239 deletions(-) diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 3f927f96763a..0bf33ccf9a1e 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -19,7 +19,7 @@ config SOC_CAMERA_PLATFORM config VIDEO_PXA27x tristate "PXA27x Quick Capture Interface driver" - depends on VIDEO_DEV && PXA27x && SOC_CAMERA && HAS_DMA + depends on VIDEO_DEV && PXA27x && HAS_DMA select VIDEOBUF2_DMA_SG select SG_SPLIT ---help--- diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index a2fedc9bb71c..395cd398c32b 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -3,6 +3,7 @@ * * Copyright (C) 2006, Sascha Hauer, Pengutronix * Copyright (C) 2008, Guennadi Liakhovetski + * Copyright (C) 2016, Robert Jarzmik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -32,13 +35,16 @@ #include #include +#include +#include #include -#include -#include -#include -#include +#include +#include #include +#include +#include + #include #include @@ -46,6 +52,9 @@ #define PXA_CAM_VERSION "0.0.6" #define PXA_CAM_DRV_NAME "pxa27x-camera" +#define DEFAULT_WIDTH 640 +#define DEFAULT_HEIGHT 480 + /* Camera Interface */ #define CICR0 0x #define CICR1 0x0004 @@ -169,7 +178,25 @@ CICR0_EOFM | CICR0_FOM) #define sensor_call(cam, o, f, args...) \ - v4l2_subdev_call(sd, o, f, ##args) + v4l2_subdev_call(cam->sensor, o, f, ##args) + +/* + * Format handling + */ +/** + * struct soc_camera_format_xlate - match between host and sensor formats + * @code: code of a sensor provided format + * @host_fmt: host format after host translation from code + * + * Host and sensor translation structure. Used in table of host and sensor + * formats matchings in soc_camera_device. A host can override the generic list + * generation by implementing get_formats(), and use it for format checks and + * format setup. + */ +struct soc_camera_format_xlate { + u32 code; + const struct soc_mbus_pixelfmt *host_fmt; +}; /* * Structures @@ -198,7 +225,18 @@ struct pxa_buffer { }; struct pxa_camera_dev { - struct soc_camera_host soc_host; + struct v4l2_device v4l2_dev; + struct video_device vdev; + struct v4l2_async_notifier notifier; + struct vb2_queuevb2_vq; + struct v4l2_subdev *sensor; + struct soc_camera_format_xlate *user_formats; + const struct soc_camera_format_xlate *current_fmt; + struct v4l2_pix_format current_pix; + + struct v4l2_async_subdev asd; + struct v4l2_async_subdev *asds[1]; + /* * PXA27x is only supposed to handle one camera on its Quick Capture * interface. If
[PATCH v4 05/13] media: platform: pxa_camera: trivial move of functions
Move the functions in the file to be regrouped into meaningful blocks : 1. pxa camera core handling functions, manipulating the herdware 2. videobuf2 functions, dealing with video buffers 3. video ioctl (vidioc) related functions 4. driver probing, removal, suspend and resume This patch doesn't modify a single line of code. Signed-off-by: Robert Jarzmik--- Since v3: replace void *alloc_ctxt by struct device *alloc_devs impact --- drivers/media/platform/soc_camera/pxa_camera.c | 475 + 1 file changed, 242 insertions(+), 233 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 5bf97c6b6810..0a9e4bdccece 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -538,239 +538,6 @@ out: spin_unlock_irqrestore(>lock, flags); } -static void pxa_buffer_cleanup(struct pxa_buffer *buf) -{ - int i; - - for (i = 0; i < 3 && buf->descs[i]; i++) { - dmaengine_desc_free(buf->descs[i]); - kfree(buf->sg[i]); - buf->descs[i] = NULL; - buf->sg[i] = NULL; - buf->sg_len[i] = 0; - buf->plane_sizes[i] = 0; - } - buf->nb_planes = 0; -} - -static int pxa_buffer_init(struct pxa_camera_dev *pcdev, - struct pxa_buffer *buf) -{ - struct vb2_buffer *vb = >vbuf.vb2_buf; - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); - int nb_channels = pcdev->channels; - int i, ret = 0; - unsigned long size = vb2_plane_size(vb, 0); - - switch (nb_channels) { - case 1: - buf->plane_sizes[0] = size; - break; - case 3: - buf->plane_sizes[0] = size / 2; - buf->plane_sizes[1] = size / 4; - buf->plane_sizes[2] = size / 4; - break; - default: - return -EINVAL; - }; - buf->nb_planes = nb_channels; - - ret = sg_split(sgt->sgl, sgt->nents, 0, nb_channels, - buf->plane_sizes, buf->sg, buf->sg_len, GFP_KERNEL); - if (ret < 0) { - dev_err(pcdev_to_dev(pcdev), - "sg_split failed: %d\n", ret); - return ret; - } - for (i = 0; i < nb_channels; i++) { - ret = pxa_init_dma_channel(pcdev, buf, i, - buf->sg[i], buf->sg_len[i]); - if (ret) { - pxa_buffer_cleanup(buf); - return ret; - } - } - INIT_LIST_HEAD(>queue); - - return ret; -} - -static void pxac_vb2_cleanup(struct vb2_buffer *vb) -{ - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - - dev_dbg(pcdev_to_dev(pcdev), -"%s(vb=%p)\n", __func__, vb); - pxa_buffer_cleanup(buf); -} - -static void pxac_vb2_queue(struct vb2_buffer *vb) -{ - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - - dev_dbg(pcdev_to_dev(pcdev), -"%s(vb=%p) nb_channels=%d size=%lu active=%p\n", - __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0), - pcdev->active); - - list_add_tail(>queue, >capture); - - pxa_dma_add_tail_buf(pcdev, buf); -} - -/* - * Please check the DMA prepared buffer structure in : - * Documentation/video4linux/pxa_camera.txt - * Please check also in pxa_camera_check_link_miss() to understand why DMA chain - * modification while DMA chain is running will work anyway. - */ -static int pxac_vb2_prepare(struct vb2_buffer *vb) -{ - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); - int ret = 0; - - switch (pcdev->channels) { - case 1: - case 3: - vb2_set_plane_payload(vb, 0, icd->sizeimage); - break; - default: - return -EINVAL; - } - - dev_dbg(pcdev_to_dev(pcdev), -"%s (vb=%p) nb_channels=%d size=%lu\n", - __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0)); - - WARN_ON(!icd->current_fmt); - -#ifdef DEBUG - /* -* This can be useful if you want to see if we actually fill -* the buffer with something -*/ - for (i = 0; i < vb->num_planes; i++) - memset((void *)vb2_plane_vaddr(vb, i), - 0xaa, vb2_get_plane_payload(vb, i)); -#endif - - /* -* I think, in buf_prepare you only have to protect global data, -* the actual buffer is yours -*/ - buf->inwork = 0; -
[PATCH 4/7] dax: rename 'ret' to 'entry' in grab_mapping_entry
No functional change. Everywhere else that we get entries via get_unlocked_mapping_entry(), we save it in 'entry' variables. Just change this to be more descriptive. Signed-off-by: Ross Zwisler--- fs/dax.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 8030f93..fed6a52 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -394,13 +394,13 @@ static void *get_unlocked_mapping_entry(struct address_space *mapping, */ static void *grab_mapping_entry(struct address_space *mapping, pgoff_t index) { - void *ret, **slot; + void *entry, **slot; restart: spin_lock_irq(>tree_lock); - ret = get_unlocked_mapping_entry(mapping, index, ); + entry = get_unlocked_mapping_entry(mapping, index, ); /* No entry for given index? Make sure radix tree is big enough. */ - if (!ret) { + if (!entry) { int err; spin_unlock_irq(>tree_lock); @@ -408,10 +408,10 @@ restart: mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM); if (err) return ERR_PTR(err); - ret = (void *)(RADIX_TREE_EXCEPTIONAL_ENTRY | + entry = (void *)(RADIX_TREE_EXCEPTIONAL_ENTRY | RADIX_DAX_ENTRY_LOCK); spin_lock_irq(>tree_lock); - err = radix_tree_insert(>page_tree, index, ret); + err = radix_tree_insert(>page_tree, index, entry); radix_tree_preload_end(); if (err) { spin_unlock_irq(>tree_lock); @@ -423,11 +423,11 @@ restart: /* Good, we have inserted empty locked entry into the tree. */ mapping->nrexceptional++; spin_unlock_irq(>tree_lock); - return ret; + return entry; } /* Normal page in radix tree? */ - if (!radix_tree_exceptional_entry(ret)) { - struct page *page = ret; + if (!radix_tree_exceptional_entry(entry)) { + struct page *page = entry; get_page(page); spin_unlock_irq(>tree_lock); @@ -440,9 +440,9 @@ restart: } return page; } - ret = lock_slot(mapping, slot); + entry = lock_slot(mapping, slot); spin_unlock_irq(>tree_lock); - return ret; + return entry; } void dax_wake_mapping_entry_waiter(struct address_space *mapping, -- 2.9.0
Re: [PATCH v1 01/14] clk: twl6040: Correct clk_ops
On 05/30, Peter Ujfalusi wrote: > Since the drover only supports prepare callbacks, the use of is_enabled is > not correct, it should be handling is_prepared. > > Signed-off-by: Peter Ujfalusi> --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[PATCH 6/7] dax: re-enable DAX PMD support
DAX PMDs have been disabled since Jan Kara introduced DAX radix tree based locking. This patch allows DAX PMDs to participate in the DAX radix tree based locking scheme so that they can be re-enabled. There are currently three types of DAX 4k entries: 4k zero pages, 4k DAX mappings that have an associated block allocation, and 4k DAX empty entries. The empty entries exist to provide locking for the duration of a given page fault. This patch adds three equivalent 2MiB DAX entries: Huge Zero Page (HZP) entries, PMD DAX entries that have associated block allocations, and 2 MiB DAX empty entries. Unlike the 4k case where we insert a struct page* into the radix tree for 4k zero pages, for HZP we insert a DAX exceptional entry with the new RADIX_DAX_HZP flag set. This is because we use a single 2 MiB zero page in every 2MiB hole mapping, and it doesn't make sense to have that same struct page* with multiple entries in multiple trees. This would cause contention on the single page lock for the one Huge Zero Page, and it would break the page->index and page->mapping associations that are assumed to be valid in many other places in the kernel. One difficult use case is when one thread is trying to use 4k entries in radix tree for a given offset, and another thread is using 2 MiB entries for that same offset. The current code handles this by making the 2 MiB user fall back to 4k entries for most cases. This was done because it is the simplest solution, and because the use of 2MiB pages is already opportunistic. If we were to try to upgrade from 4k pages to 2MiB pages for a given range, we run into the problem of how we lock out 4k page faults for the entire 2MiB range while we clean out the radix tree so we can insert the 2MiB entry. We can solve this problem if we need to, but I think that the cases where both 2MiB entries and 4K entries are being used for the same range will be rare enough and the gain small enough that it probably won't be worth the complexity. Signed-off-by: Ross Zwisler--- fs/dax.c| 206 +++- include/linux/dax.h | 27 ++- mm/filemap.c| 4 +- 3 files changed, 149 insertions(+), 88 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 0f1d053..482e616 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -32,20 +32,6 @@ #include #include -/* - * We use lowest available bit in exceptional entry for locking, other two - * bits to determine entry type. In total 3 special bits. - */ -#define RADIX_DAX_SHIFT(RADIX_TREE_EXCEPTIONAL_SHIFT + 3) -#define RADIX_DAX_PTE (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 1)) -#define RADIX_DAX_PMD (1 << (RADIX_TREE_EXCEPTIONAL_SHIFT + 2)) -#define RADIX_DAX_TYPE_MASK (RADIX_DAX_PTE | RADIX_DAX_PMD) -#define RADIX_DAX_TYPE(entry) ((unsigned long)entry & RADIX_DAX_TYPE_MASK) -#define RADIX_DAX_SECTOR(entry) (((unsigned long)entry >> RADIX_DAX_SHIFT)) -#define RADIX_DAX_ENTRY(sector, pmd) ((void *)((unsigned long)sector << \ - RADIX_DAX_SHIFT | (pmd ? RADIX_DAX_PMD : RADIX_DAX_PTE) | \ - RADIX_TREE_EXCEPTIONAL_ENTRY)) - /* We choose 4096 entries - same as per-zone page wait tables */ #define DAX_WAIT_TABLE_BITS 12 #define DAX_WAIT_TABLE_ENTRIES (1 << DAX_WAIT_TABLE_BITS) @@ -386,15 +372,32 @@ static void *get_unlocked_mapping_entry(struct address_space *mapping, * persistent memory the benefit is doubtful. We can add that later if we can * show it helps. */ -static void *grab_mapping_entry(struct address_space *mapping, pgoff_t index) +static void *grab_mapping_entry(struct address_space *mapping, pgoff_t index, + unsigned long new_type) { + bool pmd_downgrade = false; void *entry, **slot; restart: spin_lock_irq(>tree_lock); entry = get_unlocked_mapping_entry(mapping, index, ); + + if (entry && new_type == RADIX_DAX_PMD) { + if (!radix_tree_exceptional_entry(entry) || + RADIX_DAX_TYPE(entry) == RADIX_DAX_PTE) { + spin_unlock_irq(>tree_lock); + return ERR_PTR(-EEXIST); + } + } else if (entry && new_type == RADIX_DAX_PTE) { + if (radix_tree_exceptional_entry(entry) && + RADIX_DAX_TYPE(entry) == RADIX_DAX_PMD && + (unsigned long)entry & (RADIX_DAX_HZP|RADIX_DAX_EMPTY)) { + pmd_downgrade = true; + } + } + /* No entry for given index? Make sure radix tree is big enough. */ - if (!entry) { + if (!entry || pmd_downgrade) { int err; spin_unlock_irq(>tree_lock); @@ -402,15 +405,27 @@ restart: mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM); if (err) return ERR_PTR(err); - entry = (void *)(RADIX_TREE_EXCEPTIONAL_ENTRY | -
Re: [PATCH v1 03/14] clk: twl6040: Rename the driver and use consistent names in the code
On 05/30, Peter Ujfalusi wrote: > The driver is to provide the functional clock to OMAP4/5 McPDM. The clock > is named as pdmclk in the documentations so change the function names, > structure names and variables to align with this. > At the same time rename the driver from "twl6040-clk" to "twl6040-pdmclk". > This can be done w/o regression since the clock driver is not in use at > the moment, the MFD core driver is not even registering the device for it. > > Signed-off-by: Peter Ujfalusi> --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[PATCH 0/7] re-enable DAX PMD support
DAX PMDs have been disabled since Jan Kara introduced DAX radix tree based locking. This series allows DAX PMDs to participate in the DAX radix tree based locking scheme so that they can be re-enabled. This series restores DAX PMD functionality back to what it was before it was disabled. There is still a known issue between DAX PMDs and hole punch, which I am currently working on and which I plan to address with a separate series. Ross Zwisler (7): ext2: tell DAX the size of allocation holes ext4: tell DAX the size of allocation holes dax: remove buffer_size_valid() dax: rename 'ret' to 'entry' in grab_mapping_entry dax: lock based on slot instead of [mapping, index] dax: re-enable DAX PMD support dax: remove "depends on BROKEN" from FS_DAX_PMD fs/Kconfig | 1 - fs/dax.c| 301 ++-- fs/ext2/inode.c | 6 ++ fs/ext4/inode.c | 3 + include/linux/dax.h | 30 +- mm/filemap.c| 7 +- 6 files changed, 191 insertions(+), 157 deletions(-) -- 2.9.0
[PATCH 3/7] dax: remove buffer_size_valid()
Now that all our supported filesystems (ext2, ext4 and XFS) all properly set bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler--- fs/dax.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 993dc6f..8030f93 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -121,19 +121,6 @@ static bool buffer_written(struct buffer_head *bh) return buffer_mapped(bh) && !buffer_unwritten(bh); } -/* - * When ext4 encounters a hole, it returns without modifying the buffer_head - * which means that we can't trust b_size. To cope with this, we set b_state - * to 0 before calling get_block and, if any bit is set, we know we can trust - * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is - * and would save us time calling get_block repeatedly. - */ -static bool buffer_size_valid(struct buffer_head *bh) -{ - return bh->b_state != 0; -} - - static sector_t to_sector(const struct buffer_head *bh, const struct inode *inode) { @@ -175,8 +162,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, rc = get_block(inode, block, bh, rw == WRITE); if (rc) break; - if (!buffer_size_valid(bh)) - bh->b_size = 1 << blkbits; bh_max = pos - first + bh->b_size; bdev = bh->b_bdev; /* @@ -1010,12 +995,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, bdev = bh.b_bdev; - /* -* If the filesystem isn't willing to tell us the length of a hole, -* just fall back to PTEs. Calling get_block 512 times in a loop -* would be silly. -*/ - if (!buffer_size_valid() || bh.b_size < PMD_SIZE) { + if (bh.b_size < PMD_SIZE) { dax_pmd_dbg(, address, "allocated block too small"); return VM_FAULT_FALLBACK; } -- 2.9.0
[PATCH v2 2/8] dt-bindings: i2c: add support for 'i2c-arb' subnode
This gets rid of the need for a pointless 'reg' property for i2c arbitrators. I.e. this new and more compact style some-arbitrator { i2c-arb { #address-cells = <1>; #size-cells = <0>; some-i2c-device@50 { reg = <0x50>; }; }; }; instead of the old some-arbitrator { #address-cells = <1>; #size-cells = <0>; i2c@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; some-i2c-device@50 { reg = <0x50>; }; }; }; Acked-by: Rob HerringSigned-off-by: Peter Rosin --- .../bindings/i2c/i2c-arb-gpio-challenge.txt| 8 ++--- Documentation/devicetree/bindings/i2c/i2c-arb.txt | 35 ++ MAINTAINERS| 1 + 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-arb.txt diff --git a/Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt b/Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt index 71191ff0e781..248a155414c2 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt @@ -44,8 +44,7 @@ Required properties: - our-claim-gpio: The GPIO that we use to claim the bus. - their-claim-gpios: The GPIOs that the other sides use to claim the bus. Note that some implementations may only support a single other master. -- Standard I2C mux properties. See i2c-mux.txt in this directory. -- Single I2C child bus node at reg 0. See i2c-mux.txt in this directory. +- I2C arbitration bus node. See i2c-arb.txt in this directory. Optional properties: - slew-delay-us: microseconds to wait for a GPIO to go high. Default is 10 us. @@ -63,8 +62,6 @@ Example: i2c-arbitrator { compatible = "i2c-arb-gpio-challenge"; - #address-cells = <1>; - #size-cells = <0>; i2c-parent = <&{/i2c@12CA}>; @@ -74,8 +71,7 @@ Example: wait-retry-us = <3000>; wait-free-us = <5>; - i2c@0 { - reg = <0>; + i2c-arb { #address-cells = <1>; #size-cells = <0>; diff --git a/Documentation/devicetree/bindings/i2c/i2c-arb.txt b/Documentation/devicetree/bindings/i2c/i2c-arb.txt new file mode 100644 index ..59abf9277bdc --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-arb.txt @@ -0,0 +1,35 @@ +Common i2c arbitration bus properties. + +- i2c-arb child node + +Required properties for the i2c-arb child node: +- #address-cells = <1>; +- #size-cells = <0>; + +Optional properties for i2c-arb child node: +- Child nodes conforming to i2c bus binding + + +Example : + + /* + An NXP pca9541 I2C bus master selector at address 0x74 + with a NXP pca8574 GPIO expander attached. +*/ + + arb@74 { + compatible = "nxp,pca9541"; + reg = <0x74>; + + i2c-arb { + #address-cells = <1>; + #size-cells = <0>; + + gpio@38 { + compatible = "nxp,pca8574"; + reg = <0x38>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 20bb1d00098c..1a61e2f5a0a9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5660,6 +5660,7 @@ S:Maintained F: Documentation/i2c/i2c-topology F: Documentation/i2c/muxes/ F: Documentation/devicetree/bindings/i2c/i2c-mux* +F: Documentation/devicetree/bindings/i2c/i2c-arb* F: drivers/i2c/i2c-mux.c F: drivers/i2c/muxes/ F: include/linux/i2c-mux.h -- 2.1.4
[PATCH v2 1/8] dt-bindings: i2c: add support for 'i2c-mux' subnode
Similar to the new optional 'i2c-bus' subnode from Jon Hunter, this adds an optional 'i2c-mux' subnode, for similar reasons. I.e. it is bad of the i2c mux core to assume that any subnode of an i2c mux device is a potential (when the 'reg' property matches) i2c-mux child bus, given that i2c mux devices might do more than mux i2c traffic. So, if an 'i2c-mux' subnode is present, dictate that all i2c-mux child buses exist beneath that subnode. Acked-by: Rob HerringSigned-off-by: Peter Rosin --- Documentation/devicetree/bindings/i2c/i2c-mux.txt | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.txt b/Documentation/devicetree/bindings/i2c/i2c-mux.txt index af84cce5cd7b..212e6779dc5c 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.txt @@ -2,19 +2,32 @@ Common i2c bus multiplexer/switch properties. An i2c bus multiplexer/switch will have several child busses that are numbered uniquely in a device dependent manner. The nodes for an i2c bus -multiplexer/switch will have one child node for each child -bus. +multiplexer/switch will have one child node for each child bus. -Required properties: +Optional properties: +- #address-cells = <1>; + This property is required is the i2c-mux child node does not exist. + +- #size-cells = <0>; + This property is required is the i2c-mux child node does not exist. + +- i2c-mux + For i2c multiplexers/switches that have child nodes that are a mixture + of both i2c child busses and other child nodes, the 'i2c-mux' subnode + can be used for populating the i2c child busses. If an 'i2c-mux' + subnode is present, only subnodes of this will be considered as i2c + child busses. + +Required properties for the i2c-mux child node: - #address-cells = <1>; - #size-cells = <0>; -Required properties for child nodes: +Required properties for i2c child bus nodes: - #address-cells = <1>; - #size-cells = <0>; - reg : The sub-bus number. -Optional properties for child nodes: +Optional properties for i2c child bus nodes: - Other properties specific to the multiplexer/switch hardware. - Child nodes conforming to i2c bus binding -- 2.1.4
[PATCH 2/2] staging: lustre: Remove .. paths from '#include "' uses
Make the include paths a bit easier to find and more compatible to a future move out of the staging tree. Signed-off-by: Joe Perches--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +++--- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 8 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/fail.c | 2 +- drivers/staging/lustre/lnet/libcfs/hash.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c| 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_mem.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c | 4 ++-- drivers/staging/lustre/lnet/libcfs/linux/linux-curproc.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c| 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c | 2 +- drivers/staging/lustre/lnet/libcfs/module.c | 10 +- drivers/staging/lustre/lnet/libcfs/prng.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.h | 2 +- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 4 ++-- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lo.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 4 ++-- drivers/staging/lustre/lnet/lnet/net_fault.c| 4 ++-- drivers/staging/lustre/lnet/lnet/nidstrings.c | 4 ++-- drivers/staging/lustre/lnet/lnet/peer.c | 4 ++-- drivers/staging/lustre/lnet/lnet/router.c | 2 +- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 6 +++--- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 8 drivers/staging/lustre/lnet/selftest/console.c | 4 ++-- drivers/staging/lustre/lnet/selftest/console.h | 8 drivers/staging/lustre/lnet/selftest/rpc.h | 2 +- drivers/staging/lustre/lnet/selftest/selftest.h | 10 +- drivers/staging/lustre/lustre/fid/fid_internal.h| 2 +- drivers/staging/lustre/lustre/fid/fid_lib.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +- drivers/staging/lustre/lustre/fld/fld_internal.h| 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/include/interval_tree.h | 2 +- drivers/staging/lustre/lustre/include/linux/lustre_lite.h | 2 +- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_disk.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_fid.h | 2 +- drivers/staging/lustre/lustre/include/lustre_fld.h | 2 +- drivers/staging/lustre/lustre/include/lustre_handles.h | 2 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 2 +- drivers/staging/lustre/lustre/include/lustre_mds.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 6 +++--- drivers/staging/lustre/lustre/include/obd_cksum.h | 4 ++-- drivers/staging/lustre/lustre/include/obd_support.h | 2 +- drivers/staging/lustre/lustre/ldlm/l_lock.c | 2 +-
Re: [PATCH] USB: core: of: Check device_node before parsing in usb_of_get_child_node()
On Mon, 15 Aug 2016, Greg KH wrote: > On Mon, Aug 15, 2016 at 11:31:10AM -0700, Vaibhav Hiremath wrote: > > In case of HUB devices connected to USB ports, we may not have DT > > node representing it inside USB, and when devices connected to hub > > gets enumerated, call to usb_of_get_child_node() leads to NULL pointer > > dereference. > > Really? That seems messed up. > > > In the usecase we have, where EHCI port is connected to USB HUB > > device, and downward ports of HUB are connected to further USB > > devices. When those devices gets enumerated, in order, > > 1. USB HUB -> > > -> Call to usb_of_get_child_node() is OK, as > > parent->dev.of_node is pointing to host node. > > 2. Devices connected to downward port of USB HUB > > -> Call to usb_of_get_child_node() leads to NULL > > pointer dereference as parent->dev.of_node = NULL, > > as USB HUB DTS node may be empty. > > Why is the hub DTS empty? Shouldn't that be the fix here? It's empty because there's no DT entry for the hub. That's normal; most USB devices aren't represented in DT because they aren't part of the original system -- they are added plugged in later. Or, it's possible that the hub _is_ part of the original system and it was left out of the DT database. Alan Stern
[PATCH] usb: dwc3: gadget: don't rely on jiffies while holding spinlock
__dwc3_gadget_wakeup() is called while holding a spinlock, then depends on jiffies in order to timeout while polling the USB core for a link state update. In the case the wakeup failed, the timeout will never happen and will also cause the cpu to stall until rcu_preempt kicks in. This switches to a "decrement variable and wait" timeout scheme. Signed-off-by: Nicolas Saenz Julienne--- drivers/usb/dwc3/gadget.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 8f8c215..d0c711f 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1433,7 +1433,7 @@ static int dwc3_gadget_get_frame(struct usb_gadget *g) static int __dwc3_gadget_wakeup(struct dwc3 *dwc) { - unsigned long timeout; + int retries; int ret; u32 reg; @@ -1484,14 +1484,16 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) } /* poll until Link State changes to ON */ - timeout = jiffies + msecs_to_jiffies(100); + retries = 2; - while (!time_after(jiffies, timeout)) { + while (retries--) { reg = dwc3_readl(dwc->regs, DWC3_DSTS); /* in HS, means ON */ if (DWC3_DSTS_USBLNKST(reg) == DWC3_LINK_STATE_U0) break; + + udelay(5); } if (DWC3_DSTS_USBLNKST(reg) != DWC3_LINK_STATE_U0) { -- 2.7.4
Re: [PATCH] arm64: Introduce execute-only page access permissions
On Mon, Aug 15, 2016 at 3:47 AM, Catalin Marinaswrote: > On Fri, Aug 12, 2016 at 11:23:03AM -0700, Kees Cook wrote: >> On Thu, Aug 11, 2016 at 10:44 AM, Catalin Marinas >> wrote: >> > The ARMv8 architecture allows execute-only user permissions by clearing >> > the PTE_UXN and PTE_USER bits. However, the kernel running on a CPU >> > implementation without User Access Override (ARMv8.2 onwards) can still >> > access such page, so execute-only page permission does not protect >> > against read(2)/write(2) etc. accesses. Systems requiring such >> > protection must enable features like SECCOMP. >> >> So, UAO CPUs will bypass this protection in userspace if using >> read/write on a memory-mapped file? > > It's the other way around. CPUs prior to ARMv8.2 (when UAO was > introduced) or with the CONFIG_ARM64_UAO disabled can still access > user execute-only memory regions while running in kernel mode via the > copy_*_user, (get|put)_user etc. routines. So a way user can bypass this > protection is by using such address as argument to read/write file > operations. Ah, okay. So exec-only for _userspace_ will always work, but exec-only for _kernel_ will only work on ARMv8.2 with CONFIG_ARM64_UAO? > I don't think mmap() is an issue since such region is already mapped, so > it would require mprotect(). As for the latter, it would most likely be > restricted (probably together with read/write) SECCOMP. > >> I'm just trying to make sure I understand the bypass scenario. And is >> this something that can be fixed? If we add exec-only, I feel like it >> shouldn't have corner case surprises. :) > > I think we need better understanding of the usage scenarios for > exec-only. IIUC (from those who first asked me for this feature), it is > an additional protection on top of ASLR to prevent an untrusted entity > from scanning the memory for ROP/JOP gadgets. An instrumented compiler > would avoid generating the literal pool in the same section as the > executable code, thus allowing the instructions to be mapped as > executable-only. It's not clear to me how such untrusted code ends up > scanning the memory, maybe relying on other pre-existent bugs (buffer > under/overflows). I assume if such code is allowed to do system calls, > all bets are off already. Yeah, the "block gadget scanning" tends to be the largest reason for this. That kind of scanning is usually the result of a wild buffer read of some kind. It's obviously most useful for "unknown" builds, but still has value even for Distro-style kernels since they're updated so regularly that automated attacks must keep an ever-growing mapping of kernels to target. -Kees -- Kees Cook Nexus Security
[ANN] oldworld-deb: Debian Installer boot floppy for OldWorld PowerMacs
Hello, I've just released oldworld-deb - a boot floppy that can boot Debian Installer from the CD on OldWorld PowerMacs, such as Power Macintosh 8200. It's based on miBoot, Linux kernel, kexec-tools, uClibc and a simple init program written in C. You can get the source and also a pre-built image here: https://github.com/ondrej-zary/oldworld-deb -- Ondrej Zary
[PATCH 03/22] IB/multicast: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "mcast_wq" queues work item >work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/core/multicast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c index a83ec28..002a85c 100644 --- a/drivers/infiniband/core/multicast.c +++ b/drivers/infiniband/core/multicast.c @@ -894,7 +894,7 @@ int mcast_init(void) { int ret; - mcast_wq = create_singlethread_workqueue("ib_mcast"); + mcast_wq = alloc_ordered_workqueue("ib_mcast", WQ_MEM_RECLAIM); if (!mcast_wq) return -ENOMEM; -- 2.1.4
[PATCH] gpio: wcove-gpio: add get_direction method
This patch adds .get_direction method for the gpio_chip structure of the wcove_gpio driver. Signed-off-by: Bin Gao--- drivers/gpio/gpio-wcove.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c index f5c88df..e11d6a3 100644 --- a/drivers/gpio/gpio-wcove.c +++ b/drivers/gpio/gpio-wcove.c @@ -164,6 +164,19 @@ static int wcove_gpio_dir_out(struct gpio_chip *chip, unsigned int gpio, CTLO_OUTPUT_SET | value); } +static int wcove_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio) +{ + struct wcove_gpio *wg = gpiochip_get_data(chip); + unsigned int val; + int ret; + + ret = regmap_read(wg->regmap, to_reg(gpio, CTRL_OUT), ); + if (ret) + return ret; + + return !(val & CTLO_DIR_OUT); +} + static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio) { struct wcove_gpio *wg = gpiochip_get_data(chip); @@ -394,6 +407,7 @@ static int wcove_gpio_probe(struct platform_device *pdev) wg->chip.label = KBUILD_MODNAME; wg->chip.direction_input = wcove_gpio_dir_in; wg->chip.direction_output = wcove_gpio_dir_out; + wg->chip.get_direction = wcove_gpio_get_direction; wg->chip.get = wcove_gpio_get; wg->chip.set = wcove_gpio_set; wg->chip.set_single_ended = wcove_gpio_set_single_ended, -- 1.9.1
[PATCH 00/22] Remove deprecated create_workqueue instances
This patch set removes the instances of deprecated create_singlethread_workqueue (scheduled for removal) in drivers/infiniband by making the appropriate conversions. Bhaktipriya Shridhar (22): IB/sa : Remove deprecated create_singlethread_workqueue IB/mad: Remove deprecated create_singlethread_workqueue IB/multicast: Remove deprecated create_singlethread_workqueue IB/ucma: Remove deprecated create_singlethread_workqueue IB/cma: Remove deprecated create_singlethread_workqueue IB/addr: Remove deprecated create_singlethread_workqueue IB/iwcm: Remove deprecated create_singlethread_workqueue iw_cxgb3: Remove deprecated create_singlethread_workqueue IB/qib: Remove deprecated create_singlethread_workqueue iw_cxgb4: Remove deprecated create_singlethread_workqueue IB/mthca: Remove deprecated create_singlethread_workqueue i40iw_main: Remove deprecated create_singlethread_workqueue i40iw_cm: Remove deprecated create_singlethread_workqueue IB/mlx5: Remove deprecated create_singlethread_workqueue IB/mlx5/odp: Remove deprecated create_singlethread_workqueue IB/mlx4: Remove deprecated create_singlethread_workqueue IB/mlx4/mad: Remove deprecated create_singlethread_workqueue IB/mlx4/mcg: Remove deprecated create_singlethread_workqueue IB/nes: Remove deprecated create_singlethread_workqueue IB/ipoib: Remove deprecated create_singlethread_workqueue IB/ipoib_verbs: Remove deprecated create_singlethread_workqueue IB/mlx4/alias_GUID: Remove deprecated create_singlethread_workqueue drivers/infiniband/core/addr.c | 2 +- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/core/iwcm.c | 2 +- drivers/infiniband/core/mad.c | 2 +- drivers/infiniband/core/multicast.c| 2 +- drivers/infiniband/core/sa_query.c | 2 +- drivers/infiniband/core/ucma.c | 3 ++- drivers/infiniband/hw/cxgb3/iwch_cm.c | 2 +- drivers/infiniband/hw/cxgb4/cm.c | 2 +- drivers/infiniband/hw/i40iw/i40iw_cm.c | 7 +-- drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +- drivers/infiniband/hw/mlx4/alias_GUID.c| 2 +- drivers/infiniband/hw/mlx4/mad.c | 4 ++-- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/infiniband/hw/mlx4/mcg.c | 4 ++-- drivers/infiniband/hw/mlx5/mr.c| 2 +- drivers/infiniband/hw/mlx5/odp.c | 4 ++-- drivers/infiniband/hw/mthca/mthca_catas.c | 2 +- drivers/infiniband/hw/nes/nes_cm.c | 4 ++-- drivers/infiniband/hw/qib/qib_init.c | 4 ++-- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 ++- drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +- 22 files changed, 33 insertions(+), 28 deletions(-) -- 2.1.4
[PATCH 02/22] IB/mad: Remove deprecated create_singlethread_workqueue
The workqueue "ib_nl" queues work items _nl_timed_work and _agent_priv->local_work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/core/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 2d49228..d882868 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -3177,7 +3177,7 @@ static int ib_mad_port_open(struct ib_device *device, goto error7; snprintf(name, sizeof name, "ib_mad%d", port_num); - port_priv->wq = create_singlethread_workqueue(name); + port_priv->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); if (!port_priv->wq) { ret = -ENOMEM; goto error8; -- 2.1.4
[PATCH 01/22] IB/sa : Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "ib_nl" queues work item _nl_timed_work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/core/sa_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index e955386..6559199 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -1974,7 +1974,7 @@ int ib_sa_init(void) goto err2; } - ib_nl_wq = create_singlethread_workqueue("ib_nl_sa_wq"); + ib_nl_wq = alloc_ordered_workqueue("ib_nl_sa_wq", WQ_MEM_RECLAIM); if (!ib_nl_wq) { ret = -ENOMEM; goto err3; -- 2.1.4
Re: [PATCH] iio: adc: rockchip_saradc: Explicitly disable ADC on probe
On 26/07/16 04:22, Guenter Roeck wrote: > On 07/25/2016 07:51 PM, Caesar Wang wrote: >> Hi Guenter, >> >> Thanks for fixing it. >> >> On 2016年07月26日 03:39, Guenter Roeck wrote: >>> If the ADC is read for the first time, the caller gets a timeout error, >>> and the kernel log shows >>> >>> read channel() error: -110 >>> >>> The ADC may be enabled on boot, and needs to be explicitly disabled >>> for a read sequence to work (otherwise there is no completion interrupt). >>> Disaple it explicitly in the probe function. >>> >>> Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc") >>> Signed-off-by: Guenter Roeck>>> --- >>> drivers/iio/adc/rockchip_saradc.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/drivers/iio/adc/rockchip_saradc.c >>> b/drivers/iio/adc/rockchip_saradc.c >>> index f9ad6c2d6821..6aa3271d86b5 100644 >>> --- a/drivers/iio/adc/rockchip_saradc.c >>> +++ b/drivers/iio/adc/rockchip_saradc.c >>> @@ -280,6 +280,9 @@ static int rockchip_saradc_probe(struct platform_device >>> *pdev) >>> goto err_pclk; >>> } >>> +/* Make sure ADC is disabled */ >>> +writel_relaxed(0, info->regs + SARADC_CTRL); >> >> I think we should reset the saradc controller. >> Since make sure the reset value is 0 and loader-->kernel may even cause >> harm, as my experience on tsadc. (drivers/thermal/rockchip_thermal.c) >> >> >> e.g.: >> /** >> * Reset SARADC Controller, reset all saradc registers. >> */ >> static void rockchip_saradc_reset_controller(struct reset_control *reset) >> { >> reset_control_assert(reset); >> usleep_range(10, 20); >> reset_control_deassert(reset); >> } >> >> ..probe() >> { >> ... >> rockchip_saradc_reset_controller(); >> ... >> } >> > > Ok, I'll give it a try. > > Guenter Could you confirm if this patch is superseded by that change or not? > >> >> - >> Caesar >> >>> + >>> platform_set_drvdata(pdev, indio_dev); >>> indio_dev->name = dev_name(>dev); >> >> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/22] IB/mthca: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "catas_wq" in triggering a device remove and causing a device reset when a catastrophic error occurs. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/mthca/mthca_catas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mthca/mthca_catas.c b/drivers/infiniband/hw/mthca/mthca_catas.c index 712d2a3..f6474c2 100644 --- a/drivers/infiniband/hw/mthca/mthca_catas.c +++ b/drivers/infiniband/hw/mthca/mthca_catas.c @@ -187,7 +187,7 @@ int __init mthca_catas_init(void) { INIT_WORK(_work, catas_reset); - catas_wq = create_singlethread_workqueue("mthca_catas"); + catas_wq = alloc_ordered_workqueue("mthca_catas", WQ_MEM_RECLAIM); if (!catas_wq) return -ENOMEM; -- 2.1.4
[PATCH 10/22] iw_cxgb4: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "workq" queues work item _work. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/cxgb4/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index a3a6721..6438b4c 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -4282,7 +4282,7 @@ int __init c4iw_cm_init(void) spin_lock_init(_lock); skb_queue_head_init(); - workq = create_singlethread_workqueue("iw_cxgb4"); + workq = alloc_ordered_workqueue("iw_cxgb4", WQ_MEM_RECLAIM); if (!workq) return -ENOMEM; -- 2.1.4
[PATCH 12/22] i40iw_main: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set, replaces deprecated create_singlethread_workqueue(). This is the identity conversion. The workqueue "virtchnl_wq" queues work items i40iw_cqp_generic_worker and i40iw_cqp_manage_hmc_fcn_worker. It has been identity converted. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure. Signed-off-by: Bhaktipriya Shridhar--- drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index 6e90813..798335f 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -1613,7 +1613,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client) status = i40iw_hmc_init_pble(>sc_dev, iwdev->pble_rsrc); if (status) break; - iwdev->virtchnl_wq = create_singlethread_workqueue("iwvch"); + iwdev->virtchnl_wq = alloc_ordered_workqueue("iwvch", WQ_MEM_RECLAIM); i40iw_register_notifiers(); iwdev->init_state = INET_NOTIFIER; status = i40iw_add_mac_ip(iwdev); -- 2.1.4
Re: [PATCH] block: Fix secure erase
On 08/15/2016 12:13 PM, Christoph Hellwig wrote: --- a/block/elevator.c +++ b/block/elevator.c @@ -366,7 +366,10 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) list_for_each_prev(entry, >queue_head) { struct request *pos = list_entry_rq(entry); - if ((req_op(rq) == REQ_OP_DISCARD) != (req_op(pos) == REQ_OP_DISCARD)) + if ((req_op(rq) == REQ_OP_DISCARD || +req_op(rq) == REQ_OP_SECURE_ERASE) != + (req_op(pos) == REQ_OP_DISCARD || +req_op(pos) == REQ_OP_SECURE_ERASE)) break; This really should be a: if (req_op(rq) != req_op(pos)) I'l lleave it up to Jens if he wants that in this patch or not, otherwise I'll send an incremental patch. Let's get a v2 with that fixed up, it makes a big readability difference. -- Jens Axboe
Re: [ANNOUNCE] git-series: track changes to a patch series over time
Hi Josh, On 1 August 2016 at 12:37, Josh Triplettwrote: > On Mon, Aug 01, 2016 at 09:14:54AM -0600, Stephen Warren wrote: >> On 07/29/2016 12:40 AM, Josh Triplett wrote: >> > I'd like to announce a project I've been working on for a while: >> > >> > git-series provides a tool for managing patch series with git, tracking >> > the "history of history". git series tracks changes to the patch series >> > over time, including rebases and other non-fast-forwarding changes. git >> > series also tracks a cover letter for the patch series, formats the >> > series for email, and prepares pull requests. >> >> Just as an FYI, I wouldn't be surprised if there's some overlap, or >> potential for merging of tools, between this tool and the "patman" tool >> that's part of the U-Boot source tree: >> >> http://git.denx.de/?p=u-boot.git;a=blob;f=tools/patman/README;h=e36857dedea1d0dbafa41732aaf9bf0988d63f38;hb=HEAD > > Interesting tool; thanks for the link. > > As far as I can tell from that documentation, patman doesn't track old > versions of a patch series; you rebase to modify patches or change > patman tags (embedded in commit messages), and nothing preserves the > previous version. And it tracks the cover letter and similar in one of > the commit messages in the series, so previous versions of that don't > get saved either. If you wanted to track the history of your changes, > you'd have to use branch names or similar. That's right. Normally you would keep the old branch around, or tag it. Of course old branches are often based on older versions the upstream repo, so they are not that useful for diiff, etc. But the normal procedure when updating a series to a new version is: git checkout -b wibble-v2 wibble git rebase upstream/master git commit --amend # Edit commit to add 'Series-version: 2', update cover letter etc. Of course any change log is preserved when you move to v3, since you just add more 'Series-changes:' tags. The old version of the cover letter, and the old version of the commits can be preserved with 'git tag'. > > In addition, tracking metadata in commit messages only works with a > patches-by-mail workflow where the messages get processed when > generating patches; that doesn't work for please-pull workflows. Can you explain what a please-pull workflow looks like, and what tags are expected? > > patman does have quite a few interesting ideas, though. git-series > needs some way of handling To/Cc addresses for patches and the cover > letter (beyond just scripts/get_maintainer.pl), and more automatic > handling of series versioning (v2, v3, ...) and associated series > changelogs. Suggestions welcome. Patman builds the cover letter change lists from the commits. The main point of patman is to automate the error-prone process of submitting a perfectly formed patch series. In particular, patman requires no change to the normal workflow that people use with git. > > - Josh Triplett Regards, Simon
Re: [PATCH] USB: core: of: Check device_node before parsing in usb_of_get_child_node()
On Mon, Aug 15, 2016 at 11:31:10AM -0700, Vaibhav Hiremath wrote: > In case of HUB devices connected to USB ports, we may not have DT > node representing it inside USB, and when devices connected to hub > gets enumerated, call to usb_of_get_child_node() leads to NULL pointer > dereference. Really? That seems messed up. > In the usecase we have, where EHCI port is connected to USB HUB > device, and downward ports of HUB are connected to further USB > devices. When those devices gets enumerated, in order, > 1. USB HUB -> > -> Call to usb_of_get_child_node() is OK, as > parent->dev.of_node is pointing to host node. > 2. Devices connected to downward port of USB HUB > -> Call to usb_of_get_child_node() leads to NULL > pointer dereference as parent->dev.of_node = NULL, > as USB HUB DTS node may be empty. Why is the hub DTS empty? Shouldn't that be the fix here? thanks, greg k-h
Re: BUG and WARN kernel log levels
On Mon, 2016-08-15 at 11:53 -0700, Kees Cook wrote: > Hi, > > So, I noticed that asm-gemeric/bug.h defines BUG() without a log level: > > #ifndef HAVE_ARCH_BUG > #define BUG() do { \ > printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); > \ > > Seems like it should have one? > > Also, I think we might want to examine WARN() a bit... it doesn't have > a log level either, but only a fraction of callers set one: > > $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep -v KERN_ | wc > -l > 2735 > > $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep KERN_ | wc -l > 77 > > If I'm reading checkpatch.pl correctly, it doesn't warn about missing > log levels on WARN calls, but I think it should. > > How do you think is best to clean this up? > > Mainly, I'd like to add a format string to BUG, or introduce a new > BUGish call that takes a format... I once suggested something similar awhile ago. https://lkml.org/lkml/2008/7/8/261 I think it's best to remove any KERN_ from the use of all the WARN variants and add it to the WARN definitions. Same with BUG.
Re: [PATCH v1 02/14] clk: twl6040: Register the clock as of_clk_provider
On 05/30, Peter Ujfalusi wrote: > In order ot be able to use the pdmclk clock via DT it need to be registered > as of_clk_provide. > Since the twl6040 clock driver does not have it's own DT node, use the > parent's node for registering. > > Signed-off-by: Peter Ujfalusi> --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project