Re: [PATCH trace-cmd 2/2] trace-recorder: better error handling during copy
On Tue, Mar 22, 2016 at 09:19:56AM -0400, Steven Rostedt wrote: > On Tue, 22 Mar 2016 09:14:33 -0400 > Peter Xu wrote: > > > Currently we have two ways to copy data, one is splice, one is read + > > write. For both, dump more information when we got errors during the > > copy. Also, when we update_fd(), we should make sure all bytes written, > > and update written bytes only. > > > > These information might be important to better diagnose when the copy > > got wrong, like no space error, or connection error when copying data to > > remote sockets. In the past, we just got silence errors without notice. > > > > Signed-off-by: Peter Xu > > --- > > trace-recorder.c | 34 -- > > 1 file changed, 24 insertions(+), 10 deletions(-) > > > > diff --git a/trace-recorder.c b/trace-recorder.c > > index 49b04ea..7d6feb0 100644 > > --- a/trace-recorder.c > > +++ b/trace-recorder.c > > @@ -334,13 +334,14 @@ static inline void update_fd(struct tracecmd_recorder > > *recorder, int size) > > */ > > static long splice_data(struct tracecmd_recorder *recorder) > > { > > - long ret; > > + long ret, written; > > > > ret = splice(recorder->trace_fd, NULL, recorder->brass[1], NULL, > > recorder->page_size, 1 /* SPLICE_F_MOVE */); > > if (ret < 0) { > > if (errno != EAGAIN && errno != EINTR) { > > - warning("recorder error in splice input"); > > + warning("recorder error in splice input: %s", > > + strerror(errno)); > > I'm wondering if we should add a "pwarning()" helper function that will > do the stderror(error) for us. Ah, I just found that __vwarning() will dump errno string, and warning() is calling that. So it explained why I got one more line when got errors... ;) How about remove all the strerror() things, and just keep capturing the written size? Let me send a v2 for this patch. Thanks. -- peterx
[PATCH trace-cmd v2] trace-recorder: better error handling during copy
Currently we have two ways to copy data, one is splice, one is read + write. For both, we should make sure all bytes written, and update written bytes only. It might happen when we got, e.g., no space error, or connection error when copying data to remote sockets. In the past, we just got silence errors without notice. Signed-off-by: Peter Xu --- trace-recorder.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/trace-recorder.c b/trace-recorder.c index 49b04ea..ac319d8 100644 --- a/trace-recorder.c +++ b/trace-recorder.c @@ -334,7 +334,7 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size) */ static long splice_data(struct tracecmd_recorder *recorder) { - long ret; + long ret, written; ret = splice(recorder->trace_fd, NULL, recorder->brass[1], NULL, recorder->page_size, 1 /* SPLICE_F_MOVE */); @@ -348,16 +348,22 @@ static long splice_data(struct tracecmd_recorder *recorder) } else if (ret == 0) return 0; - ret = splice(recorder->brass[0], NULL, recorder->fd, NULL, -recorder->page_size, recorder->fd_flags); - if (ret < 0) { + written = splice(recorder->brass[0], NULL, recorder->fd, NULL, +recorder->page_size, recorder->fd_flags); + if (written < 0) { if (errno != EAGAIN && errno != EINTR) { warning("recorder error in splice output"); return -1; } ret = 0; - } else + } else { + if (written != ret) { + warning("recorder written %ld to write %d", + written, ret); + return -1; + } update_fd(recorder, ret); + } return ret; } @@ -369,7 +375,7 @@ static long splice_data(struct tracecmd_recorder *recorder) static long read_data(struct tracecmd_recorder *recorder) { char buf[recorder->page_size]; - long ret; + ssize_t ret, written; ret = read(recorder->trace_fd, buf, recorder->page_size); if (ret < 0) { @@ -380,7 +386,12 @@ static long read_data(struct tracecmd_recorder *recorder) ret = 0; } if (ret > 0) { - write(recorder->fd, buf, ret); + written = write(recorder->fd, buf, ret); + if (written != ret) { + warning("recorder written %ld to write %d", + written, ret); + return -1; + } update_fd(recorder, ret); } -- 2.4.3
[PATCH] sdcardfs: fix itnull.cocci warnings
Remove NULL tests, as the index variable of list_for_each_entry cannot be NULL. Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- The code seems to have a lot of unnecessary braces as well. tree: https://android.googlesource.com/kernel/common android-4.4 head: f06e869f936e548fd3fd78ddcbebe171f0defadb commit: 1e2d3bbcf3f5a603e62dfa0514a43e13ee679d4f [4/6] sdcardfs: Bring up to date with Android M permissions: packagelist.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/sdcardfs/packagelist.c +++ b/fs/sdcardfs/packagelist.c @@ -160,7 +160,7 @@ static int insert_str_to_int(struct pack mutex_unlock(&pkgl_dat->hashtable_lock); list_for_each_entry(sbinfo, &sdcardfs_super_list, list) { - if (sbinfo) { + { fixup_perms(sbinfo->sb); } } @@ -189,7 +189,7 @@ static void remove_str_to_int(struct pac } mutex_unlock(&pkgl_dat->hashtable_lock); list_for_each_entry(sbinfo, &sdcardfs_super_list, list) { - if (sbinfo) { + { fixup_perms(sbinfo->sb); } }
[PATCH] sdcardfs: fix itnull.cocci warnings
Remove NULL test, as the index variable of list_for-each_entry cannot be NULL. Generated by: scripts/coccinelle/iterators/itnull.cocci Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- derived_perm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/sdcardfs/derived_perm.c +++ b/fs/sdcardfs/derived_perm.c @@ -112,7 +112,7 @@ void get_derived_permission(struct dentr void get_derive_permissions_recursive(struct dentry *parent) { struct dentry *dentry; list_for_each_entry(dentry, &parent->d_subdirs, d_child) { - if (dentry && dentry->d_inode) { + if (dentry->d_inode) { mutex_lock(&dentry->d_inode->i_mutex); get_derived_permission(parent, dentry); fix_derived_permission(dentry->d_inode);
Re: [PATCH v3 04/23] atari_NCR5380: Remove DMA_MIN_SIZE macro
On 03/21/2016 03:31 AM, Finn Thain wrote: > Only the atari_scsi and sun3_scsi drivers define DMA_MIN_SIZE. > Both drivers also define NCR5380_dma_xfer_len, which means > DMA_MIN_SIZE can be removed from the core driver. > > This removes another discrepancy between the two core drivers. > > Signed-off-by: Finn Thain > Tested-by: Michael Schmitz > > --- > > Changes since v1: > - Retain MIN_DMA_SIZE macro in wrapper drivers. > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH v3 14/23] ncr5380: Reduce max_lun limit
On 03/21/2016 03:32 AM, Finn Thain wrote: > The driver has a limit of eight LUs because of the byte-sized bitfield > that is used for busy flags. That means the maximum LUN is 7. The default > is 8. > > Signed-off-by: Finn Thain > Tested-by: Michael Schmitz > > --- > > Changed since v1: > - Reduce shost->max_lun limit instead of adding 'MAX_LUN' limit. > > --- > drivers/scsi/NCR5380.c |2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH v3 20/23] atari_scsi: Set a reasonable default for cmd_per_lun
On 03/21/2016 03:32 AM, Finn Thain wrote: > This setting does not need to be conditional on Atari ST or TT. > > Signed-off-by: Finn Thain > Tested-by: Michael Schmitz > > --- > > Changed since v1: > - Set the default cmd_per_lun to 4 based on test results. > > Changed since v2: > - Revert the default cmd_per_lun to 2, like in the v1 patch, because > a uniform default across all ten 5380 wrapper drivers is worth more > than a tiny improvement in one particular microbenchmark on one system. > Michael tells me that 2 is also the best setting for his Atari Falcon. > > --- > drivers/scsi/atari_scsi.c |3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH v3 23/23] ncr5380: Call complete_cmd() for disconnected commands on bus reset
On 03/21/2016 03:32 AM, Finn Thain wrote: > I'm told that some targets are liable to disconnect a REQUEST SENSE > command. Theoretically this would cause a command undergoing autosense to > be moved onto the disconnected list. The bus reset handler must call > complete_cmd() for these commands, otherwise the hostdata->sensing pointer > will not get cleared. That would cause autosense processing to stall and > a timeout or an incorrect scsi_eh_restore_cmnd() would eventually follow. > > Signed-off-by: Finn Thain > > --- > drivers/scsi/NCR5380.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux/drivers/scsi/NCR5380.c > === > --- linux.orig/drivers/scsi/NCR5380.c 2016-03-21 13:31:40.0 +1100 > +++ linux/drivers/scsi/NCR5380.c 2016-03-21 13:31:47.0 +1100 > @@ -2437,7 +2437,7 @@ static int NCR5380_bus_reset(struct scsi > struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); > > set_host_byte(cmd, DID_RESET); > - cmd->scsi_done(cmd); > + complete_cmd(instance, cmd); > } > INIT_LIST_HEAD(&hostdata->disconnected); > > > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH v3 0/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k
Thanks Rasmus, the whole series looks good to me: Reviewed-by: Christoph Hellwig
Re: [PATCH v2 0/5] mempool based chained scatterlist alloc/free api
On Tue, Mar 22, 2016 at 03:03:11PM -0700, Ming Lin wrote: > From: Ming Lin > > The fist 4 patches make the SG related definitions/structs/functions > in SCSI code generic and the last patch move it to lib/sg_pool.c. > > I still keep the macro "SG_MEMPOOL_NR" since it's used in 3 places. I don't ѕee the point, but I'm not going to block the series over it either. The new series looks really nice to me! Reviewed-by: Christoph Hellwig
Re: [PATCH] fujitsu-laptop: Support radio LED
> > If you could let me know how you went about > > acquiring the values on your machine I could try the exact same steps on the > > S7020 to see what we get. > > The BTNI value is printed to the kernel log buffer by > acpi_fujitsu_hotkey_add(), so all it takes to retrieve it is: > > dmesg | grep BTNI > I forgot to write that the other value I suggested could perhaps be used to determine whether a radio toggle button is present on a given model (0x00020320 on a Lifebook E744) is the return value of: call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0); It is stored in the rfkill_supported field of struct fujitsu_hotkey_t. You can also look it up in a DSDT dump. On a Lifebook E744: Method (S000, 3, Serialized) { Name (_T_0, Zero) // _T_x: Emitted by ASL Compiler Local0 = Zero While (One) { _T_0 = Arg0 If ((_T_0 == Zero)) { >> Local0 |= 0x0002 Local0 |= 0x0200 Local0 |= 0x0100 Local0 |= 0x20 } ... Break } Return (Local0) } On an E8420: Method (S000, 3, NotSerialized) { Local0 = 0x8000 If ((Arg0 == 0x00)) { Local0 = Zero Local0 |= 0x20 Local0 |= 0x0100 Local0 |= 0x0200 } ... Return (Local0) } -- Best regards, Michał Kępień
Re: [PATCH v3 4/4] nmi_backtrace: generate one-line reports for idle cpus
On Wed, Mar 23, 2016 at 01:50:00AM +0100, Rafael J. Wysocki wrote: > > > Well, what about intel_idle_freeze()? Or do we not care? > > > > I argued against it; when you're suspended the NMI watchdog is stopped > > too. > > Is it also stopped for suspend-to-idle? I'm not sure about that. > > Where do I need to look to find out? Hmm I have memories of writing a patch to that effect when we were starting with that suspend-to-idle stuff, because people didn't like being woken up all the time. But now that I look I cannot find it either..
Re: [PATCH] ARM64: dts: amlogic: Clean up Vega S95 /memory nodes
On Thu, Mar 17, 2016 at 12:10 AM, Andreas Färber wrote: > Resolve the following warnings from new dtc by adding the unit address: > > DTC arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dtb > Warning (unit_address_vs_reg): Node /memory has a reg or ranges property, > but no unit name > DTC arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dtb > Warning (unit_address_vs_reg): Node /memory has a reg or ranges property, > but no unit name > DTC arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dtb > Warning (unit_address_vs_reg): Node /memory has a reg or ranges property, > but no unit name > > Fixes: cc733bc90636 ("ARM64: dts: amlogic: Add Tronsmart Vega S95 configs") > Signed-off-by: Andreas Färber > --- > arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts | 2 +- > arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts | 2 +- > arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts > b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts > index 399aff9e7975..62fb4968d680 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts > @@ -48,7 +48,7 @@ > compatible = "tronsmart,vega-s95-meta", "tronsmart,vega-s95", > "amlogic,meson-gxbb"; > model = "Tronsmart Vega S95 Meta"; > > - memory { > + memory@0 { > device_type = "memory"; > reg = <0x0 0x0 0x0 0x8000>; > }; > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts > b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts > index ac5a241b5ec2..9a9663abdf5c 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts > @@ -48,7 +48,7 @@ > compatible = "tronsmart,vega-s95-pro", "tronsmart,vega-s95", > "amlogic,meson-gxbb"; > model = "Tronsmart Vega S95 Pro"; > > - memory { > + memory@0 { > device_type = "memory"; > reg = <0x0 0x0 0x0 0x4000>; > }; > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts > b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts > index fff7bfa2aa39..2fe167b2609d 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts > @@ -48,7 +48,7 @@ > compatible = "tronsmart,vega-s95-telos", "tronsmart,vega-s95", > "amlogic,meson-gxbb"; > model = "Tronsmart Vega S95 Telos"; > > - memory { > + memory@0 { > device_type = "memory"; > reg = <0x0 0x0 0x0 0x8000>; > }; Acked-by: Carlo Caione Thanks, -- Carlo Caione
Re: [PATCH] zram: export the number of available comp streams
( was "[PATCH] zram: export the number of available comp streams" forked from http://marc.info/?l=linux-kernel&m=145860707516861 ) Hello Minchan, forked into a separate tread. On (03/22/16 09:39), Minchan Kim wrote: > > zram_bvec_write() > > { > > *get_cpu_ptr(comp->stream); > > zcomp_compress(); > > zs_malloc() > > put_cpu_ptr(comp->stream); > > } > > > > this, however, makes zsmalloc unhapy. pool has GFP_NOIO | __GFP_HIGHMEM > > gfp, and GFP_NOIO is ___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM. this > > __GFP_DIRECT_RECLAIM is in the conflict with per-cpu streams, because > > per-cpu streams require disabled preemption (up until we copy stream > > buffer to zspage). so what options do we have here... from the top of > > my head (w/o a lot of thinking)... > > Indeed. ... > How about this? > > zram_bvec_write() > { > retry: > *get_cpu_ptr(comp->stream); > zcomp_compress(); > handle = zs_malloc((gfp &~ __GFP_DIRECT_RECLAIM| | GFP_NOWARN) > if (!handle) { > put_cpu_ptr(comp->stream); > handle = zs_malloc(gfp); > goto retry; > } > put_cpu_ptr(comp->stream); > } interesting. the retry jump should go higher, we have "user_mem = kmap_atomic(page)" which we unmap right after compression, because a) we don't need uncompressed memory anymore b) zs_malloc() can sleep and we can't have atomic mapping around. the nasty thing here is is_partial_io(). we need to re-do if (is_partial_io(bvec)) memcpy(uncmem + offset, user_mem + bvec->bv_offset, bvec->bv_len); once again in the worst case. so zs_malloc((gfp &~ __GFP_DIRECT_RECLAIM | GFP_NOWARN) so far can cause double memcpy() and double compression. just to outline this. the test. I executed a number of iozone tests, on each iteration re-creating zram device (3GB, LZO, EXT4. the box has 4 x86_64 CPUs). $DEVICE_SZ=3G $FREE_SPACE is 10% of $DEVICE_SZ time ./iozone -t $i -R -r $((8*$i))K -s $((($DEVICE_SZ/$i - $FREE_SPACE)/(1024*1024)))M -I +Z columns: TEST MAX_STREAMS 4 MAX_STREAMS 8 PER_CPU STREAMS Test #1 iozone -t 1 -R -r 8K -s 2764M -I +Z Initial write 853492.31* 835868.50 839789.56 Rewrite1642073.88 1657255.75 1693011.50* Read3384044.00* 3218727.25 3269109.50 Re-read3389794.50* 3243187.00 3267422.25 Reverse Read3209805.75* 3082040.00 3107957.25 Stride read3100144.50* 2972280.25 2923155.25 Random read2992249.75* 2874605.00 2854824.25 Mixed workload2992274.75* 2878212.25 2883840.00 Random write1471800.00 1452346.50 1515678.75* Pwrite 802083.00 801627.31 820251.69* Pread3443495.00* 3308659.25 3302089.00 Fwrite1880446.88 1838607.50 1909490.00* Fread3479614.75 3091634.75 6442964.50* = real 1m4.170s1m4.513s1m4.123s = user 0m0.559s0m0.518s0m0.511s = sys 0m18.766s 0m19.264s 0m18.641s Test #2 iozone -t 2 -R -r 16K -s 1228M -I +Z Initial write2102532.12 2051809.19 2419072.50* Rewrite2217024.25 2250930.00 3681559.00* Read7716933.25 7898759.00 8345507.75* Re-read7748487.75 7765282.25 8342367.50* Reverse Read7415254.25 7552637.25 7822691.75* Stride read7041909.50 7091049.25 7401273.00* Random read6205044.25 673.50 7232104.25* Mixed workload4582990.00 5271651.50 5361002.88* Random write2591893.62 2513729.88 3660774.38* Pwrite1873876.75 1909758.69 2087238.81* Pread4669850.00 4651121.56 4919588.44* Fwrite1937947.25 1940628.06 2034251.25* Fread9930319.00 9970078.00* 9831422.50 = real 0m53.844s 0m53.607s 0m52.528s = user 0m0.273s0m0.289s0m0.280s = sys 0m16.595s 0m16.478s 0m14.072s Test #3 iozone -t 3 -R -r 24K -s 716M -I +Z Initial write3036567.50 2998918.25 3683853.00* Rewrite3402447.88 3415685.88 5054705.38* Read 11767413.00*11133789.50 11246497.25 Re-read 11797680.50*11092592.00 11277382.00 Reverse Read 10828320.00*10157665.50 10749055.00 Stride read 10532039.50* 9943521.75 10464700.25 Random read 10380365.75* 9807859.25 10234127.00 Mixed workload87721
Re: [PATCH] ARM: dts: exynos: Enable SSS on Odroid X/X2/U3 family
Hi Krzysztof, [auto build test ERROR on robh/for-next] [also build test ERROR on v4.5 next-20160323] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/ARM-dts-exynos-Enable-SSS-on-Odroid-X-X2-U3-family/20160323-141323 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next config: arm-exynos_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): >> Error: arch/arm/boot/dts/exynos4412-odroid-common.dtsi:495.1-5 Label or path >> sss not found FATAL ERROR: Syntax error parsing input tree --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v2 0/6] ARM64: meson: GXBaby (S905) and Vega S95 enablement
On Tue, Mar 22, 2016 at 9:29 PM, Andreas Färber wrote: > Am 21.03.2016 um 23:36 schrieb Kevin Hilman: >> On Tue, Mar 1, 2016 at 6:34 PM, Andreas Färber wrote: >> >>> Note: On the Vega S95 I need to change TEXT_OFFSET as follows, >>> in order to avoid the vendor U-Boot overwriting itself (fwiu); >>> for the Mini Mx that's reportedly not necessary. >> >> FYI, the Amlogic P200 dev board also needs this hack with the factory u-boot. > > I have meanwhile found that > > mkimage -A arm64 -O linux -T kernel -C none -a 0x108 -e 0x108 \ > -n linux-next -d arch/arm64/boot/Image ../uImage > > and then using bootm instead of booti works even without the above hack > on the Vega S95. Not a satisfactory solution yet, but better than > patching the kernel in a distro-incompatible way. I wonder if we can add this kind of information in Documentation/arm/meson/. Probably it could be handy until we have a proper u-boot porting. -- Carlo Caione
Re: zram: per-cpu compression streams
( was "[PATCH] zram: export the number of available comp streams" forked from http://marc.info/?l=linux-kernel&m=145860707516861 ) d'oh sorry, now actually forked. Hello Minchan, forked into a separate tread. > On (03/22/16 09:39), Minchan Kim wrote: > > zram_bvec_write() > > { > > *get_cpu_ptr(comp-stream); > > zcomp_compress(); > > zs_malloc() > > put_cpu_ptr(comp-stream); > > } > > > > this, however, makes zsmalloc unhapy. pool has GFP_NOIO | __GFP_HIGHMEM > > gfp, and GFP_NOIO is ___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM. this > > __GFP_DIRECT_RECLAIM is in the conflict with per-cpu streams, because > > per-cpu streams require disabled preemption (up until we copy stream > > buffer to zspage). so what options do we have here... from the top of > > my head (w/o a lot of thinking)... > > Indeed. ... > How about this? > > zram_bvec_write() > { > retry: > *get_cpu_ptr(comp-stream); > zcomp_compress(); > handle = zs_malloc((gfp &~ __GFP_DIRECT_RECLAIM| | GFP_NOWARN) > if (!handle) { > put_cpu_ptr(comp-stream); > handle = zs_malloc(gfp); > goto retry; > } > put_cpu_ptr(comp-stream); > } interesting. the retry jump should go higher, we have "user_mem = kmap_atomic(page)" which we unmap right after compression, because a) we don't need uncompressed memory anymore b) zs_malloc() can sleep and we can't have atomic mapping around. the nasty thing here is is_partial_io(). we need to re-do if (is_partial_io(bvec)) memcpy(uncmem + offset, user_mem + bvec-bv_offset, bvec-bv_len); once again in the worst case. so zs_malloc((gfp &~ __GFP_DIRECT_RECLAIM | GFP_NOWARN) so far can cause double memcpy() and double compression. just to outline this. the test. I executed a number of iozone tests, on each iteration re-creating zram device (3GB, LZO, EXT4. the box has 4 x86_64 CPUs). $DEVICE_SZ=3G $FREE_SPACE is 10% of $DEVICE_SZ time ./iozone -t $i -R -r $((8*$i))K -s $((($DEVICE_SZ/$i - $FREE_SPACE)/(1024*1024)))M -I +Z columns: TEST MAX_STREAMS 4 MAX_STREAMS 8 PER_CPU STREAMS Test #1 iozone -t 1 -R -r 8K -s 2764M -I +Z Initial write 853492.31* 835868.50 839789.56 Rewrite1642073.88 1657255.75 1693011.50* Read3384044.00* 3218727.25 3269109.50 Re-read3389794.50* 3243187.00 3267422.25 Reverse Read3209805.75* 3082040.00 3107957.25 Stride read3100144.50* 2972280.25 2923155.25 Random read2992249.75* 2874605.00 2854824.25 Mixed workload2992274.75* 2878212.25 2883840.00 Random write1471800.00 1452346.50 1515678.75* Pwrite 802083.00 801627.31 820251.69* Pread3443495.00* 3308659.25 3302089.00 Fwrite1880446.88 1838607.50 1909490.00* Fread3479614.75 3091634.75 6442964.50* = real 1m4.170s1m4.513s1m4.123s = user 0m0.559s0m0.518s0m0.511s = sys 0m18.766s 0m19.264s 0m18.641s Test #2 iozone -t 2 -R -r 16K -s 1228M -I +Z Initial write2102532.12 2051809.19 2419072.50* Rewrite2217024.25 2250930.00 3681559.00* Read7716933.25 7898759.00 8345507.75* Re-read7748487.75 7765282.25 8342367.50* Reverse Read7415254.25 7552637.25 7822691.75* Stride read7041909.50 7091049.25 7401273.00* Random read6205044.25 673.50 7232104.25* Mixed workload4582990.00 5271651.50 5361002.88* Random write2591893.62 2513729.88 3660774.38* Pwrite1873876.75 1909758.69 2087238.81* Pread4669850.00 4651121.56 4919588.44* Fwrite1937947.25 1940628.06 2034251.25* Fread9930319.00 9970078.00* 9831422.50 = real 0m53.844s 0m53.607s 0m52.528s = user 0m0.273s0m0.289s0m0.280s = sys 0m16.595s 0m16.478s 0m14.072s Test #3 iozone -t 3 -R -r 24K -s 716M -I +Z Initial write3036567.50 2998918.25 3683853.00* Rewrite3402447.88 3415685.88 5054705.38* Read 11767413.00*11133789.50 11246497.25 Re-read 11797680.50*11092592.00 11277382.00 Reverse Read 10828320.00*10157665.50 10749055.00 Stride rea
[GIT PULL 2nd] Mailbox changes for v4.6
Hi Linus, Due to some last minute cosmetic changes, the driver was not included in the first pull request, otherwise the driver has been reviewed twice. Could you please consider pulling it, so it doesn't get delayed for another cycle? The following changes since commit c5a9d1f30c066b7922a5f66b8c03a263d2f06a8c: mailbox: rockchip: avoid 64-bit division (2016-03-16 09:18:15 +0530) are available in the git repository at: git://git.linaro.org/landing-teams/working/fujitsu/integration.git mailbox-for-next for you to fetch changes up to aace66b170ce7feda2d1860a81eefff37fa9d1d2: mailbox: Introduce TI message manager driver (2016-03-21 20:33:15 +0530) - Device tree bindings and driver for TI's Message-Manager controller Nishanth Menon (2): Documentation: dt: mailbox: Add TI Message Manager mailbox: Introduce TI message manager driver .../bindings/mailbox/ti,message-manager.txt| 50 ++ drivers/mailbox/Kconfig| 11 + drivers/mailbox/Makefile | 2 + drivers/mailbox/ti-msgmgr.c| 639 + include/linux/soc/ti/ti-msgmgr.h | 35 ++ 5 files changed, 737 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt create mode 100644 drivers/mailbox/ti-msgmgr.c create mode 100644 include/linux/soc/ti/ti-msgmgr.h
Re: [PATCHv2] fat: add config option to set UTF-8 mount option by default
On Tue, Mar 8, 2016 at 2:53 PM, Maciej S. Szmigiero wrote: > FAT has long supported its own default file name encoding > config setting, separate from CONFIG_NLS_DEFAULT. > > However, if UTF-8 encoded file names are desired FAT > character set should not be set to utf8 since this would > make file names case sensitive even if case insensitive > matching is requested. > Instead, "utf8" mount options should be provided to enable > UTF-8 file names in FAT file system. > > Unfortunately, there was no possibility to set the default > value of this option so on UTF-8 system "utf8" mount option > had to be added manually to most FAT mounts. > > This patch adds config option to set such default value. > > Signed-off-by: Maciej S. Szmigiero > --- a/fs/fat/Kconfig > +++ b/fs/fat/Kconfig > @@ -93,8 +93,24 @@ config FAT_DEFAULT_IOCHARSET > that most of your FAT filesystems use, and can be overridden > with the "iocharset" mount option for FAT filesystems. > Note that "utf8" is not recommended for FAT filesystems. > - If unsure, you shouldn't set "utf8" here. > + If unsure, you shouldn't set "utf8" here - select the next option > + instead if you would like to use UTF-8 encoded file names by > default. > See for more information. > > Enable any character sets you need in File Systems/Native Language > Support. > + > +config FAT_DEFAULT_UTF8 > + bool "Enable FAT UTF-8 option by default" > + depends on VFAT_FS > + default n > + help > + Set this if you would like to have "utf8" mount option set > + by default when mounting FAT filesystems. > + > + Even if you say Y here can always disable UTF-8 for > + particular mount by adding "utf8=0" to mount options. > + > + Say Y if you use UTF-8 encoding for file names, N otherwise. > + > + See for more information. What's the recommended value of CONFIG_FAT_DEFAULT_UTF8 for a (distro) defconfig? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH V2 0/2] kexec: Make a pair of map/unmap reserved pages in error path
On 03/23/16 at 11:32am, Xunlei Pang wrote: > On 2016/03/23 at 10:48, Baoquan He wrote: > > On 03/01/16 at 05:53pm, Xunlei Pang wrote: > >> This is a bug fix. > >> > >> After this, I will try to do a cleanup for crash_unmap/map_reserved_pages() > >> (only used by S390) to consolidate it with > >> arch_kexec_unprotect/protect_crashkres(). > > Hi Xunlei, Minfei, > > > > I think you need discuss together about how to do clean up codes in this > > place. From my point of view, arch_map/unmap_reserved_pages and > > arch_kexec_protect/unprotect_crashkres() are for the same goal but by > > different ways on different arch. So for Xunlei's patchset, you might > > need to rethink your implementation, the name of function. I personally > > think you just implement a x86 specific arch_map/unmap_reserved_pages. > > It may need a more generic name, and then add your x86 arch specific > > implementation. Sorry I can't see your patches on my mail client, > > Like what you said, I think arch_kexec_unprotect/protect_crashkres() are > generic enough, but any other better name is welcome :-) > > It also covered the newly-added kexec file path, and we can easily transfer > arch_map/unmap_reserved_pages into this new interface. I don't know the status of your patchset. If possible I think the 1st patch in your patchset shoule rename arch_map/unmap_reserved_pages to arch_kexec_protect/unprotect_crashkres, 2nd patch is to add your x86 specific patch. > > I was planning doing that, but sick recently, I will try to send a patch > doing that later. Yeah, totally understand. This is not urgent, please take care of yourself. > > Regards, > Xunlei > > > Xunlei. Since Andrew asked, I just checked these. > > > > I am fine with Minfei's patch 1/2. But for patch 2/2, it's a little > > comfortable to me. Is it really necessary to abstract code block from > > kexec_load, then wrap them into a newly added function do_kexec_load()? > > Without this wrapping is there a way to do your bug fix? Is there > > possibility that do_kexec_load will be called in other places? What's > > the benefit to wrap it into do_kexec_load against not wrapping? > > > > Thanks > > Baoquan > > > >> Regards, > >> Xunlei > >> > >> On 03/01/2016 at 04:02 PM, Minfei Huang wrote: > >>> v1: > >>> - Bisect the patch according to Andrew Morton's suggestion > >>> > >>> Minfei Huang (2): > >>> kexec: Make a pair of map/unmap reserved pages in error path > >>> kexec: Do a cleanup for function kexec_load > >>> > >>> kernel/kexec.c | 112 > >>> - > >>> 1 file changed, 63 insertions(+), 49 deletions(-) > >>> > >> > >> ___ > >> kexec mailing list > >> ke...@lists.infradead.org > >> http://lists.infradead.org/mailman/listinfo/kexec > > > ___ > kexec mailing list > ke...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec
Re: Suspicious error for CMA stress test
On 03/23/2016 05:44 AM, Joonsoo Kim wrote: Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock") Link: https://lkml.org/lkml/2016/3/2/280 Reported-by: Hanjun Guo Debugged-by: Laura Abbott Debugged-by: Joonsoo Kim Signed-off-by: Vlastimil Babka Cc: # 3.18+ --- mm/page_alloc.c | 46 +- 1 file changed, 33 insertions(+), 13 deletions(-) Acked-by: Joonsoo Kim Thanks for taking care of this issue!. Thanks for the review. But I'm now not sure whether we push this to mainline+stable now, and later replace with Lucas' approach, or whether that approach would be also suitable and non-disruptive enough for stable?
Re: [PATCH] staging: delete STE RMI4 hackish driver
On Wed, Mar 23, 2016 at 3:26 AM, Greg KH wrote: > On Fri, Mar 18, 2016 at 10:12:15AM +0100, Linus Walleij wrote: >> As of commit 62d5bdf972ebcfc99f72f734ae979713e4ca6450 >> "Merge branch 'synaptics-rmi4' into next" the input subsystem >> has a proper RMI4 infrastructure and touchscreen driver. >> The ST Ux500 platform has been converted to use the new driver >> and its devicetree bindings. Delete this ancient hack. >> >> Cc: Andrew Duggan >> Cc: Christopher Heiny >> Signed-off-by: Linus Walleij >> Acked-by: Dmitry Torokhov >> --- >> drivers/staging/ste_rmi4/Kconfig |9 - >> drivers/staging/ste_rmi4/Makefile |4 - >> drivers/staging/ste_rmi4/TODO |7 - >> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1137 >> - >> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h | 46 - >> 5 files changed, 1203 deletions(-) >> delete mode 100644 drivers/staging/ste_rmi4/Kconfig >> delete mode 100644 drivers/staging/ste_rmi4/Makefile >> delete mode 100644 drivers/staging/ste_rmi4/TODO >> delete mode 100644 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c >> delete mode 100644 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h > > You forgot to fix up the drivers/staging/Makefile and > drivers/staging/Kconfig files as well :( > > I'll go add that here... Sorry :( One of these cases where those hunks were left in my working tree. Stress and stuff. Thanks for fixing it up. Yours, Linus Walleij
Re: [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync
On Mon, Mar 21, 2016 at 04:19:56PM -0700, Davidlohr Bueso wrote: > mce_start() has an explicit smp_wmb to serialize writes to > global_nwo and mce_callin. However, atomic_inc_return() implies > barriers on both sides of the call, as such simply rely on this > full smp barrier. > > Signed-off-by: Davidlohr Bueso > --- > arch/x86/kernel/cpu/mcheck/mce.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied, thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.
Re: [PATCH] staging: dgnc: fix CamelCase in dgnc_driver.c
Hi Daeseok, [auto build test ERROR on staging/staging-testing] [also build test ERROR on next-20160323] [cannot apply to v4.5] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Daeseok-Youn/staging-dgnc-fix-CamelCase-in-dgnc_driver-c/20160323-131708 config: x86_64-randconfig-s1-03231424 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/built-in.o: In function `dgnc_mgmt_ioctl': >> (.text+0x7ca676): undefined reference to `dgnc_NumBoards' drivers/built-in.o: In function `dgnc_mgmt_ioctl': (.text+0x7ca71d): undefined reference to `dgnc_NumBoards' drivers/built-in.o: In function `dgnc_mgmt_ioctl': >> (.text+0x7ca73e): undefined reference to `dgnc_Board' drivers/built-in.o: In function `dgnc_mgmt_ioctl': (.text+0x7ca759): undefined reference to `dgnc_Board' drivers/built-in.o: In function `dgnc_mgmt_ioctl': (.text+0x7ca83a): undefined reference to `dgnc_NumBoards' drivers/built-in.o: In function `dgnc_mgmt_ioctl': (.text+0x7ca85c): undefined reference to `dgnc_Board' drivers/built-in.o: In function `dgnc_driver_boards_show': >> dgnc_sysfs.c:(.text+0x7d2bda): undefined reference to `dgnc_NumBoards' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: Suspicious error for CMA stress test
2016-03-23 17:26 GMT+09:00 Vlastimil Babka : > On 03/23/2016 05:44 AM, Joonsoo Kim wrote: >>> >>> >>> Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on >>> isolated pageblock") >>> Link: https://lkml.org/lkml/2016/3/2/280 >>> Reported-by: Hanjun Guo >>> Debugged-by: Laura Abbott >>> Debugged-by: Joonsoo Kim >>> Signed-off-by: Vlastimil Babka >>> Cc: # 3.18+ >>> --- >>> mm/page_alloc.c | 46 +- >>> 1 file changed, 33 insertions(+), 13 deletions(-) >> >> >> Acked-by: Joonsoo Kim >> >> Thanks for taking care of this issue!. > > > Thanks for the review. But I'm now not sure whether we push this to > mainline+stable now, and later replace with Lucas' approach, or whether that > approach would be also suitable and non-disruptive enough for stable? Lucas' approach is for improvement and would be complex rather than this. I don't think it would be appropriate for stable. IMO, it's better to push this to mainline + stable now. Thanks.
Re: [PATCH 1/3] leds: triggers: add support for RGB triggers
On 03/22/2016 11:06 PM, Heiner Kallweit wrote: Am 22.03.2016 um 17:00 schrieb Jacek Anaszewski: On 03/22/2016 12:47 PM, Heiner Kallweit wrote: Am 22.03.2016 um 09:05 schrieb Jacek Anaszewski: On 03/21/2016 06:34 PM, Heiner Kallweit wrote: Am 21.03.2016 um 16:35 schrieb Jacek Anaszewski: On 03/19/2016 08:11 PM, Heiner Kallweit wrote: Am 18.03.2016 um 14:10 schrieb Jacek Anaszewski: On 03/17/2016 08:53 PM, Heiner Kallweit wrote: Am 17.03.2016 um 14:41 schrieb Jacek Anaszewski: Hi Heiner, On 03/13/2016 06:14 PM, Heiner Kallweit wrote: Add basic support for RGB triggers. Triggers with flag LED_TRIG_CAP_RGB set are available to RGB LED devices only. Signed-off-by: Heiner Kallweit --- drivers/leds/led-triggers.c | 15 --- include/linux/leds.h| 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 2181581..3ccf88b 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -30,6 +30,13 @@ static LIST_HEAD(trigger_list); /* Used by LED Class */ +static inline bool led_trig_check_rgb(struct led_trigger *trig, + struct led_classdev *led_cdev) +{ +return !(trig->flags & LED_TRIG_CAP_RGB) || + led_cdev->flags & LED_DEV_CAP_RGB; +} Could you explain what is the purpose of this function? What actually do we want to check here? Triggers using RGB functionality can't be used with non-RGB LED's. This check checks for such unsupported combinations: It returns false if the trigger uses RGB functionality but LED doesn't support the RGB extension. We need more meaningful name for it. Maybe led_trigger_is_supported() ? And let's make it no-op for !CONFIG_LEDS_CLASS_RGB case. OK, led_trigger_is_supported() is better. Making the function a no-op in the non-RGB case would have some impact: We'd have to make sure that all public trigger functions are a de-facto no-op for RGB triggers (at least register / unregister). Means we would need something like this in each public trigger function: #if !IS_ENABLED(CONFIG_LEDS_CLASS_RGB) if (trig->flags & LED_TRIG_CAP_RGB)) return; #endif I think this would add a lot of overhead and therefore IMHO it's better to not make the check function a no-op. Wouldn't it suffice to make the no-op returning true? Preventing RGB trigger registration for non-RGB LED class configuration seems to be different thing, also to be considered. No, it's not sufficient. Let's say the RGB extension is disabled and we have a RGB trigger. The check is a no-op now (returns always true), therefore the RGB trigger would be displayed in the list of available triggers also for all non-RGB LED's. If RGB trigger was made dependent on LED RGB class, then the related Kconfig symbol would remain undefined in !CONFIG_LEDS_CLASS_RGB case. Making a RGB trigger dependent on LED RGB class would mean to enclose all calls to trigger functions in the RGB trigger like this: #if IS_ENABLED(CONFIG_LEDS_CLASS_RGB) trigger_function() #endif You probably think about the case when we have two triggers in single module, like in the planned {rgb-}heartbeat case? If so this is an argument for having RGB triggers in separate files. I mean the case of triggers implemented outside drivers/leds. There the trigger code often is not separated from other functionality (e.g. drivers/tty/vt/keyboard.c) and it's not directly under our (LED core) control. This would apply to led_trigger_(un)register, led_trigger_event, led_trigger_blink, etc. And I think it wouldn't be too nice to force other kernel modules wanting to implement a RGB trigger to add these conditional compile statements. What other modules do you have on mind? LED triggers are implemented in their own files. That's true for the triggers under drivers/leds/trigger, but not necessarily for triggers implemented in other parts of the kernel. In this case surrounding all the trigger implementation with IS_ENABLED(CONFIG_LEDS_CLASS_RGB) guard would do. In the aformentioned drivers/tty/vt/keyboard.c we have even more generic IS_ENABLED(CONFIG_LEDS_TRIGGERS) guard anyway. Alternatively, as mentioned before, we would have to add this to all public trigger functions: #if !IS_ENABLED(CONFIG_LEDS_CLASS_RGB) if (trig->flags & LED_TRIG_CAP_RGB)) return; #endif I think this would add significant overhead w/o gaining really something. We could maximum remove the "|| led_cdev->flags & LED_DEV_CAP_RGB" from the check if the RGB extension is disabled. But it's open whether this minimal gain in a non-critical code path justifies this. ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -52,12 +59,12 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, down_read(&triggers_list_lock); list_for_
Re: [PATCH v3] iwlwifi: dvm: use alloc_ordered_workqueue()
On 03/19/2016 07:15 AM, Eva Rachel Retuya wrote: > Use alloc_ordered_workqueue() to allocate the workqueue instead of > create_singlethread_workqueue() since the latter is deprecated and is > scheduled > for removal. > > There are work items doing related operations that shouldn't be swapped when > queued in a certain order hence preserve the strict execution ordering of a > single threaded (ST) workqueue by switching to alloc_ordered_workqueue(). > > WQ_MEM_RECLAIM flag is not needed since the worker is not depended > during memory reclaim. > > Signed-off-by: Eva Rachel Retuya > Acked-by: Tejun Heo > --- Applied - thanks.
Re: [PATCH v2 2/5] perf: Free aux pages in unmap path
On Thu, Mar 17, 2016 at 03:05:42PM +0200, Alexander Shishkin wrote: > > We should be able to send IPIs with rcu_read_lock() held; > Ok, so how about this one instead. Looks good, thanks!
Re: [PATCH v3] PCI: ACPI: IA64: fix IO port generic range check
On 2016/3/21 19:12, Lorenzo Pieralisi wrote: The [0 - 64k] ACPI PCI IO port resource boundary check in: acpi_dev_ioresource_flags() is currently applied blindly in the ACPI resource parsing to all architectures, but only x86 suffers from that IO space limitation. On arches (ie IA64 and ARM64) where IO space is memory mapped, the PCI root bridges IO resource windows are firstly initialized from the _CRS (in acpi_decode_space()) and contain the CPU physical address at which a root bridge decodes IO space in the CPU physical address space with the offset value representing the offset required to translate the PCI bus address into the CPU physical address. The IO resource windows are then parsed and updated in arch code before creating and enumerating PCI buses (eg IA64 add_io_space()) to map in an arch specific way the obtained CPU physical address range to a slice of virtual address space reserved to map PCI IO space, ending up with PCI bridges resource windows containing IO resources like the following on a working IA64 configuration: PCI host bridge to bus :00 pci_bus :00: root bus resource [io 0x100-0x100 window] (bus address [0x-0x]) pci_bus :00: root bus resource [mem 0x000a-0x000f window] pci_bus :00: root bus resource [mem 0x8000-0x8fff window] pci_bus :00: root bus resource [mem 0x8000400-0x800 window] pci_bus :00: root bus resource [bus 00] This implies that the [0 - 64K] check in acpi_dev_ioresource_flags() leaves platforms with memory mapped IO space (ie IA64) broken (ie kernel can't claim IO resources since the host bridge IO resource is disabled and discarded by ACPI core code, see log on IA64 with missing root bridge IO resource, silently filtered by current [0 - 64k] check in acpi_dev_ioresource_flags()): PCI host bridge to bus :00 pci_bus :00: root bus resource [mem 0x000a-0x000f window] pci_bus :00: root bus resource [mem 0x8000-0x8fff window] pci_bus :00: root bus resource [mem 0x8000400-0x800 window] pci_bus :00: root bus resource [bus 00] [...] pci :00:03.0: [1002:515e] type 00 class 0x03 pci :00:03.0: reg 0x10: [mem 0x8000-0x87ff pref] pci :00:03.0: reg 0x14: [io 0x1000-0x10ff] pci :00:03.0: reg 0x18: [mem 0x8802-0x8802] pci :00:03.0: reg 0x30: [mem 0x8800-0x8801 pref] pci :00:03.0: supports D1 D2 pci :00:03.0: can't claim BAR 1 [io 0x1000-0x10ff]: no compatible bridge window For this reason, the IO port resources boundaries check in generic ACPI parsing code should be guarded with a CONFIG_X86 guard so that more arches (ie ARM64) can benefit from the generic ACPI resources parsing interface without incurring in unexpected resource filtering, fixing at the same time current breakage on IA64. This patch factors out IO ports boundary [0 - 64k] check in generic ACPI code and makes the IO space check X86 specific to make sure that IO space resources are usable on other arches too. Fixes: 3772aea7d6f3 ("ia64/PCI/ACPI: Use common ACPI resource parsing interface for host bridge") Signed-off-by: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Hanjun Guo Cc: Jiang Liu Cc: Tony Luck Cc: Tomasz Nowicki Cc: Mark Salter Cc: "Rafael J. Wysocki" --- v2 -> v3 - Moved IO resource check to generic ACPI resource code - Dropped Tested-by tags - Rebased against v4.5 Add this patch on top of Linus's latest tree, and test it on a HP rx2660 IA64 machine, the machine boot with NIC working properly, and no regressions in boot log. Tested-by: Hanjun Guo Thanks Hanjun
Re: [PATCH v2 16/18] dt-bindings: Add OXNAS bindings
On 03/17/2016 06:27 PM, Rob Herring wrote: > On Wed, Mar 09, 2016 at 11:24:18AM +0100, Neil Armstrong wrote: >> Signed-off-by: Neil Armstrong >> --- >> Documentation/devicetree/bindings/arm/oxnas.txt | 9 + >> 1 file changed, 9 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/arm/oxnas.txt >> >> diff --git a/Documentation/devicetree/bindings/arm/oxnas.txt >> b/Documentation/devicetree/bindings/arm/oxnas.txt >> new file mode 100644 >> index 000..f6032d2 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/arm/oxnas.txt >> @@ -0,0 +1,9 @@ >> +PLX Technology OXNAS SoCs Family device tree bindings >> +--- >> + >> +Boards with the OX810SE Soc SoC shall have the following properties: > > s/Soc SoC/SoC/ OK > >> + Required root node property: >> +compatible: "oxsemi,ox810se" >> + >> +Board compatible values: >> + - "wd,mbwe" (OX810SE) > > Seems kind of generic. Only one version? There is a My Book World Edition II, which seems to be the same (they share the same firmware) but with two SATA ports, the original kernel does not make any differences between the two models. I'm not aware of different versions and the firmware does not contain any specific code for different board revisions. Neil
Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async
On (03/23/16 09:37), Sergey Senozhatsky wrote: [..] > ok, I'll take a look. > > eventually (after 0003) vprintk_emit() is > > if (in_sched) { > __this_cpu_or(printk_pending, > PRINTK_PENDING_OUTPUT); > irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); > } > local_irq_restore(flags); > if (!in_sched) { > lockdep_off(); > if (console_trylock()) > console_unlock(); > lockdep_on(); > } > > > I do not say that it is a "dream-of-like" code. One important thing for > > me is that it does not use "sync_printk" variable. > > > > You original code modified "sync_printk" according to "in_sched" and > > "in_panic" variables earlier in vprintk_emit. Then it again checked > > all three variables here which produced strange twists in my head ;-) > hm... may be we can do even better. move printk_pending and irq_work_queue() back to printk_deferred() and do the preemption magic there. so vprintk_emit() can be lighter. will take a look later today. -ss
Re: [PATCH v4 0/2] clk: Add Artpec-6 SoC support
Michael & Stephen, Should we resubmit this series for 4.7 ? Also to follow up on your previous request to use the platform driver framework. We have noticed recent submissions use a style that mixes early clocks registered with CLK_OF_DECLARE and the remaining clocks registered through a platform driver. Is this the style we should implement ? Best Regards, Lars Persson On 02/25/2016 03:58 PM, Lars Persson wrote: Add clock support for the Artpec-6 SoC port. The ARM parts are in the series "arm: Add Artpec-6 SoC" and it goes through the arm-soc tree. Changes since v3: - The binding was corrected to handle two fractional divider clocks as input to the clock controller. - Updated clk-artpec6.c to handle a distinct fractional divider input for each i2s clock mux. Changes since v2: - Moved axis,artpec6-clkctrl.h to the first patch with the DT bindings. Changes since v1: - The driver now provides all clocks from the main clock controller block through one DT node. - Added a header file for the clock indexes. - Refer to clock-bindings.txt in the bindings document. A platform driver was not possible because the clocks are needed earlier in the kernel startup. Lars Persson (2): clk: add device tree binding for Artpec-6 clock controller clk: add artpec-6 clock controller .../devicetree/bindings/clock/artpec6.txt | 41 + drivers/clk/Makefile | 1 + drivers/clk/axis/Makefile | 1 + drivers/clk/axis/clk-artpec6.c | 189 + include/dt-bindings/clock/axis,artpec6-clkctrl.h | 38 + 5 files changed, 270 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/artpec6.txt create mode 100644 drivers/clk/axis/Makefile create mode 100644 drivers/clk/axis/clk-artpec6.c create mode 100644 include/dt-bindings/clock/axis,artpec6-clkctrl.h
[PATCH 3/4 v3] drm: atmel_hldc: Use generic drm_connector_register_all() helper
This driver used to have its own implementation of connector_register_all() which actually was taken as a prototype of drm_connector_register_all(). Now when drm_connector_register_all() exists reusing it here. And while at it replace atmel_hlcdc_dc_connector_unplug_all() with generic drm_connector_unregister_all(). Signed-off-by: Alexey Brodkin Cc: Daniel Vetter Cc: David Airlie Acked-by: Boris Brezillon --- Changes v2 -> v3: * Updated title with capital after colon * Added ack from Boris No changes v1 -> v2. drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 39 ++-- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 3d8d164..1c537e4 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -584,41 +584,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev) destroy_workqueue(dc->wq); } -static int atmel_hlcdc_dc_connector_plug_all(struct drm_device *dev) -{ - struct drm_connector *connector, *failed; - int ret; - - mutex_lock(&dev->mode_config.mutex); - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - ret = drm_connector_register(connector); - if (ret) { - failed = connector; - goto err; - } - } - mutex_unlock(&dev->mode_config.mutex); - return 0; - -err: - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (failed == connector) - break; - - drm_connector_unregister(connector); - } - mutex_unlock(&dev->mode_config.mutex); - - return ret; -} - -static void atmel_hlcdc_dc_connector_unplug_all(struct drm_device *dev) -{ - mutex_lock(&dev->mode_config.mutex); - drm_connector_unplug_all(dev); - mutex_unlock(&dev->mode_config.mutex); -} - static void atmel_hlcdc_dc_lastclose(struct drm_device *dev) { struct atmel_hlcdc_dc *dc = dev->dev_private; @@ -736,7 +701,7 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev) if (ret) goto err_unload; - ret = atmel_hlcdc_dc_connector_plug_all(ddev); + ret = drm_connector_register_all(ddev); if (ret) goto err_unregister; @@ -758,7 +723,7 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) { struct drm_device *ddev = platform_get_drvdata(pdev); - atmel_hlcdc_dc_connector_unplug_all(ddev); + drm_connector_unregister_all(ddev); drm_dev_unregister(ddev); atmel_hlcdc_dc_unload(ddev); drm_dev_unref(ddev); -- 2.5.0
[PATCH 0/4 v3] drm: Introduce drm_connector_register_all() helper
As a pair to already existing drm_connector_unplug_all() (which we'll rename in this series to drm_connector_unregister_all()) we're adding generic implementation of what is already done in some drivers for registering all connectors. After implementation of that new helper we're updating 2 drivers that used to use it's own implementation: [1] atmel_hlcdc [2] rcar_du And one driver that uses unregister(): [1] udl Other drivers still use load() callback and so should be first modified so their load() gets called from their probe() explicitly. Build- and run-tested on yet to be upstreamed ARC PGU (part of AXS10x board). Changes v2 -> v3: * Added acks for 1, 3 and 4 patches * Updated kerneldoc descriptins of both register_ and unregister_all() * Updated commit messages (mostly spellos and grammar issues) Changes v1 -> v2: * Rename drm_connector_unplug_all() to drm_connector_unregister_all() * Use drm_for_each_connector() instead of list_for_each_entry() * Updated kerneldoc for drm_dev_register() Alexey Brodkin (4): drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all() drm: Introduce drm_connector_register_all() helper drm: atmel_hldc: Use generic drm_connector_register_all() helper drm: rcar-du: Use generic drm_connector_register_all() helper drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 39 +- drivers/gpu/drm/drm_crtc.c | 59 drivers/gpu/drm/drm_drv.c| 6 ++- drivers/gpu/drm/rcar-du/rcar_du_drv.c| 14 +-- drivers/gpu/drm/udl/udl_drv.c| 2 +- include/drm/drm_crtc.h | 5 ++- 6 files changed, 64 insertions(+), 61 deletions(-) Cc: Daniel Vetter Cc: David Airlie Cc: Boris Brezillon Cc: Laurent Pinchart Cc: linux-renesas-...@vger.kernel.org -- 2.5.0
Re: [PATCH v2 1/6] x86/mm/pat: Change PAT to support non-default PAT MSR
On Tue, Mar 22, 2016 at 12:35:19PM -0600, Toshi Kani wrote: > Right. Will change to "Add support of non-default PAT MSR setting at > handoff". Please remove this "handoff" notion from the text. Every hw register is being handed off to the OS once the kernel takes over so there's no need to make it special here. > I'd like to make it clear that this function does not set PAT MSR, unlike > what pat_init() does. When CPU supports PAT, it keeps PAT MSR in whatever > the setting at handoff, and initializes PAT table to match with this > setting. > > I am open to a better name, but I am afraid that setup_pat() can be > confusing as if it sets PAT MSR. So call it init_cache_modes() and rename the current pat_init_cache_modes() to __init_cache_modes() to denote it is a lower level helper of the init_cache_modes() one. The init_cache_modes() one deals with the higher level figuring out of whether PAT is enabled and if not, preparing the attr bits for emulation. In the end, it calls __init_cache_modes(). All nice and easy. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
[PATCH 1/4 v3] drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()
Current name is a bit misleading because what that helper function really does it calls drm_connector_unregister() for all connectors. This all has nothing to do with hotplugging so let's name things properly. And while at it remove potentially dangerous locking around drm_connector_unregister() in rcar_du_remove() as mentioned in kerneldoc for drm_connector_unregister_all(). Signed-off-by: Alexey Brodkin Cc: Daniel Vetter Cc: David Airlie Cc: Boris Brezillon Cc: linux-renesas-...@vger.kernel.org Acked-by: Laurent Pinchart --- Changes v2 -> v3: * Updated title with capital after colon * Updated kerneldoc description of drm_connector_unregister_all() so that it will match description of register_all() to be introduced in the next change * Added ack from Laurent Changes v1 -> v2: * This patch was only introduced in v2. drivers/gpu/drm/drm_crtc.c| 18 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 + drivers/gpu/drm/udl/udl_drv.c | 2 +- include/drm/drm_crtc.h| 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 65258ac..65488a6 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1080,25 +1080,25 @@ void drm_connector_unregister(struct drm_connector *connector) } EXPORT_SYMBOL(drm_connector_unregister); - /** - * drm_connector_unplug_all - unregister connector userspace interfaces + * drm_connector_unregister_all - unregister connector userspace interfaces * @dev: drm device * - * This function unregisters all connector userspace interfaces in sysfs. Should - * be call when the device is disconnected, e.g. from an usb driver's - * ->disconnect callback. + * This functions unregisters all connectors from sysfs and other places so + * that userspace can no longer access them. Drivers should call this as the + * first step tearing down the device instace, or when the underlying + * physical device disappeared (e.g. USB unplug), right before calling + * drm_dev_unregister(). */ -void drm_connector_unplug_all(struct drm_device *dev) +void drm_connector_unregister_all(struct drm_device *dev) { struct drm_connector *connector; /* FIXME: taking the mode config mutex ends up in a clash with sysfs */ - list_for_each_entry(connector, &dev->mode_config.connector_list, head) + drm_for_each_connector(connector, dev) drm_connector_unregister(connector); - } -EXPORT_SYMBOL(drm_connector_unplug_all); +EXPORT_SYMBOL(drm_connector_unregister_all); /** * drm_encoder_init - Init a preallocated encoder diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index ed6006b..644db36 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -278,10 +278,7 @@ static int rcar_du_remove(struct platform_device *pdev) struct rcar_du_device *rcdu = platform_get_drvdata(pdev); struct drm_device *ddev = rcdu->ddev; - mutex_lock(&ddev->mode_config.mutex); - drm_connector_unplug_all(ddev); - mutex_unlock(&ddev->mode_config.mutex); - + drm_connector_unregister_all(ddev); drm_dev_unregister(ddev); if (rcdu->fbdev) diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 772ec9e..c204089 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -94,7 +94,7 @@ static void udl_usb_disconnect(struct usb_interface *interface) struct drm_device *dev = usb_get_intfdata(interface); drm_kms_helper_poll_disable(dev); - drm_connector_unplug_all(dev); + drm_connector_unregister_all(dev); udl_fbdev_unplug(dev); udl_drop_usb(dev); drm_unplug_dev(dev); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 8c7fb3d..42d9f4d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2214,8 +2214,8 @@ void drm_connector_unregister(struct drm_connector *connector); extern void drm_connector_cleanup(struct drm_connector *connector); extern unsigned int drm_connector_index(struct drm_connector *connector); -/* helper to unplug all connectors from sysfs for device */ -extern void drm_connector_unplug_all(struct drm_device *dev); +/* helper to unregister all connectors from sysfs for device */ +extern void drm_connector_unregister_all(struct drm_device *dev); extern int drm_bridge_add(struct drm_bridge *bridge); extern void drm_bridge_remove(struct drm_bridge *bridge); -- 2.5.0
[PATCH 4/4 v3] drm: rcar-du: Use generic drm_connector_register_all() helper
Now that a generic drm_connector_register_all() helper exists we may safely substitute it for the driver-specific implementation of connectors plugging in sysfs. Signed-off-by: Alexey Brodkin Cc: Daniel Vetter Cc: David Airlie Cc: linux-renesas-...@vger.kernel.org Acked-by: Laurent Pinchart --- Changes v2 -> v3: * Updated title with capital after colon * Updated commit message with fixes of spellos and grammar issues * Added ack from Laurent No changes v1 -> v2. drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 644db36..0f251dc 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -361,14 +361,7 @@ static int rcar_du_probe(struct platform_device *pdev) if (ret) goto error; - mutex_lock(&ddev->mode_config.mutex); - drm_for_each_connector(connector, ddev) { - ret = drm_connector_register(connector); - if (ret < 0) - break; - } - mutex_unlock(&ddev->mode_config.mutex); - + ret = drm_connector_register_all(ddev); if (ret < 0) goto error; -- 2.5.0
[PATCH 2/4 v3] drm: Introduce drm_connector_register_all() helper
As a pair to already existing drm_connector_unregister_all() we're adding generic implementation of what is already done in some drivers. Once this helper is implemented we'll be ready to switch existing driver-specific implementations with the generic one. Signed-off-by: Alexey Brodkin Cc: Daniel Vetter Cc: David Airlie --- Changes v2 -> v3: * Updated title with capital after colon * Simplified failure path with direct and unconditional invocation of unregister_all() * Updated kerneldoc description of the drm_connector_register_all() Changes v1 -> v2: * Rename drm_connector_unplug_all() to drm_connector_unregister_all() * Use drm_for_each_connector() instead of list_for_each_entry() * Updated kerneldoc for drm_dev_register() drivers/gpu/drm/drm_crtc.c | 43 +++ drivers/gpu/drm/drm_drv.c | 6 +- include/drm/drm_crtc.h | 3 ++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 65488a6..21eea11 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1081,6 +1081,49 @@ void drm_connector_unregister(struct drm_connector *connector) EXPORT_SYMBOL(drm_connector_unregister); /** + * drm_connector_register_all - register all connectors + * @dev: drm device + * + * This function registers all connectors in sysfs and other places so that + * userspace can start to access them. Drivers can call it after calling + * drm_dev_register() to complete the device registration, if they don't call + * drm_connector_register() on each connector individually. + * + * When a device is unplugged and should be removed from userspace access, + * call drm_connector_unregister_all(), which is the inverse of this + * function. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_connector_register_all(struct drm_device *dev) +{ + struct drm_connector *connector; + int ret; + + mutex_lock(&dev->mode_config.mutex); + + drm_for_each_connector(connector, dev) { + ret = drm_connector_register(connector); + if (ret) { + /* +* We may safely call unregister_all() here within +* area locked with mutex because unregister_all() +* doesn't use locks inside (see a comment in that +* function). +*/ + drm_connector_unregister_all(dev); + return ret; + } + } + + mutex_unlock(&dev->mode_config.mutex); + + return 0; +} +EXPORT_SYMBOL(drm_connector_register_all); + +/** * drm_connector_unregister_all - unregister connector userspace interfaces * @dev: drm device * diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 167c8d3..2c9a2b6 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -715,7 +715,11 @@ EXPORT_SYMBOL(drm_dev_unref); * * Register the DRM device @dev with the system, advertise device to user-space * and start normal device operation. @dev must be allocated via drm_dev_alloc() - * previously. + * previously. Right after drm_dev_register() the driver should call + * drm_connector_register_all() to register all connectors in sysfs. This is + * a separate call for backward compatibility with drivers still using + * the deprecated ->load() callback, where connectors are registered from within + * the ->load() callback. * * Never call this twice on any device! * diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 42d9f4d..6a34117 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2214,7 +2214,8 @@ void drm_connector_unregister(struct drm_connector *connector); extern void drm_connector_cleanup(struct drm_connector *connector); extern unsigned int drm_connector_index(struct drm_connector *connector); -/* helper to unregister all connectors from sysfs for device */ +/* helpers to {un}register all connectors from sysfs for device */ +extern int drm_connector_register_all(struct drm_device *dev); extern void drm_connector_unregister_all(struct drm_device *dev); extern int drm_bridge_add(struct drm_bridge *bridge); -- 2.5.0
Re: [PATCH v2 3/6] x86/mtrr: Fix Xorg crashes in Qemu sessions
On Tue, Mar 22, 2016 at 03:53:30PM -0600, Toshi Kani wrote: > Yes. I had to remove this number since checkpatch complained that I needed > to quote the whole patch tile again. I will ignore this checkpatch error > and add this commit number here. Actually, checkpatch is right. We do quote the commit IDs *together* with their names so that the reader knows which commit the text is talking about. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
regmap: mmio: regression in pre-v4.6-rc1
Hi, I'm currently trying to get PCIe working on LS1021A (little-endian ARM). For link-detection I need access to a syscon perpheral (SCFG) which is attched to CPU as big-endian. The corresponding DT part is: scfg: scfg@157 { compatible = "fsl,ls1021a-scfg", "syscon"; reg = <0x0 0x157 0x0 0x1>; big-endian; }; Based on current linus's master (a24e3d414e59ac765, "Merge branch 'akpm' (patches from Andrew)") I noticed the access is actually done as little-endian. I could track it down to commit 922a9f936e40001f ("regmap: mmio: Convert to regmap_bus and fix accessor usage"). Reverting it, the access is fine now and I get my PCIe link. Best regards, Alexander
Re: [PATCH v2 2/6] x86/mm/pat: Add pat_disable() interface
On Tue, Mar 22, 2016 at 03:40:45PM -0600, Toshi Kani wrote: > Will change to "Prevent the OS from initializing the PAT MSR". > > I wanted to clarify that "disable" does not mean to disable PAT MSR. How do you "disable PAT MSR" ? I think you're overdocumenting this. pat_disable() is as clear as day what it does. It doesn't need any commenting... > I've run checkpatch.pl and thought it was OK to have this warning (instead > of a >80 warning) since the error message part was not split. The > "attempting" part is for debugging and its string is passed from the > caller. We always put the quoted strings on a single line for easier grepping. Forget the 80-cols rule. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
Re: Delete flush cache all in arm64 platform.
Hi Mark & Laura On 2016/3/21 23:58, Laura Abbott wrote: > On 03/21/2016 03:08 AM, Mark Rutland wrote: >> [adding LAKML] >> >> On Mon, Mar 21, 2016 at 04:07:47PM +0800, Chen Feng wrote: >>> Hi Mark, >> >> Hi, >> >>> With 68234df4ea7939f98431aa81113fbdce10c4a84b >>> arm64: kill flush_cache_all() >>> The documented semantics of flush_cache_all are not possible to provide >>> for arm64 (short of flushing the entire physical address space by VA), >>> and there are currently no users; KVM uses VA maintenance exclusively, >>> cpu_reset is never called, and the only two users outside of arch code >>> cannot be built for arm64. >>> >>> While cpu_soft_reset and related functions (which call flush_cache_all) >>> were thought to be useful for kexec, their current implementations only >>> serve to mask bugs. For correctness kexec will need to perform >>> maintenance by VA anyway to account for system caches, line migration, >>> and other subtleties of the cache architecture. As the extent of this >>> cache maintenance will be kexec-specific, it should probably live in the >>> kexec code. >>> >>> This patch removes flush_cache_all, and related unused components, >>> preventing further abuse. >>> >>> >>> This patch delete the flush_cache_all interface. >> >> As the patch states, it does so because the documented semantics are >> impossible to provide, as there is no portable mechanism to "flush" all >> caches in the system. >> >> Set/Way operations cannot guarantee that data has been cleaned to the >> PoC (i.e. memory), or invalidated from all levels of cache. Reasons >> include: >> >> * They may race against background behaviour of the CPU (e.g. >>speculation), which may allocate/evict/migrate lines. Depending on the >>cache topology, this may "hide" lines from subsequent Set/Way >>operations. >> >> * They are not broadcast, and do not affect other CPUs. Depending on the >>implemented cache coherency protocols, other CPUs may be able to >>acquire dirty lines, or retain lines in shared states, and hence these >>may not be operated on. >> >> * They do not affect system caches (which respect cache maintenance by >>VA in ARMv8-A). >> >> The only portable mechanism to perform cache maintenance to all relevant >> caches is by VA. >> >>> But if we use VA to flush cache to do cache-coherency with other >>> master(eg:gpu) >>> >>> We must iterate over the sg-list to flush by va to pa. >>> >>> In this way, the iterate of sg-list may cost too much time(sg-table to >>> sg-list) if the sglist is too long. Take a look at the >>> ion_pages_sync_for_device in ion. >>> >>> The driver(eg: ION) need to use this interface(flush cache all) to >>> *improve the efficiency*. >> >> As above, we cannot use Set/Way operations for this, and cannot provide >> a flush_cache_all interface. >> >> I'm not sure what to suggest regarding improving efficiency. >> >> Is walking the sglist the expensive portion, or is the problem the cost >> of multiple page-size operations (each with their own barriers)? >> > > Last time I looked at this, it was mostly the multiple page-size operations. > Ion buffers can be big and easily bigger than the cache as well so flushing > 8MB of buffer for a 2MB cache is really a performance killer. The Set/Way > operations are an improvement on systems where they can be used. > > The way Ion does cache maintenance is full of sadness and despair in general. > Until everything gets a significant rework, the best option may be > minimization of code paths where cache operations are called. > Thanks for your share. Think about the low-mem scene, there are only 4k pages in system. If the ION buffer is 8MB or bigger, the sglist is very long. for_each_sg(sgl, sg, ret, i) be took too much time. Laura, >the best option may be > minimization of code paths where cache operations are called. I am confused with the above comments. The buffer size is used by camera, the frame size may be just so bigger. Do you have any method for improve this? Thanks very much. >> Thanks, >> Mark. >> > > Thanks, > Laura > > . >
[PATCH v5] iio: potentiometer: add driver for Microchip MCP413X/414X/415X/416X/423X/424X/425X/426X
The following functionalities are supported: - write, read from volatile memory Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22060b.pdf Signed-off-by: Slawomir Stepien --- Changes since v4: - Added necessary include files and sorted all includes - Added missing mutex unlock when there is CMDERR - mcp4131_write_raw spi_write/mutex_unlock/return refactor Changes since v3: - Added 'potentiometer' to subject - Replaced mcp4131_exec with spi_write and mcp4131_read - Narrowed mutex locking and unlocking places Changes since v2: - Removed unnecessary parentheses in MCP4131_WIPER_SHIFT macro - Replaced the rx and tx SPI buffers with one buf that is cacheline_aligned - Changed mutex locking position - Replaced the devid with pointer to model configuration - Removed positive ("Registered" & "Unregistered") dev_info prints - Removed the mcp4131_remove callback Changes since v1: - One line summary changed - Fixed module name and OF compatible - Based code on Peter Rosin's code from mcp4531.c - No additional sysfs attributes - Deleted not used devid struct memeber - Changed mcp4131_exec function arguments: - write value is now u16 - no need to pass return buffer array - rx array from mcp4131_data is used - Added missing new line characters to dev_info --- .../bindings/iio/potentiometer/mcp4131.txt | 84 drivers/iio/potentiometer/Kconfig | 18 + drivers/iio/potentiometer/Makefile | 1 + drivers/iio/potentiometer/mcp4131.c| 494 + 4 files changed, 597 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/potentiometer/mcp4131.txt create mode 100644 drivers/iio/potentiometer/mcp4131.c diff --git a/Documentation/devicetree/bindings/iio/potentiometer/mcp4131.txt b/Documentation/devicetree/bindings/iio/potentiometer/mcp4131.txt new file mode 100644 index 000..3ccba16 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/potentiometer/mcp4131.txt @@ -0,0 +1,84 @@ +* Microchip MCP413X/414X/415X/416X/423X/424X/425X/426X Digital Potentiometer + driver + +The node for this driver must be a child node of a SPI controller, hence +all mandatory properties described in + +Documentation/devicetree/bindings/spi/spi-bus.txt + +must be specified. + +Required properties: + - compatible: Must be one of the following, depending on the + model: + "microchip,mcp4131-502" + "microchip,mcp4131-103" + "microchip,mcp4131-503" + "microchip,mcp4131-104" + "microchip,mcp4132-502" + "microchip,mcp4132-103" + "microchip,mcp4132-503" + "microchip,mcp4132-104" + "microchip,mcp4141-502" + "microchip,mcp4141-103" + "microchip,mcp4141-503" + "microchip,mcp4141-104" + "microchip,mcp4142-502" + "microchip,mcp4142-103" + "microchip,mcp4142-503" + "microchip,mcp4142-104" + "microchip,mcp4151-502" + "microchip,mcp4151-103" + "microchip,mcp4151-503" + "microchip,mcp4151-104" + "microchip,mcp4152-502" + "microchip,mcp4152-103" + "microchip,mcp4152-503" + "microchip,mcp4152-104" + "microchip,mcp4161-502" + "microchip,mcp4161-103" + "microchip,mcp4161-503" + "microchip,mcp4161-104" + "microchip,mcp4162-502" + "microchip,mcp4162-103" + "microchip,mcp4162-503" + "microchip,mcp4162-104" + "microchip,mcp4231-502" + "microchip,mcp4231-103" + "microchip,mcp4231-503" + "microchip,mcp4231-104" + "microchip,mcp4232-502" + "microchip,mcp4232-103" + "microchip,mcp4232-503" + "microchip,mcp4232-104" + "microchip,mcp4241-502" + "microchip,mcp4241-103" + "microchip,mcp4241-503" + "microchip,mcp4241-104" + "microchip,mcp4242-502" + "microchip,mcp4242-103" + "microchip,mcp4242-503" + "microchip,mcp4242-104" + "microchip,mcp4251-502" + "microchip,mcp4251-103" + "microchip,mcp4251-503" + "microchip,mcp4251-104" + "microchip,mcp4252-502" +
[PATCH] Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250")
From: Yegor Yefremov When in half-duplex mode RX will be disabled before TX, but not enabled after deactivating transmitter. This patch enables UART_IER_RLSI and UART_IER_RDI interrupts after TX is over. Cc: Matwey V. Kornilov Signed-off-by: Yegor Yefremov --- drivers/tty/serial/8250/8250_port.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index e213da0..00ad263 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p) /* * Empty the RX FIFO, we are not interested in anything * received during the half-duplex transmission. +* Enable previously disabled RX interrupts. */ - if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) + if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) { serial8250_clear_fifos(p); + + serial8250_rpm_get(p); + + p->ier |= UART_IER_RLSI | UART_IER_RDI; + serial_port_out(&p->port, UART_IER, p->ier); + + serial8250_rpm_put(p); + } } static void serial8250_em485_handle_stop_tx(unsigned long arg) -- 2.1.4
[PATCH v5 19/20] x86, kaslr: Allow random address to be below loaded address
Now new randomized output can only be chosen from regions above loaded address. In this case, for bootloaders like kexec which always loads kernel near the end of ram, it doesn't do randomization at all. Or kernel is loaded in a very big starting address, we should not give up that area is loaded in a very large address, then the area below the large loaded address will be given up. This is not reasonable. With correct tracking in mem_avoid we can allow random output below loaded address. With this change, though kexec can get random ouput below its loaded address of kernel. Now we just pick 512M as min_addr. If kernel loaded address is bigger than 512M, E.g 8G. Then [512M, 8G) can be added into random output candidate area. Signed-off-by: Yinghai Lu --- v4->v5: Kees suggested changing the code comment related to minimum address to make it more understandable. arch/x86/boot/compressed/aslr.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index ddfc3d0..bbd2d06 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c @@ -446,7 +446,8 @@ void choose_kernel_location(unsigned char *input, unsigned long output_size, unsigned char **virt_offset) { - unsigned long random; + unsigned long random, min_addr; + *virt_offset = (unsigned char *)LOAD_PHYSICAL_ADDR; #ifdef CONFIG_HIBERNATION @@ -467,8 +468,13 @@ void choose_kernel_location(unsigned char *input, mem_avoid_init((unsigned long)input, input_size, (unsigned long)*output); + /* Lower minimum to 512M. */ + min_addr = (unsigned long)*output; + if (min_addr > (512UL<<20)) + min_addr = 512UL<<20; + /* Walk e820 and find a random address. */ - random = find_random_phy_addr((unsigned long)*output, output_size); + random = find_random_phy_addr(min_addr, output_size); if (!random) debug_putstr("KASLR could not find suitable E820 region...\n"); else { -- 2.5.0
Re: [PATCH 1/4 v3] drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()
On Wed, 23 Mar 2016 11:42:54 +0300 Alexey Brodkin wrote: > Current name is a bit misleading because what that helper function > really does it calls drm_connector_unregister() for all connectors. > > This all has nothing to do with hotplugging so let's name things > properly. > > And while at it remove potentially dangerous locking around > drm_connector_unregister() in rcar_du_remove() as mentioned > in kerneldoc for drm_connector_unregister_all(). > > Signed-off-by: Alexey Brodkin > Cc: Daniel Vetter > Cc: David Airlie > Cc: Boris Brezillon Acked-by: Boris Brezillon > Cc: linux-renesas-...@vger.kernel.org > Acked-by: Laurent Pinchart > --- > > Changes v2 -> v3: > * Updated title with capital after colon > * Updated kerneldoc description of drm_connector_unregister_all() >so that it will match description of register_all() to be introduced >in the next change > * Added ack from Laurent > > Changes v1 -> v2: > * This patch was only introduced in v2. > > drivers/gpu/drm/drm_crtc.c| 18 +- > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 + > drivers/gpu/drm/udl/udl_drv.c | 2 +- > include/drm/drm_crtc.h| 4 ++-- > 4 files changed, 13 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 65258ac..65488a6 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -1080,25 +1080,25 @@ void drm_connector_unregister(struct drm_connector > *connector) > } > EXPORT_SYMBOL(drm_connector_unregister); > > - > /** > - * drm_connector_unplug_all - unregister connector userspace interfaces > + * drm_connector_unregister_all - unregister connector userspace interfaces > * @dev: drm device > * > - * This function unregisters all connector userspace interfaces in sysfs. > Should > - * be call when the device is disconnected, e.g. from an usb driver's > - * ->disconnect callback. > + * This functions unregisters all connectors from sysfs and other places so > + * that userspace can no longer access them. Drivers should call this as the > + * first step tearing down the device instace, or when the underlying > + * physical device disappeared (e.g. USB unplug), right before calling > + * drm_dev_unregister(). > */ > -void drm_connector_unplug_all(struct drm_device *dev) > +void drm_connector_unregister_all(struct drm_device *dev) > { > struct drm_connector *connector; > > /* FIXME: taking the mode config mutex ends up in a clash with sysfs */ > - list_for_each_entry(connector, &dev->mode_config.connector_list, head) > + drm_for_each_connector(connector, dev) > drm_connector_unregister(connector); > - > } > -EXPORT_SYMBOL(drm_connector_unplug_all); > +EXPORT_SYMBOL(drm_connector_unregister_all); > > /** > * drm_encoder_init - Init a preallocated encoder > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > index ed6006b..644db36 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > @@ -278,10 +278,7 @@ static int rcar_du_remove(struct platform_device *pdev) > struct rcar_du_device *rcdu = platform_get_drvdata(pdev); > struct drm_device *ddev = rcdu->ddev; > > - mutex_lock(&ddev->mode_config.mutex); > - drm_connector_unplug_all(ddev); > - mutex_unlock(&ddev->mode_config.mutex); > - > + drm_connector_unregister_all(ddev); > drm_dev_unregister(ddev); > > if (rcdu->fbdev) > diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c > index 772ec9e..c204089 100644 > --- a/drivers/gpu/drm/udl/udl_drv.c > +++ b/drivers/gpu/drm/udl/udl_drv.c > @@ -94,7 +94,7 @@ static void udl_usb_disconnect(struct usb_interface > *interface) > struct drm_device *dev = usb_get_intfdata(interface); > > drm_kms_helper_poll_disable(dev); > - drm_connector_unplug_all(dev); > + drm_connector_unregister_all(dev); > udl_fbdev_unplug(dev); > udl_drop_usb(dev); > drm_unplug_dev(dev); > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index 8c7fb3d..42d9f4d 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -2214,8 +2214,8 @@ void drm_connector_unregister(struct drm_connector > *connector); > > extern void drm_connector_cleanup(struct drm_connector *connector); > extern unsigned int drm_connector_index(struct drm_connector *connector); > -/* helper to unplug all connectors from sysfs for device */ > -extern void drm_connector_unplug_all(struct drm_device *dev); > +/* helper to unregister all connectors from sysfs for device */ > +extern void drm_connector_unregister_all(struct drm_device *dev); > > extern int drm_bridge_add(struct drm_bridge *bridge); > extern void drm_bridge_remove(struct drm_bridge *bridge); -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[PATCH 2/2] irqchip/mbigen:Change the config option of mbigen driver to non-configurable
From: Ma Jun This config is selected by CONFIG_ARCH_HISI, So we change this config to non-configurable. I also adjust the mbigen config position try to sort the configs in alphabetical order. Signed-off-by: Ma Jun --- drivers/irqchip/Kconfig | 14 ++ 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 7e8c441..3e12479 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -32,14 +32,6 @@ config ARM_GIC_V3_ITS bool select PCI_MSI_IRQ_DOMAIN -config HISILICON_IRQ_MBIGEN - bool "Support mbigen interrupt controller" - default n - depends on ARM_GIC_V3 && ARM_GIC_V3_ITS && GENERIC_MSI_IRQ_DOMAIN - help -Enable the mbigen interrupt controller used on -Hisilicon platform. - config ARM_NVIC bool select IRQ_DOMAIN @@ -114,6 +106,12 @@ config DW_APB_ICTL select GENERIC_IRQ_CHIP select IRQ_DOMAIN +config HISILICON_IRQ_MBIGEN + bool + select ARM_GIC_V3 + select ARM_GIC_V3_ITS + select GENERIC_MSI_IRQ_DOMAIN + config IMGPDC_IRQ bool select GENERIC_IRQ_CHIP -- 1.7.1
[PATCH 0/2] Change the the config option of mbigen driver.
From: Ma Jun In current driver, the config of mbigen driver is a configurable option and have nothing to do with CONFIG_ARCH_HISI. As a module of Hisilicon SOC, the config of mbigen driver should be selected by CONFIG_ARCH_HISI on Hisilicon platform, but not a configurable option. This patch set is applied to fix this problem. Ma Jun (2): ARM64: Enable mbigen interrupt controller on Hisilicon platform irqchip/mbigen:Change the config option of mbigen driver to non-configurable arch/arm64/Kconfig.platforms |1 + drivers/irqchip/Kconfig | 14 ++ 2 files changed, 7 insertions(+), 8 deletions(-)
[PATCH 1/2]ARM64: Enable mbigen interrupt controller on Hisilicon platform
From: Ma Jun As a interrupt controller used on some of hisilicon SOCs(660,1610 etc.), mbigen driver should be enabled when CONFIG_ARCH_HISI is enabled. Signed-off-by: Ma Jun --- arch/arm64/Kconfig.platforms |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 21074f6..fdfd526 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -37,6 +37,7 @@ config ARCH_LAYERSCAPE config ARCH_HISI bool "Hisilicon SoC Family" + select HISILICON_IRQ_MBIGEN help This enables support for Hisilicon ARMv8 SoC family -- 1.7.1
RE: [PATCH] mpt3sas: Don't overreach ioc->reply_post[] during initialization
Hi, Please consider this patch as Ack-by: Chaitra P B Thanks, Chaitra -Original Message- From: Martin K. Petersen [mailto:martin.peter...@oracle.com] Sent: Tuesday, March 22, 2016 6:00 AM To: Calvin Owens Cc: Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; James E.J. Bottomley; Martin K. Petersen; mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-t...@fb.com; Sreekanth Reddy Subject: Re: [PATCH] mpt3sas: Don't overreach ioc->reply_post[] during initialization > "Calvin" == Calvin Owens writes: Calvin> In _base_make_ioc_operational(), we walk ioc->reply_queue_list Calvin> and pull a pointer out of successive elements of Calvin> ioc->reply_post[] for each entry in that list if RDPQ is Calvin> enabled. Calvin> Since the code pulls the pointer for the next iteration at the Calvin> bottom of the loop, it triggers the a KASAN dump on the final Calvin> iteration: Broadcom folks, please review. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 1/5] perf core: Introduce new ioctl options to pause and resume ring buffer
On Mon, Mar 14, 2016 at 09:59:41AM +, Wang Nan wrote: > Add new ioctl() to pause/resume ring-buffer output. > > In some situations we want to read from ring buffer only when we > ensure nothing can write to the ring buffer during reading. Without > this patch we have to turn off all events attached to this ring buffer > to achieve this. > > This patch is for supporting overwrite ring buffer. Following > commits will introduce new methods support reading from overwrite ring > buffer. Before reading caller must ensure the ring buffer is frozen, or > the reading is unreliable. > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index 1afe962..a3c1903 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -401,6 +401,7 @@ struct perf_event_attr { > #define PERF_EVENT_IOC_SET_FILTER_IOW('$', 6, char *) > #define PERF_EVENT_IOC_ID_IOR('$', 7, __u64 *) > #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32) > +#define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) Can you also do a patch to the man-pages? http://man7.org/linux/man-pages/man2/perf_event_open.2.html Michael and Vince (who has so far been stellar in composing all that) might be able to point you to the 'right' resources for that.
Re: [PATCH 2/2 v5] irqchip/Layerscape: Add SCFG MSI controller support
On Monday 07 March 2016 11:36:22, Minghuan Lian wrote: > Some kind of NXP Layerscape SoC provides a MSI > implementation which uses two SCFG registers MSIIR and > MSIR to support 32 MSI interrupts for each PCIe controller. > The patch is to support it. > > Signed-off-by: Minghuan Lian Tested-by: Alexander Stein Using an intel e1000e card which uses 3 MSIs. But the IRQ numbers are a bit strange though: > grep eth3 /proc/interrupts > > 63: 49 0 MSI 134742016 Edge eth3-rx-0 > 64: 3 0 MSI 134742017 Edge eth3-tx-0 > 65: 4 0 MSI 134742018 Edge eth3 Best regards, Alexander
Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async
On Wed 2016-03-23 10:24:43, Sergey Senozhatsky wrote: > On (03/22/16 17:36), Petr Mladek wrote: > > > - /* cpu currently holding logbuf_lock in this function */ > > > - static unsigned int logbuf_cpu = UINT_MAX; > > > + bool in_panic = console_loglevel == CONSOLE_LOGLEVEL_MOTORMOUTH; > > > > I am just looking at the printk in NMI patchset and I will need to > > deal with the panic state as well. I am not sure if this detection > > is secure. > > > > This console level is set also by kdb_show_stack() > > and kdb_dumpregs(). I am not sure how this kdb stuff works > > and if it affects normal kernel but... > > > > Anyway, it seems that many locations detects the panic situation > > via the variable oops_in_progress. It has another advantage > > that it can be easily checked and we would not need any extra > > variable here. > > oops_in_progress is not my favorite global. and we can't rely on it > in async printk. > > in panic() we have > > console_verbose(); > bust_spinlocks(1); << sets to one > > pr_emerg("Kernel panic - not syncing: %s\n", buf); > smp_send_stop(); > > bust_spinlocks(0); << sets it back to zero > > console_flush_on_panic(); > > there are several issues here. > - first, panic_cpu does not see oops_in_progress right after > bust_spinlocks(0). > thus all printk issued from panic_cpu can go via async printk. I though that it actually could be an advantage. console_verbore() is called also by oops_begin() and it does not need to be fatal. But you are right that it does not need to be the righ approach. > - second, smp_send_stop() does not guarantee that all of the CPUs received > STOP IPI by the time it returns. on some platforms (ARM, for instance) > smp_send_stop() Good to know. > so I wanted to have in printk some panic indication that once set never > gets cleared. my proposal was > > void console_panic(void) > { > printk_sync = false; > } Great idea. I think that we want to call this in panic() instead of in vprintk_emit(). I mean that we should change the global flag only when we are really going down. Best Regards, Petr
[PATCH] ARCv2: Additional trace IRQs to support locking correctness validator
Flags should be saved in the same format in which clri instruction saves them since they are passed directly to seti instruction over arch_local_save_flags/arch_local_irq_restore calls. Trace of all clri/seti assembly calls is added to support locking correctness validator properly. With this patch it is possible to use locking correctness framework which did stop itself due to incomplete support. Locking tests are also became available and work propely. Signed-off-by: Evgeny Voevodin --- arch/arc/include/asm/irqflags-arcv2.h | 31 ++- arch/arc/kernel/entry-arcv2.S | 14 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/arch/arc/include/asm/irqflags-arcv2.h b/arch/arc/include/asm/irqflags-arcv2.h index 37c2f75..bb17044 100644 --- a/arch/arc/include/asm/irqflags-arcv2.h +++ b/arch/arc/include/asm/irqflags-arcv2.h @@ -15,8 +15,13 @@ #define STATUS_AD_BIT 19 /* Disable Align chk: core supports non-aligned */ #define STATUS_IE_BIT 31 +/* status32 Bits stored on clri instruction */ +#define CLRI_STATUS_IE_BIT 4 + #define STATUS_AD_MASK (1<
Re: [PATCH 1/5] perf core: Introduce new ioctl options to pause and resume ring buffer
On 2016/3/23 17:16, Peter Zijlstra wrote: On Mon, Mar 14, 2016 at 09:59:41AM +, Wang Nan wrote: Add new ioctl() to pause/resume ring-buffer output. In some situations we want to read from ring buffer only when we ensure nothing can write to the ring buffer during reading. Without this patch we have to turn off all events attached to this ring buffer to achieve this. This patch is for supporting overwrite ring buffer. Following commits will introduce new methods support reading from overwrite ring buffer. Before reading caller must ensure the ring buffer is frozen, or the reading is unreliable. diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 1afe962..a3c1903 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -401,6 +401,7 @@ struct perf_event_attr { #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) #define PERF_EVENT_IOC_SET_BPF_IOW('$', 8, __u32) +#define PERF_EVENT_IOC_PAUSE_OUTPUT_IOW('$', 9, __u32) Glad to see you start to look at this patchset. Can you also do a patch to the man-pages? http://man7.org/linux/man-pages/man2/perf_event_open.2.html Sure. I think I need to provide a patch for: http://git.kernel.org/cgit/docs/man-pages/man-pages.git But which one should be the first? Shall we update man pages before this patch be merged by upstream? Or Michael and Vince will consider this problem? Thank you.
[PATCH] mm/page_alloc: prevent merging between isolated and other pageblocks
Hanjun Guo has reported that a CMA stress test causes broken accounting of CMA and free pages: > Before the test, I got: > -bash-4.3# cat /proc/meminfo | grep Cma > CmaTotal: 204800 kB > CmaFree: 195044 kB > > > After running the test: > -bash-4.3# cat /proc/meminfo | grep Cma > CmaTotal: 204800 kB > CmaFree: 6602584 kB > > So the freed CMA memory is more than total.. > > Also the the MemFree is more than mem total: > > -bash-4.3# cat /proc/meminfo > MemTotal: 16342016 kB > MemFree:22367268 kB > MemAvailable: 22370528 kB Laura Abbott has confirmed the issue and suspected the freepage accounting rewrite around 3.18/4.0 by Joonsoo Kim. Joonsoo had a theory that this is caused by unexpected merging between MIGRATE_ISOLATE and MIGRATE_CMA pageblocks: > CMA isolates MAX_ORDER aligned blocks, but, during the process, > partialy isolated block exists. If MAX_ORDER is 11 and > pageblock_order is 9, two pageblocks make up MAX_ORDER > aligned block and I can think following scenario because pageblock > (un)isolation would be done one by one. > > (each character means one pageblock. 'C', 'I' means MIGRATE_CMA, > MIGRATE_ISOLATE, respectively. > > CC -> IC -> II (Isolation) > II -> CI -> CC (Un-isolation) > > If some pages are freed at this intermediate state such as IC or CI, > that page could be merged to the other page that is resident on > different type of pageblock and it will cause wrong freepage count. This was supposed to be prevented by CMA operating on MAX_ORDER blocks, but since it doesn't hold the zone->lock between pageblocks, a race window does exist. It's also likely that unexpected merging can occur between MIGRATE_ISOLATE and non-CMA pageblocks. This should be prevented in __free_one_page() since commit 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock"). However, we only check the migratetype of the pageblock where buddy merging has been initiated, not the migratetype of the buddy pageblock (or group of pageblocks) which can be MIGRATE_ISOLATE. Joonsoo has suggested checking for buddy migratetype as part of page_is_buddy(), but that would add extra checks in allocator hotpath and bloat-o-meter has shown significant code bloat (the function is inline). This patch reduces the bloat at some expense of more complicated code. The buddy-merging while-loop in __free_one_page() is initially bounded to pageblock_border and without any migratetype checks. The checks are placed outside, bumping the max_order if merging is allowed, and returning to the while-loop with a statement which can't be possibly considered harmful. This fixes the accounting bug and also removes the arguably weird state in the original commit 3c605096d315 where buddies could be left unmerged. Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock") Link: https://lkml.org/lkml/2016/3/2/280 Reported-by: Hanjun Guo Debugged-by: Laura Abbott Debugged-by: Joonsoo Kim Cc: Mel Gorman Cc: "Kirill A. Shutemov" Cc: Johannes Weiner Cc: Minchan Kim Cc: Yasuaki Ishimatsu Cc: Zhang Yanfei Cc: Michal Nazarewicz Cc: Naoya Horiguchi Cc: "Aneesh Kumar K.V" Cc: # v3.18+ Signed-off-by: Vlastimil Babka --- mm/page_alloc.c | 46 +- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c46b75d14b6f..b9785af4fae2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -683,34 +683,28 @@ static inline void __free_one_page(struct page *page, unsigned long combined_idx; unsigned long uninitialized_var(buddy_idx); struct page *buddy; - unsigned int max_order = MAX_ORDER; + unsigned int max_order; + + max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); VM_BUG_ON(!zone_is_initialized(zone)); VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page); VM_BUG_ON(migratetype == -1); - if (is_migrate_isolate(migratetype)) { - /* -* We restrict max order of merging to prevent merge -* between freepages on isolate pageblock and normal -* pageblock. Without this, pageblock isolation -* could cause incorrect freepage accounting. -*/ - max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); - } else { + if (likely(!is_migrate_isolate(migratetype))) __mod_zone_freepage_state(zone, 1 << order, migratetype); - } - page_idx = pfn & ((1 << max_order) - 1); + page_idx = pfn & ((1 << MAX_ORDER) - 1); VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); VM_BUG_ON_PAGE(bad_range(zone, page), page); +continue_merging: while (order < max_order - 1) { buddy_idx = __find_buddy_index(page_idx, order); buddy = page + (buddy_idx - page_idx);
Re: regmap: mmio: regression in pre-v4.6-rc1
On Wednesday 23 March 2016 09:48:42, Alexander Stein wrote: > I'm currently trying to get PCIe working on LS1021A (little-endian ARM). For > link-detection I need access to a syscon perpheral (SCFG) which is attched to > CPU as big-endian. > The corresponding DT part is: > > scfg: scfg@157 { > compatible = "fsl,ls1021a-scfg", "syscon"; > reg = <0x0 0x157 0x0 0x1>; > big-endian; > }; > > Based on current linus's master (a24e3d414e59ac765, "Merge branch 'akpm' > (patches from Andrew)") I noticed the access is actually done as > little-endian. > I could track it down to commit 922a9f936e40001f ("regmap: mmio: Convert to > regmap_bus and fix accessor usage"). Reverting it, the access is fine now and > I get my PCIe link. Just for the records, this also affects spi-fsl-dspi which is also attached in big-endian. Best regards, Alexander
Re: [PATCH 3/5] perf core: Prepare writing into ring buffer from end
On Mon, Mar 14, 2016 at 09:59:43AM +, Wang Nan wrote: > Convert perf_output_begin to __perf_output_begin and make the later > function able to write records from the end of the ring buffer. > Following commits will utilize the 'backward' flag. > > This patch doesn't introduce any extra performance overhead since we > use always_inline. So while I agree that with __always_inline and constant propagation we _should_ end up with the same code, we have: $ size defconfig-build/kernel/events/ring_buffer.o.{pre,post} textdata bss dec hex filename 3785 2 03787 ecb defconfig-build/kernel/events/ring_buffer.o.pre 3673 2 03675 e5b defconfig-build/kernel/events/ring_buffer.o.post The patch actually makes the file shrink. So I think we still want to have some actual performance numbers.
Re: [PATCH 1/5] perf core: Introduce new ioctl options to pause and resume ring buffer
On Wed, Mar 23, 2016 at 05:33:53PM +0800, Wangnan (F) wrote: > Glad to see you start to look at this patchset. My brain is completely fried from staring at fuzzer output for weeks, I just need to do _something_, _anything_ else for a while :-)
[PATCH] sbs-battery: fix power status when battery is dry
When the battery is dry and BATTERY_FULL_DISCHARGED is set, we should check BATTERY_DISCHARGING to decide the power status. If BATTERY_DISCHARGING is set, the power status is not charging. Or the power status should be charging. Signed-off-by: YH Huang --- drivers/power/sbs-battery.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c index d6226d6..d86db0e 100644 --- a/drivers/power/sbs-battery.c +++ b/drivers/power/sbs-battery.c @@ -382,11 +382,12 @@ static int sbs_get_battery_property(struct i2c_client *client, if (ret & BATTERY_FULL_CHARGED) val->intval = POWER_SUPPLY_STATUS_FULL; - else if (ret & BATTERY_FULL_DISCHARGED) - val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; - else if (ret & BATTERY_DISCHARGING) - val->intval = POWER_SUPPLY_STATUS_DISCHARGING; - else + else if (ret & BATTERY_DISCHARGING) { + if (ret & BATTERY_FULL_DISCHARGED) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; + else + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; + } else val->intval = POWER_SUPPLY_STATUS_CHARGING; if (chip->poll_time == 0) @@ -702,11 +703,12 @@ static void sbs_delayed_work(struct work_struct *work) if (ret & BATTERY_FULL_CHARGED) ret = POWER_SUPPLY_STATUS_FULL; - else if (ret & BATTERY_FULL_DISCHARGED) - ret = POWER_SUPPLY_STATUS_NOT_CHARGING; - else if (ret & BATTERY_DISCHARGING) - ret = POWER_SUPPLY_STATUS_DISCHARGING; - else + else if (ret & BATTERY_DISCHARGING) { + if (ret & BATTERY_FULL_DISCHARGED) + ret = POWER_SUPPLY_STATUS_NOT_CHARGING; + else + ret = POWER_SUPPLY_STATUS_DISCHARGING; + } else ret = POWER_SUPPLY_STATUS_CHARGING; if (chip->last_state != ret) { -- 1.7.9.5
Re: [PATCH V2 0/2] kexec: Make a pair of map/unmap reserved pages in error path
On 2016/03/23 at 16:23, Baoquan He wrote: > On 03/23/16 at 11:32am, Xunlei Pang wrote: >> On 2016/03/23 at 10:48, Baoquan He wrote: >>> On 03/01/16 at 05:53pm, Xunlei Pang wrote: This is a bug fix. After this, I will try to do a cleanup for crash_unmap/map_reserved_pages() (only used by S390) to consolidate it with arch_kexec_unprotect/protect_crashkres(). >>> Hi Xunlei, Minfei, >>> >>> I think you need discuss together about how to do clean up codes in this >>> place. From my point of view, arch_map/unmap_reserved_pages and >>> arch_kexec_protect/unprotect_crashkres() are for the same goal but by >>> different ways on different arch. So for Xunlei's patchset, you might >>> need to rethink your implementation, the name of function. I personally >>> think you just implement a x86 specific arch_map/unmap_reserved_pages. >>> It may need a more generic name, and then add your x86 arch specific >>> implementation. Sorry I can't see your patches on my mail client, >> Like what you said, I think arch_kexec_unprotect/protect_crashkres() are >> generic enough, but any other better name is welcome :-) >> >> It also covered the newly-added kexec file path, and we can easily transfer >> arch_map/unmap_reserved_pages into this new interface. > I don't know the status of your patchset. If possible I think the 1st > patch in your patchset shoule rename arch_map/unmap_reserved_pages to > arch_kexec_protect/unprotect_crashkres, 2nd patch is to add your x86 > specific patch. Yes, actually when I filed my patchset, I didn't notice arch_map/unmap_reserved_pages, too much back then, s390 is its only user, and hard to get the purpose from its name. But from other point of view, they are a bit different, crash_map_reserved_pages() is also called by crash_shrink_memory(), it is a bit more complex(and needs some s390 arch code modification) than just simply renaming/consolidating them, so I think it's ok to provide a new generic mechanism first and then put renaming/consolidating arch work back a little as a separate patch. Regards, Xunlei > >> I was planning doing that, but sick recently, I will try to send a patch >> doing that later. > Yeah, totally understand. This is not urgent, please take care of > yourself. > >> Regards, >> Xunlei >> >>> Xunlei. Since Andrew asked, I just checked these. >>> >>> I am fine with Minfei's patch 1/2. But for patch 2/2, it's a little >>> comfortable to me. Is it really necessary to abstract code block from >>> kexec_load, then wrap them into a newly added function do_kexec_load()? >>> Without this wrapping is there a way to do your bug fix? Is there >>> possibility that do_kexec_load will be called in other places? What's >>> the benefit to wrap it into do_kexec_load against not wrapping? >>> >>> Thanks >>> Baoquan >>> Regards, Xunlei On 03/01/2016 at 04:02 PM, Minfei Huang wrote: > v1: > - Bisect the patch according to Andrew Morton's suggestion > > Minfei Huang (2): > kexec: Make a pair of map/unmap reserved pages in error path > kexec: Do a cleanup for function kexec_load > > kernel/kexec.c | 112 > - > 1 file changed, 63 insertions(+), 49 deletions(-) > ___ kexec mailing list ke...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec >> >> ___ >> kexec mailing list >> ke...@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/kexec
[PATCH] net: ping: make ping_v6_sendmsg static
As ping_v6_sendmsg is used only in this file, making it static The body of "pingv6_prot" and "pingv6_protosw" were moved at the middle of the file, to avoid having to declare some static prototypes. Signed-off-by: Haishuang Yan --- include/net/ping.h | 1 - net/ipv6/ping.c| 59 +++--- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/include/net/ping.h b/include/net/ping.h index 5fd7cc2..4cd90d6 100644 --- a/include/net/ping.h +++ b/include/net/ping.h @@ -79,7 +79,6 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len); int ping_common_sendmsg(int family, struct msghdr *msg, size_t len, void *user_icmph, size_t icmph_len); -int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); bool ping_rcv(struct sk_buff *skb); diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 263a516..c382db7 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c @@ -26,35 +26,6 @@ #include #include -struct proto pingv6_prot = { - .name = "PINGv6", - .owner =THIS_MODULE, - .init = ping_init_sock, - .close =ping_close, - .connect = ip6_datagram_connect_v6_only, - .disconnect = udp_disconnect, - .setsockopt = ipv6_setsockopt, - .getsockopt = ipv6_getsockopt, - .sendmsg = ping_v6_sendmsg, - .recvmsg = ping_recvmsg, - .bind = ping_bind, - .backlog_rcv = ping_queue_rcv_skb, - .hash = ping_hash, - .unhash = ping_unhash, - .get_port = ping_get_port, - .obj_size = sizeof(struct raw6_sock), -}; -EXPORT_SYMBOL_GPL(pingv6_prot); - -static struct inet_protosw pingv6_protosw = { - .type = SOCK_DGRAM, - .protocol = IPPROTO_ICMPV6, - .prot = &pingv6_prot, - .ops = &inet6_dgram_ops, - .flags = INET_PROTOSW_REUSE, -}; - - /* Compatibility glue so we can support IPv6 when it's compiled as a module */ static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) @@ -77,7 +48,7 @@ static int dummy_ipv6_chk_addr(struct net *net, const struct in6_addr *addr, return 0; } -int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) +static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); @@ -192,6 +163,34 @@ int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) return len; } +struct proto pingv6_prot = { + .name = "PINGv6", + .owner =THIS_MODULE, + .init = ping_init_sock, + .close =ping_close, + .connect = ip6_datagram_connect_v6_only, + .disconnect = udp_disconnect, + .setsockopt = ipv6_setsockopt, + .getsockopt = ipv6_getsockopt, + .sendmsg = ping_v6_sendmsg, + .recvmsg = ping_recvmsg, + .bind = ping_bind, + .backlog_rcv = ping_queue_rcv_skb, + .hash = ping_hash, + .unhash = ping_unhash, + .get_port = ping_get_port, + .obj_size = sizeof(struct raw6_sock), +}; +EXPORT_SYMBOL_GPL(pingv6_prot); + +static struct inet_protosw pingv6_protosw = { + .type = SOCK_DGRAM, + .protocol = IPPROTO_ICMPV6, + .prot = &pingv6_prot, + .ops = &inet6_dgram_ops, + .flags = INET_PROTOSW_REUSE, +}; + #ifdef CONFIG_PROC_FS static void *ping_v6_seq_start(struct seq_file *seq, loff_t *pos) { -- 1.8.3.1
Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async
On Wed 2016-03-23 09:37:25, Sergey Senozhatsky wrote: > Hello Petr, > > On (03/22/16 14:11), Petr Mladek wrote: > > > + * Set printing_func() sleep condition early, under the @logbuf_lock. > > > + * So printing kthread (if RUNNING) will go to console_lock() and spin > > > + * on @logbuf_lock. > > > + */ > > > + if (!printk_sync) > > > + need_flush_console = true; > > > > We set this variable for each call and also when printk_kthread is > > NULL or when sync_printk is false. > > hm, yes. (printk_kthread && !need_flush_console) makes more sense. > so we it doesn't get re-dirty if already set. This does not solve the problem mentioned below. There still might be extra cycle if the kthread is inside console_unclock(). > > We migth want to clear it also from console_unlock(). I think that > > a good place would be in the check: > > > > raw_spin_lock(&logbuf_lock); > > retry = console_seq != log_next_seq; > > raw_spin_unlock_irqrestore(&logbuf_lock, flags); > > hm, what's wrong with clearing it in printk_kthread printing function? I though about the following scenario: CPU0CPU1 vprintk_emit() need_flush_console = true; wake_up_process(printk_thread) printing_func() need_flush_console = false; console_lock() console_unlock() vprintk_emit() need_flush_console = true; # flush 1st message # flush 2nd message if (!need_flush_console) # fails and continues console_lock() console_unlock() # nope because 2nd # message already flushed if (!need_flush_console) schedule() # did one unnecessary # cycle to get asleep Best Regards, Petr PS: If you touch the code, please rename printing_func() to printk_kthread_func() to make it more clear what it does. I am sorry for nitpicking.
Re: [PATCH 5/5] perf core: Reduce perf event output overhead by new overflow handler
On Mon, Mar 14, 2016 at 09:59:45AM +, Wang Nan wrote: > By creating onward and backward specific overflow handlers and setting > them according to event's backward setting, normal sampling events > don't need checking backward setting of an event any more. The normal antonym of backward is forward. Onward does not indicate a direction per se, its more a continuance or progression of a previously set goal. Also, just squash these last two patches together.
Re: [PATCH 3/5] perf core: Prepare writing into ring buffer from end
On 2016/3/23 17:50, Peter Zijlstra wrote: On Mon, Mar 14, 2016 at 09:59:43AM +, Wang Nan wrote: Convert perf_output_begin to __perf_output_begin and make the later function able to write records from the end of the ring buffer. Following commits will utilize the 'backward' flag. This patch doesn't introduce any extra performance overhead since we use always_inline. So while I agree that with __always_inline and constant propagation we _should_ end up with the same code, we have: $ size defconfig-build/kernel/events/ring_buffer.o.{pre,post} textdata bss dec hex filename 3785 2 03787 ecb defconfig-build/kernel/events/ring_buffer.o.pre 3673 2 03675 e5b defconfig-build/kernel/events/ring_buffer.o.post The patch actually makes the file shrink. So I think we still want to have some actual performance numbers. There are some numbers. You can find them from: http://lkml.iu.edu/hypermail/linux/kernel/1601.2/03966.html Thank you.
Re: [PATCH v12 08/29] HMM: add device page fault support v6.
On Wed, Mar 23, 2016 at 12:22:23PM +0530, Aneesh Kumar K.V wrote: > Jérôme Glisse writes: > > > [ text/plain ] > > This patch add helper for device page fault. Thus helpers will fill > > the mirror page table using the CPU page table and synchronizing > > with any update to CPU page table. > > > > Changed since v1: > > - Add comment about directory lock. > > > > Changed since v2: > > - Check for mirror->hmm in hmm_mirror_fault() > > > > Changed since v3: > > - Adapt to HMM page table changes. > > > > Changed since v4: > > - Fix PROT_NONE, ie do not populate from protnone pte. > > - Fix huge pmd handling (start address may != pmd start address) > > - Fix missing entry case. > > > > Signed-off-by: Jérôme Glisse > > Signed-off-by: Sherry Cheung > > Signed-off-by: Subhash Gutti > > Signed-off-by: Mark Hairgrove > > Signed-off-by: John Hubbard > > Signed-off-by: Jatin Kumar > > --- > > > > > > +static int hmm_mirror_fault_hpmd(struct hmm_mirror *mirror, > > +struct hmm_event *event, > > +struct vm_area_struct *vma, > > +struct hmm_pt_iter *iter, > > +pmd_t *pmdp, > > +struct hmm_mirror_fault *mirror_fault, > > +unsigned long start, > > +unsigned long end) > > +{ > > + struct page *page; > > + unsigned long addr, pfn; > > + unsigned flags = FOLL_TOUCH; > > + spinlock_t *ptl; > > + int ret; > > + > > + ptl = pmd_lock(mirror->hmm->mm, pmdp); > > + if (unlikely(!pmd_trans_huge(*pmdp))) { > > + spin_unlock(ptl); > > + return -EAGAIN; > > + } > > + flags |= event->etype == HMM_DEVICE_WFAULT ? FOLL_WRITE : 0; > > + page = follow_trans_huge_pmd(vma, start, pmdp, flags); > > + pfn = page_to_pfn(page); > > + spin_unlock(ptl); > > + > > + /* Just fault in the whole PMD. */ > > + start &= PMD_MASK; > > + end = start + PMD_SIZE - 1; > > + > > + if (!pmd_write(*pmdp) && event->etype == HMM_DEVICE_WFAULT) > > + return -ENOENT; > > + > > + for (ret = 0, addr = start; !ret && addr < end;) { > > + unsigned long i, next = end; > > + dma_addr_t *hmm_pte; > > + > > + hmm_pte = hmm_pt_iter_populate(iter, addr, &next); > > + if (!hmm_pte) > > + return -ENOMEM; > > + > > + i = hmm_pt_index(&mirror->pt, addr, mirror->pt.llevel); > > + > > + /* > > +* The directory lock protect against concurrent clearing of > > +* page table bit flags. Exceptions being the dirty bit and > > +* the device driver private flags. > > +*/ > > + hmm_pt_iter_directory_lock(iter); > > + do { > > + if (!hmm_pte_test_valid_pfn(&hmm_pte[i])) { > > + hmm_pte[i] = hmm_pte_from_pfn(pfn); > > + hmm_pt_iter_directory_ref(iter); > > I looked at that and it is actually > static inline void hmm_pt_iter_directory_ref(struct hmm_pt_iter *iter) > { > BUG_ON(!iter->ptd[iter->pt->llevel - 1]); > hmm_pt_directory_ref(iter->pt, iter->ptd[iter->pt->llevel - 1]); > } > > static inline void hmm_pt_directory_ref(struct hmm_pt *pt, > struct page *ptd) > { > if (!atomic_inc_not_zero(&ptd->_mapcount)) > /* Illegal this should not happen. */ > BUG(); > } > > what is the mapcount update about ? Unlike regular CPU page table we do not rely on unmap to prune HMM mirror page table. Rather we free/prune it aggressively once the device no longer have anything mirror in a given range. As such mapcount is use to keep track of any many valid entry there is per directory. Moreover mapcount is also use to protect from concurrent pruning when you walk through the page table you increment refcount by one along your way. When you done walking you decrement refcount. Because of that last aspect, the mapcount can never reach zero because we unmap page, it can only reach zero once we cleanup the page table walk. > > > + } > > + BUG_ON(hmm_pte_pfn(hmm_pte[i]) != pfn); > > + if (pmd_write(*pmdp)) > > + hmm_pte_set_write(&hmm_pte[i]); > > + } while (addr += PAGE_SIZE, pfn++, i++, addr != next); > > + hmm_pt_iter_directory_unlock(iter); > > + mirror_fault->addr = addr; > > + } > > + > > So we don't have huge page mapping in hmm page table ? No we don't right now. First reason is that i wanted to keep things simple for device driver. Second motivation is to keep first patchset simpler especialy the page migration code. Memory overhead is 2MB per GB of virtual memory mirrored. There is no TLB here. I believe adding huge page can be done as part of a latter patchset if it makes sense. Cheers, J
Re: [PATCH] net: phy: at803x: don't depend on GPIOLIB
Hi Uwe, On 03/22/2016 08:42 PM, Uwe Kleine-König wrote: > Hello Sebastian, > > On Tue, Mar 22, 2016 at 03:34:23PM +0100, Sebastian Frias wrote: >> I think we are in a deadlock :-) >> I'm going to reply inline below, but I will also send a different email >> to Daniel with a small recap. >> I think he should share the intent of the "reset" mechanism he >> introduced, in particular if it is mandatory. > > The things I said in my mail are valid in general, not only for the > at803x phy. > > Let me repeat them once more: > > Preconditions: > - Some of the devices a given driver handles have a reset line and >others don't. > - A non-empty subset (maybe all) of the devices that have a reset line >require that this reset line is used. > > Then the way to handle this in the driver should be done as follows: > > unless reset_handling_not_necessary(): > gpio = gpiod_get_optional("reset") > if IS_ERR(gpio): > return PTR_ERR(gpio) > > Checking for -ENOSYS or GPIOLIB=n is not allowed because the device > you're currently handling might need the GPIO, so you must not continue > without the ability to control the line. > > So the options you have (as you have a phy that doesn't need the reset > handling): > > - enable GPIOLIB (either in your .config or introduce a Kconfig >dependency) > - improve reset_handling_not_necessary() to return true for your case > I will see if I can "improve reset_handling_not_necessary() to return true". Best regards, Sebastian
[PATCH v4 02/23] ncr5380: Remove FLAG_NO_PSEUDO_DMA where possible
Drivers that define PSEUDO_DMA also define NCR5380_dma_xfer_len. The core driver must call NCR5380_dma_xfer_len which means FLAG_NO_PSEUDO_DMA can be eradicated from the core driver. dmx3191d doesn't define PSEUDO_DMA and has no use for FLAG_NO_PSEUDO_DMA, so remove it there also. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c |3 +-- drivers/scsi/dmx3191d.c |2 +- drivers/scsi/g_NCR5380.c |7 ++- drivers/scsi/g_NCR5380.h |2 +- drivers/scsi/mac_scsi.c | 15 ++- 5 files changed, 23 insertions(+), 6 deletions(-) Index: linux/drivers/scsi/dmx3191d.c === --- linux.orig/drivers/scsi/dmx3191d.c 2016-03-23 21:05:16.0 +1100 +++ linux/drivers/scsi/dmx3191d.c 2016-03-23 21:09:20.0 +1100 @@ -93,7 +93,7 @@ static int dmx3191d_probe_one(struct pci */ shost->irq = NO_IRQ; - error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA); + error = NCR5380_init(shost, 0); if (error) goto out_host_put; Index: linux/drivers/scsi/mac_scsi.c === --- linux.orig/drivers/scsi/mac_scsi.c 2016-03-23 21:05:16.0 +1100 +++ linux/drivers/scsi/mac_scsi.c 2016-03-23 21:09:20.0 +1100 @@ -37,7 +37,9 @@ #define NCR5380_pread macscsi_pread #define NCR5380_pwrite macscsi_pwrite -#define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) + +#define NCR5380_dma_xfer_len(instance, cmd, phase) \ +macscsi_dma_xfer_len(instance, cmd) #define NCR5380_intrmacscsi_intr #define NCR5380_queue_command macscsi_queue_command @@ -303,6 +305,17 @@ static int macscsi_pwrite(struct Scsi_Ho } #endif +static int macscsi_dma_xfer_len(struct Scsi_Host *instance, +struct scsi_cmnd *cmd) +{ + struct NCR5380_hostdata *hostdata = shost_priv(instance); + + if (hostdata->flags & FLAG_NO_PSEUDO_DMA) + return 0; + + return cmd->transfersize; +} + #include "NCR5380.c" #define DRV_MODULE_NAME "mac_scsi" Index: linux/drivers/scsi/g_NCR5380.c === --- linux.orig/drivers/scsi/g_NCR5380.c 2016-03-23 21:09:19.0 +1100 +++ linux/drivers/scsi/g_NCR5380.c 2016-03-23 21:09:20.0 +1100 @@ -712,10 +712,15 @@ static inline int NCR5380_pwrite(struct return 0; } -static int generic_NCR5380_dma_xfer_len(struct scsi_cmnd *cmd) +static int generic_NCR5380_dma_xfer_len(struct Scsi_Host *instance, +struct scsi_cmnd *cmd) { + struct NCR5380_hostdata *hostdata = shost_priv(instance); int transfersize = cmd->transfersize; + if (hostdata->flags & FLAG_NO_PSEUDO_DMA) + return 0; + /* Limit transfers to 32K, for xx400 & xx406 * pseudoDMA that transfers in 128 bytes blocks. */ Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:19.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:20.0 +1100 @@ -1833,8 +1833,7 @@ static void NCR5380_information_transfer #if defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) transfersize = 0; - if (!cmd->device->borken && - !(hostdata->flags & FLAG_NO_PSEUDO_DMA)) + if (!cmd->device->borken) transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); if (transfersize) { Index: linux/drivers/scsi/g_NCR5380.h === --- linux.orig/drivers/scsi/g_NCR5380.h 2016-03-23 21:09:19.0 +1100 +++ linux/drivers/scsi/g_NCR5380.h 2016-03-23 21:09:20.0 +1100 @@ -61,7 +61,7 @@ #endif #define NCR5380_dma_xfer_len(instance, cmd, phase) \ -generic_NCR5380_dma_xfer_len(cmd) +generic_NCR5380_dma_xfer_len(instance, cmd) #define NCR5380_intr generic_NCR5380_intr #define NCR5380_queue_command generic_NCR5380_queue_command
[PATCH v4 04/23] atari_NCR5380: Remove DMA_MIN_SIZE macro
Only the atari_scsi and sun3_scsi drivers define DMA_MIN_SIZE. Both drivers also define NCR5380_dma_xfer_len, which means DMA_MIN_SIZE can be removed from the core driver. This removes another discrepancy between the two core drivers. Signed-off-by: Finn Thain Tested-by: Michael Schmitz Reviewed-by: Hannes Reinecke --- Changes since v1: - Retain MIN_DMA_SIZE macro in wrapper drivers. --- drivers/scsi/atari_NCR5380.c | 16 drivers/scsi/atari_scsi.c|6 +- drivers/scsi/sun3_scsi.c | 19 +-- 3 files changed, 22 insertions(+), 19 deletions(-) Index: linux/drivers/scsi/atari_NCR5380.c === --- linux.orig/drivers/scsi/atari_NCR5380.c 2016-03-23 21:09:22.0 +1100 +++ linux/drivers/scsi/atari_NCR5380.c 2016-03-23 21:09:24.0 +1100 @@ -1857,12 +1857,11 @@ static void NCR5380_information_transfer d = cmd->SCp.ptr; } /* this command setup for dma yet? */ - if ((count >= DMA_MIN_SIZE) && (sun3_dma_setup_done != cmd)) { - if (cmd->request->cmd_type == REQ_TYPE_FS) { - sun3scsi_dma_setup(instance, d, count, - rq_data_dir(cmd->request)); - sun3_dma_setup_done = cmd; - } + if (sun3_dma_setup_done != cmd && + sun3scsi_dma_xfer_len(count, cmd) > 0) { + sun3scsi_dma_setup(instance, d, count, + rq_data_dir(cmd->request)); + sun3_dma_setup_done = cmd; } #ifdef SUN3_SCSI_VME dregs->csr |= CSR_INTR; @@ -1927,7 +1926,7 @@ static void NCR5380_information_transfer #endif transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); - if (transfersize >= DMA_MIN_SIZE) { + if (transfersize > 0) { len = transfersize; cmd->SCp.phase = phase; if (NCR5380_transfer_dma(instance, &phase, @@ -2366,7 +2365,8 @@ static void NCR5380_reselect(struct Scsi d = tmp->SCp.ptr; } /* setup this command for dma if not already */ - if ((count >= DMA_MIN_SIZE) && (sun3_dma_setup_done != tmp)) { + if (sun3_dma_setup_done != tmp && + sun3scsi_dma_xfer_len(count, tmp) > 0) { sun3scsi_dma_setup(instance, d, count, rq_data_dir(tmp->request)); sun3_dma_setup_done = tmp; Index: linux/drivers/scsi/atari_scsi.c === --- linux.orig/drivers/scsi/atari_scsi.c2016-03-23 21:09:22.0 +1100 +++ linux/drivers/scsi/atari_scsi.c 2016-03-23 21:09:24.0 +1100 @@ -83,11 +83,12 @@ #include +#define DMA_MIN_SIZE32 + /* Definitions for the core NCR5380 driver. */ #define SUPPORT_TAGS #define MAX_TAGS32 -#define DMA_MIN_SIZE32 #define NCR5380_implementation_fields /* none */ @@ -605,6 +606,9 @@ static unsigned long atari_dma_xfer_len( { unsigned long possible_len, limit; + if (wanted_len < DMA_MIN_SIZE) + return 0; + if (IS_A_TT()) /* TT SCSI DMA can transfer arbitrary #bytes */ return wanted_len; Index: linux/drivers/scsi/sun3_scsi.c === --- linux.orig/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:22.0 +1100 +++ linux/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:24.0 +1100 @@ -36,12 +36,12 @@ #include #include "sun3_scsi.h" -/* Definitions for the core NCR5380 driver. */ - -/* #define SUPPORT_TAGS */ /* minimum number of bytes to do dma on */ #define DMA_MIN_SIZE129 +/* Definitions for the core NCR5380 driver. */ + +/* #define SUPPORT_TAGS */ /* #define MAX_TAGS 32 */ #define NCR5380_implementation_fields /* none */ @@ -61,7 +61,7 @@ #define NCR5380_dma_residual(instance) \ sun3scsi_dma_residual(instance) #define NCR5380_dma_xfer_len(instance, cmd, phase) \ -sun3scsi_dma_xfer_len(cmd->SCp.this_residual, cmd, !((phase) & SR_IO)) +sun3scsi_dma_xfer_len(cmd->SCp.this_residual, cmd) #define NCR5380_acquire_dma_i
[PATCH v4 15/23] dmx3191d: Drop max_sectors limit
The dmx3191d driver is not capable of DMA or PDMA so all transfers use PIO. Now that large slow PIO transfers periodically stop and call cond_resched(), the max_sectors limit can go away. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- drivers/scsi/dmx3191d.c |1 - 1 file changed, 1 deletion(-) Index: linux/drivers/scsi/dmx3191d.c === --- linux.orig/drivers/scsi/dmx3191d.c 2016-03-23 21:09:47.0 +1100 +++ linux/drivers/scsi/dmx3191d.c 2016-03-23 21:09:57.0 +1100 @@ -67,7 +67,6 @@ static struct scsi_host_template dmx3191 .cmd_per_lun= 2, .use_clustering = DISABLE_CLUSTERING, .cmd_size = NCR5380_CMD_SIZE, - .max_sectors= 128, }; static int dmx3191d_probe_one(struct pci_dev *pdev,
[PATCH v4 20/23] atari_scsi: Set a reasonable default for cmd_per_lun
This setting does not need to be conditional on Atari ST or TT. Signed-off-by: Finn Thain Tested-by: Michael Schmitz Reviewed-by: Hannes Reinecke --- Changed since v1: - Set the default cmd_per_lun to 4 based on test results. Changed since v2: - Revert the default cmd_per_lun to 2, like in the v1 patch, because a uniform default across all ten 5380 wrapper drivers is worth more than a tiny improvement in one particular microbenchmark on one system. Michael tells me that 2 is also the best setting for his Atari Falcon. --- drivers/scsi/atari_scsi.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: linux/drivers/scsi/atari_scsi.c === --- linux.orig/drivers/scsi/atari_scsi.c2016-03-23 21:09:53.0 +1100 +++ linux/drivers/scsi/atari_scsi.c 2016-03-23 21:10:03.0 +1100 @@ -752,6 +752,7 @@ static struct scsi_host_template atari_s .eh_abort_handler = atari_scsi_abort, .eh_bus_reset_handler = atari_scsi_bus_reset, .this_id= 7, + .cmd_per_lun= 2, .use_clustering = DISABLE_CLUSTERING, .cmd_size = NCR5380_CMD_SIZE, }; @@ -788,11 +789,9 @@ static int __init atari_scsi_probe(struc */ if (ATARIHW_PRESENT(TT_SCSI)) { atari_scsi_template.can_queue= 16; - atari_scsi_template.cmd_per_lun = 8; atari_scsi_template.sg_tablesize = SG_ALL; } else { atari_scsi_template.can_queue= 8; - atari_scsi_template.cmd_per_lun = 1; atari_scsi_template.sg_tablesize = SG_NONE; }
[PATCH v4 17/23] ncr5380: Remove remaining register storage qualifiers
Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:57.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:59.0 +1100 @@ -1555,9 +1555,9 @@ static int NCR5380_transfer_dma(struct S unsigned char **data) { struct NCR5380_hostdata *hostdata = shost_priv(instance); - register int c = *count; - register unsigned char p = *phase; - register unsigned char *d = *data; + int c = *count; + unsigned char p = *phase; + unsigned char *d = *data; unsigned char tmp; int result = 0;
[PATCH v4 18/23] ncr5380: Remove DONT_USE_INTR and AUTOPROBE_IRQ macros
Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 12 +--- drivers/scsi/NCR5380.h |4 drivers/scsi/arm/oak.c |2 -- drivers/scsi/dmx3191d.c |2 -- drivers/scsi/dtc.c | 12 +++- drivers/scsi/g_NCR5380.c |2 -- drivers/scsi/pas16.c |1 - drivers/scsi/t128.c |1 - 8 files changed, 4 insertions(+), 32 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:59.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:10:00.0 +1100 @@ -106,9 +106,6 @@ * DIFFERENTIAL - if defined, NCR53c81 chips will use external differential * transceivers. * - * DONT_USE_INTR - if defined, never use interrupts, even if we probe or - * override-configure an IRQ. - * * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. * * REAL_DMA - if defined, REAL DMA is used during the data transfer phases. @@ -464,9 +461,6 @@ static void prepare_info(struct Scsi_Hos hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "", hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "", -#ifdef AUTOPROBE_IRQ -"AUTOPROBE_IRQ " -#endif #ifdef DIFFERENTIAL "DIFFERENTIAL " #endif @@ -915,8 +909,6 @@ static void NCR5380_dma_complete(struct } } -#ifndef DONT_USE_INTR - /** * NCR5380_intr - generic NCR5380 irq handler * @irq: interrupt number @@ -951,7 +943,7 @@ static void NCR5380_dma_complete(struct * the Busy Monitor interrupt is enabled together with DMA Mode. */ -static irqreturn_t NCR5380_intr(int irq, void *dev_id) +static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) { struct Scsi_Host *instance = dev_id; struct NCR5380_hostdata *hostdata = shost_priv(instance); @@ -1020,8 +1012,6 @@ static irqreturn_t NCR5380_intr(int irq, return IRQ_RETVAL(handled); } -#endif - /* * Function : int NCR5380_select(struct Scsi_Host *instance, * struct scsi_cmnd *cmd) Index: linux/drivers/scsi/NCR5380.h === --- linux.orig/drivers/scsi/NCR5380.h 2016-03-23 21:09:53.0 +1100 +++ linux/drivers/scsi/NCR5380.h2016-03-23 21:10:00.0 +1100 @@ -280,16 +280,12 @@ static void NCR5380_print(struct Scsi_Ho #define NCR5380_dprint_phase(flg, arg) do {} while (0) #endif -#if defined(AUTOPROBE_IRQ) static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible); -#endif static int NCR5380_init(struct Scsi_Host *instance, int flags); static int NCR5380_maybe_reset_bus(struct Scsi_Host *); static void NCR5380_exit(struct Scsi_Host *instance); static void NCR5380_information_transfer(struct Scsi_Host *instance); -#ifndef DONT_USE_INTR static irqreturn_t NCR5380_intr(int irq, void *dev_id); -#endif static void NCR5380_main(struct work_struct *work); static const char *NCR5380_info(struct Scsi_Host *instance); static void NCR5380_reselect(struct Scsi_Host *instance); Index: linux/drivers/scsi/arm/oak.c === --- linux.orig/drivers/scsi/arm/oak.c 2016-03-23 21:09:47.0 +1100 +++ linux/drivers/scsi/arm/oak.c2016-03-23 21:10:00.0 +1100 @@ -14,8 +14,6 @@ #include -#define DONT_USE_INTR - #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) #define NCR5380_read(reg) \ Index: linux/drivers/scsi/dmx3191d.c === --- linux.orig/drivers/scsi/dmx3191d.c 2016-03-23 21:09:57.0 +1100 +++ linux/drivers/scsi/dmx3191d.c 2016-03-23 21:10:00.0 +1100 @@ -34,8 +34,6 @@ * Definitions for the generic 5380 driver. */ -#define DONT_USE_INTR - #define NCR5380_read(reg) inb(instance->io_port + reg) #define NCR5380_write(reg, value) outb(value, instance->io_port + reg) Index: linux/drivers/scsi/dtc.c === --- linux.orig/drivers/scsi/dtc.c 2016-03-23 21:09:47.0 +1100 +++ linux/drivers/scsi/dtc.c2016-03-23 21:10:00.0 +1100 @@ -1,5 +1,3 @@ -#define DONT_USE_INTR - /* * DTC 3180/3280 driver, by * Ray Van Tassle ra...@comm.mot.com @@ -53,7 +51,6 @@ #include #include "dtc.h" -#define AUTOPROBE_IRQ #include "NCR5380.h" /* @@ -243,9 +240,10 @@ found: if (instance->irq == 255) instance->irq = NO_IRQ; -#ifndef DONT_USE_INTR /* With interrupts enabled, it will sometimes hang when doing heavy * reads. So better not enable them until I finger it
[PATCH v4 13/23] ncr5380: Remove disused atari_NCR5380.c core driver
Now that atari_scsi and sun3_scsi have been converted to use the NCR5380.c core driver, remove atari_NCR5380.c. Also remove the last vestiges of its Tagged Command Queueing implementation from the wrapper drivers. The TCQ support in atari_NCR5380.c is abandoned by this patch. It is not merged into the remaining core driver because, 1) atari_scsi defines SUPPORT_TAGS but leaves FLAG_TAGGED_QUEUING disabled by default, which indicates that it is mostly undesirable. 2) I'm told that it doesn't work correctly when enabled. 3) The algorithm does not make use of block layer tags which it will have to do because scmd->tag is deprecated. 4) sun3_scsi doesn't define SUPPORT_TAGS at all, yet the the SUPPORT_TAGS macro interacts with the CONFIG_SUN3 macro in 'interesting' ways. 5) Compile-time configuration with macros like SUPPORT_TAGS caused the configuration space to explode, leading to untestable and unmaintainable code that is too hard to reason about. The merge_contiguous_buffers() code is also abandoned. This was unused by sun3_scsi. Only atari_scsi used it and then only on TT, because only TT supports scatter/gather. I suspect that the TT would work fine with ENABLE_CLUSTERING instead. If someone can benchmark the difference then perhaps the merge_contiguous_buffers() code can be be justified. Until then we are better off without the extra complexity. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 22 drivers/scsi/NCR5380.h | 19 drivers/scsi/atari_NCR5380.c | 2632 --- drivers/scsi/atari_scsi.c| 11 drivers/scsi/mac_scsi.c |8 drivers/scsi/sun3_scsi.c | 11 6 files changed, 4 insertions(+), 2699 deletions(-) Index: linux/drivers/scsi/atari_scsi.c === --- linux.orig/drivers/scsi/atari_scsi.c2016-03-23 21:09:51.0 +1100 +++ linux/drivers/scsi/atari_scsi.c 2016-03-23 21:09:53.0 +1100 @@ -87,9 +87,6 @@ /* Definitions for the core NCR5380 driver. */ -#define SUPPORT_TAGS -#define MAX_TAGS32 - #define NCR5380_implementation_fields /* none */ #define NCR5380_read(reg) atari_scsi_reg_read(reg) @@ -189,8 +186,6 @@ static int setup_cmd_per_lun = -1; module_param(setup_cmd_per_lun, int, 0); static int setup_sg_tablesize = -1; module_param(setup_sg_tablesize, int, 0); -static int setup_use_tagged_queuing = -1; -module_param(setup_use_tagged_queuing, int, 0); static int setup_hostid = -1; module_param(setup_hostid, int, 0); static int setup_toshiba_delay = -1; @@ -479,8 +474,7 @@ static int __init atari_scsi_setup(char setup_sg_tablesize = ints[3]; if (ints[0] >= 4) setup_hostid = ints[4]; - if (ints[0] >= 5) - setup_use_tagged_queuing = ints[5]; + /* ints[5] (use_tagged_queuing) is ignored */ /* ints[6] (use_pdma) is ignored */ if (ints[0] >= 7) setup_toshiba_delay = ints[7]; @@ -853,9 +847,6 @@ static int __init atari_scsi_probe(struc instance->irq = irq->start; host_flags |= IS_A_TT() ? 0 : FLAG_LATE_DMA_SETUP; -#ifdef SUPPORT_TAGS - host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0; -#endif host_flags |= setup_toshiba_delay > 0 ? FLAG_TOSHIBA_DELAY : 0; error = NCR5380_init(instance, host_flags); Index: linux/drivers/scsi/sun3_scsi.c === --- linux.orig/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:52.0 +1100 +++ linux/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:53.0 +1100 @@ -41,9 +41,6 @@ /* Definitions for the core NCR5380 driver. */ -/* #define SUPPORT_TAGS */ -/* #define MAX_TAGS 32 */ - #define NCR5380_implementation_fields /* none */ #define NCR5380_read(reg) sun3scsi_read(reg) @@ -75,10 +72,6 @@ static int setup_cmd_per_lun = -1; module_param(setup_cmd_per_lun, int, 0); static int setup_sg_tablesize = -1; module_param(setup_sg_tablesize, int, 0); -#ifdef SUPPORT_TAGS -static int setup_use_tagged_queuing = -1; -module_param(setup_use_tagged_queuing, int, 0); -#endif static int setup_hostid = -1; module_param(setup_hostid, int, 0); @@ -512,10 +505,6 @@ static int __init sun3_scsi_probe(struct instance->io_port = (unsigned long)ioaddr; instance->irq = irq->start; -#ifdef SUPPORT_TAGS - host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0; -#endif - error = NCR5380_init(instance, host_flags); if (error) goto fail_init; Index: linux/drivers/scsi/mac_scsi.c === --- linux.orig/drivers/scsi/mac_scsi.c 2016-03-23 21:09:47.0 +1100 +++ linux/drivers/scsi/mac_scsi.c
[PATCH v4 22/23] mac_scsi: Fix pseudo DMA implementation
Fix various issues: Comments about bus errors are incorrect. The PDMA asm must return the size of the memory access that faulted so the transfer count can be adjusted accordingly. A phase change may cause a bus error but should not be treated as failure. A bus error does not always imply a phase change and generally the transfer may continue. Scatter/gather doesn't seem to work with PDMA due to overruns. This is a pity because peak throughput seems to double with SG_ALL. Tested on a Mac LC III and a PowerBook 520. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- Changed since v1: - Set the default cmd_per_lun to 4 based on test results. Changed since v2: - Revert the default cmd_per_lun to 2, like in the v1 patch, because a uniform default across all ten 5380 wrapper drivers is worth more than a tiny improvement in one particular microbenchmark on one system. - Add 'reviewed-by' tag. --- drivers/scsi/NCR5380.h |2 drivers/scsi/mac_scsi.c | 210 ++-- 2 files changed, 118 insertions(+), 94 deletions(-) Index: linux/drivers/scsi/mac_scsi.c === --- linux.orig/drivers/scsi/mac_scsi.c 2016-03-23 21:09:53.0 +1100 +++ linux/drivers/scsi/mac_scsi.c 2016-03-23 21:10:05.0 +1100 @@ -28,7 +28,8 @@ /* Definitions for the core NCR5380 driver. */ -#define NCR5380_implementation_fields unsigned char *pdma_base +#define NCR5380_implementation_fields unsigned char *pdma_base; \ +int pdma_residual #define NCR5380_read(reg) macscsi_read(instance, reg) #define NCR5380_write(reg, value) macscsi_write(instance, reg, value) @@ -37,7 +38,7 @@ macscsi_dma_xfer_len(instance, cmd) #define NCR5380_dma_recv_setup macscsi_pread #define NCR5380_dma_send_setup macscsi_pwrite -#define NCR5380_dma_residual(instance) (0) +#define NCR5380_dma_residual(instance) (hostdata->pdma_residual) #define NCR5380_intrmacscsi_intr #define NCR5380_queue_command macscsi_queue_command @@ -104,18 +105,9 @@ static int __init mac_scsi_setup(char *s __setup("mac5380=", mac_scsi_setup); #endif /* !MODULE */ -/* - Pseudo-DMA: (Ove Edlund) - The code attempts to catch bus errors that occur if one for example - "trips over the cable". - XXX: Since bus errors in the PDMA routines never happen on my - computer, the bus error code is untested. - If the code works as intended, a bus error results in Pseudo-DMA - being disabled, meaning that the driver switches to slow handshake. - If bus errors are NOT extremely rare, this has to be changed. -*/ +/* Pseudo DMA asm originally by Ove Edlund */ -#define CP_IO_TO_MEM(s,d,len) \ +#define CP_IO_TO_MEM(s,d,n)\ __asm__ __volatile__ \ ("cmp.w #4,%2\n" \ "bls8f\n" \ @@ -152,61 +144,73 @@ __asm__ __volatile__ \ " 9: \n" \ ".section .fixup,\"ax\"\n"\ ".even\n" \ - "90: moveq.l #1, %2\n"\ + "91: moveq.l #1, %2\n"\ + "jra 9b\n"\ + "94: moveq.l #4, %2\n"\ "jra 9b\n"\ ".previous\n" \ ".section __ex_table,\"a\"\n" \ " .align 4\n" \ - " .long 1b,90b\n" \ - " .long 3b,90b\n" \ - " .long 31b,90b\n" \ - " .long 32b,90b\n" \ - " .long 33b,90b\n" \ - " .long 34b,90b\n" \ - " .long 35b,90b\n" \ - " .long 36b,90b\n" \ - " .long 37b,90b\n" \ - " .long 5b,90b\n" \ - " .long 7b,90b\n" \ + " .long 1b,91b\n" \ + " .long 3b,94b\n" \ + " .long 31b,94b\n" \ + " .long 32b,94b\n" \ + " .long 33b,94b\n" \ + " .long 34b,94b\n" \ + " .long 35b,94b\n" \ + " .long 36b,94b\n" \ + " .long 37b,94b\n" \ + " .long 5b,94b\n"
Re: Question about PCI I/O space in ARM64
On Wed, Mar 23, 2016 at 11:12:41AM +0800, Kefeng Wang wrote: > If no pci, the PCI I/O space(16M) is mapped into an irrelevant mem > space(right ?), No. It is not mapped at all. > not a right IO space, > that is, no one call pci_remap_iospace() to remap the memory mapped I/O > space, once driver > like f71805f loaded, write value to IO space(see > f71805f_init->f71805f_find->superio_enter->outb), > we met following oops, > > Unable to handle kernel paging request at virtual address ffbffee0002e > pgd = ffc1d68d4000 > [ffbffee0002e] *pgd=, *pud= > Internal error: Oops: 9446 [#1] PREEMPT SMP > Modules linked in: f71805f(+) hwmon > CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88 > Hardware name: linux,dummy-virt (DT) > task: ffc1f6665400 ti: ffc1d6418000 task.ti: ffc1d6418000 > PC is at f71805f_find+0x6c/0x358 [f71805f] > That's caused by not having a mapped PCI I/O space. > I am not clear about PCI I/O, but if this is indeed a bug, how to solve this > issue, > any advice will be appreciated. You need a PCI host controller driver (e.g. drivers/pci/host/pci-host-generic.c) and corresponding bindings in DT or ACPI. -- Catalin
[PATCH v4 16/23] ncr5380: Fix register decoding for debugging
Decode all bits in the chip registers. They are all useful at times. Fix printk severity so that this output can be suppressed along with the other debugging output. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:56.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:57.0 +1100 @@ -256,12 +256,20 @@ static struct { {0, NULL} }, basrs[] = { + {BASR_END_DMA_TRANSFER, "END OF DMA"}, + {BASR_DRQ, "DRQ"}, + {BASR_PARITY_ERROR, "PARITY ERROR"}, + {BASR_IRQ, "IRQ"}, + {BASR_PHASE_MATCH, "PHASE MATCH"}, + {BASR_BUSY_ERROR, "BUSY ERROR"}, {BASR_ATN, "ATN"}, {BASR_ACK, "ACK"}, {0, NULL} }, icrs[] = { {ICR_ASSERT_RST, "ASSERT RST"}, + {ICR_ARBITRATION_PROGRESS, "ARB. IN PROGRESS"}, + {ICR_ARBITRATION_LOST, "LOST ARB."}, {ICR_ASSERT_ACK, "ASSERT ACK"}, {ICR_ASSERT_BSY, "ASSERT BSY"}, {ICR_ASSERT_SEL, "ASSERT SEL"}, @@ -270,14 +278,14 @@ icrs[] = { {0, NULL} }, mrs[] = { - {MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, - {MR_TARGET, "MODE TARGET"}, - {MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, - {MR_ENABLE_PAR_INTR, "MODE PARITY INTR"}, - {MR_ENABLE_EOP_INTR, "MODE EOP INTR"}, - {MR_MONITOR_BSY, "MODE MONITOR BSY"}, - {MR_DMA_MODE, "MODE DMA"}, - {MR_ARBITRATE, "MODE ARBITRATION"}, + {MR_BLOCK_DMA_MODE, "BLOCK DMA MODE"}, + {MR_TARGET, "TARGET"}, + {MR_ENABLE_PAR_CHECK, "PARITY CHECK"}, + {MR_ENABLE_PAR_INTR, "PARITY INTR"}, + {MR_ENABLE_EOP_INTR, "EOP INTR"}, + {MR_MONITOR_BSY, "MONITOR BSY"}, + {MR_DMA_MODE, "DMA MODE"}, + {MR_ARBITRATE, "ARBITRATE"}, {0, NULL} }; @@ -298,23 +306,23 @@ static void NCR5380_print(struct Scsi_Ho icr = NCR5380_read(INITIATOR_COMMAND_REG); basr = NCR5380_read(BUS_AND_STATUS_REG); - printk("STATUS_REG: %02x ", status); + printk(KERN_DEBUG "SR = 0x%02x : ", status); for (i = 0; signals[i].mask; ++i) if (status & signals[i].mask) - printk(",%s", signals[i].name); - printk("\nBASR: %02x ", basr); + printk(KERN_CONT "%s, ", signals[i].name); + printk(KERN_CONT "\nBASR = 0x%02x : ", basr); for (i = 0; basrs[i].mask; ++i) if (basr & basrs[i].mask) - printk(",%s", basrs[i].name); - printk("\nICR: %02x ", icr); + printk(KERN_CONT "%s, ", basrs[i].name); + printk(KERN_CONT "\nICR = 0x%02x : ", icr); for (i = 0; icrs[i].mask; ++i) if (icr & icrs[i].mask) - printk(",%s", icrs[i].name); - printk("\nMODE: %02x ", mr); + printk(KERN_CONT "%s, ", icrs[i].name); + printk(KERN_CONT "\nMR = 0x%02x : ", mr); for (i = 0; mrs[i].mask; ++i) if (mr & mrs[i].mask) - printk(",%s", mrs[i].name); - printk("\n"); + printk(KERN_CONT "%s, ", mrs[i].name); + printk(KERN_CONT "\n"); } static struct {
[PATCH v4 12/23] sun3_scsi: Adopt NCR5380.c core driver
Add support for the custom Sun 3 DMA logic to the NCR5380.c core driver. This code is copied from atari_NCR5380.c. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- The Sun 3 DMA code is still configured by macros. I have simplified things slightly but I have avoided more ambitious refactoring. It's not clear to me what that should look like and I can't test sun3_scsi anyway. At least this permits the removal of atari_NCR5380.c. --- drivers/scsi/NCR5380.c | 131 +++ drivers/scsi/sun3_scsi.c |8 +- 2 files changed, 124 insertions(+), 15 deletions(-) Index: linux/drivers/scsi/sun3_scsi.c === --- linux.orig/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:24.0 +1100 +++ linux/drivers/scsi/sun3_scsi.c 2016-03-23 21:09:52.0 +1100 @@ -54,10 +54,8 @@ #define NCR5380_abort sun3scsi_abort #define NCR5380_infosun3scsi_info -#define NCR5380_dma_read_setup(instance, data, count) \ -sun3scsi_dma_setup(instance, data, count, 0) -#define NCR5380_dma_write_setup(instance, data, count) \ -sun3scsi_dma_setup(instance, data, count, 1) +#define NCR5380_dma_recv_setup(instance, data, count) (count) +#define NCR5380_dma_send_setup(instance, data, count) (count) #define NCR5380_dma_residual(instance) \ sun3scsi_dma_residual(instance) #define NCR5380_dma_xfer_len(instance, cmd, phase) \ @@ -406,7 +404,7 @@ static int sun3scsi_dma_finish(int write } -#include "atari_NCR5380.c" +#include "NCR5380.c" #ifdef SUN3_SCSI_VME #define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI" Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:51.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:52.0 +1100 @@ -31,6 +31,8 @@ /* Ported to Atari by Roman Hodek and others. */ +/* Adapted for the Sun 3 by Sam Creasey. */ + /* * Further development / testing that should be done : * @@ -858,6 +860,23 @@ static void NCR5380_dma_complete(struct } } +#ifdef CONFIG_SUN3 + if ((sun3scsi_dma_finish(rq_data_dir(hostdata->connected->request { + pr_err("scsi%d: overrun in UDC counter -- not prepared to deal with this!\n", + instance->host_no); + BUG(); + } + + if ((NCR5380_read(BUS_AND_STATUS_REG) & (BASR_PHASE_MATCH | BASR_ACK)) == + (BASR_PHASE_MATCH | BASR_ACK)) { + pr_err("scsi%d: BASR %02x\n", instance->host_no, + NCR5380_read(BUS_AND_STATUS_REG)); + pr_err("scsi%d: bus stuck in data phase -- probably a single byte overrun!\n", + instance->host_no); + BUG(); + } +#endif + NCR5380_write(MODE_REG, MR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_read(RESET_PARITY_INTERRUPT_REG); @@ -981,10 +1000,16 @@ static irqreturn_t NCR5380_intr(int irq, NCR5380_read(RESET_PARITY_INTERRUPT_REG); dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n"); +#ifdef SUN3_SCSI_VME + dregs->csr |= CSR_DMA_ENABLE; +#endif } handled = 1; } else { shost_printk(KERN_NOTICE, instance, "interrupt without IRQ bit\n"); +#ifdef SUN3_SCSI_VME + dregs->csr |= CSR_DMA_ENABLE; +#endif } spin_unlock_irqrestore(&hostdata->lock, flags); @@ -1274,6 +1299,10 @@ static struct scsi_cmnd *NCR5380_select( hostdata->connected = cmd; hostdata->busy[cmd->device->id] |= 1 << cmd->device->lun; +#ifdef SUN3_SCSI_VME + dregs->csr |= CSR_INTR; +#endif + initialize_SCp(cmd); cmd = NULL; @@ -1557,6 +1586,11 @@ static int NCR5380_transfer_dma(struct S dsprintk(NDEBUG_DMA, instance, "initializing DMA %s: length %d, address %p\n", (p & SR_IO) ? "receive" : "send", c, d); +#ifdef CONFIG_SUN3 + /* send start chain */ + sun3scsi_dma_start(c, *data); +#endif + NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p)); NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY | MR_ENABLE_EOP_INTR); @@ -1577,6 +1611,7 @@ static int NCR5380_transfer_dma(struct S */ if (p & SR_IO) { + NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_io_delay(1); NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0); } else { @@ -1587,6 +1622,13 @@ static int NCR5380_transfer_dma(struct S NCR5380_io_delay(1); } +#ifdef CONFIG_SUN3 +#ifdef SUN3_SCSI_VME + dregs->csr |= CSR_DMA_ENABLE; +#endif
[PATCH v4 14/23] ncr5380: Reduce max_lun limit
The driver has a limit of eight LUs because of the byte-sized bitfield that is used for busy flags. That means the maximum LUN is 7. The default is 8. Signed-off-by: Finn Thain Tested-by: Michael Schmitz Tested-by: Ondrej Zary Reviewed-by: Hannes Reinecke --- Changed since v1: - Reduce shost->max_lun limit instead of adding 'MAX_LUN' limit. --- drivers/scsi/NCR5380.c |2 ++ 1 file changed, 2 insertions(+) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:53.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:56.0 +1100 @@ -488,6 +488,8 @@ static int NCR5380_init(struct Scsi_Host int i; unsigned long deadline; + instance->max_lun = 7; + hostdata->host = instance; hostdata->id_mask = 1 << instance->this_id; hostdata->id_higher_mask = 0;
Re: [PATCH] net: phy: at803x: don't depend on GPIOLIB
On 22/03/2016 20:42, Uwe Kleine-König wrote: > Preconditions: > - Some of the devices a given driver handles have a reset line and >others don't. > - A non-empty subset (maybe all) of the devices that have a reset line >require that this reset line is used. > > Then the way to handle this in the driver should be done as follows: > > unless reset_handling_not_necessary(): > gpio = gpiod_get_optional("reset") > if IS_ERR(gpio): > return PTR_ERR(gpio) > > Checking for -ENOSYS or GPIOLIB=n is not allowed because the device > you're currently handling might need the GPIO, so you must not continue > without the ability to control the line. > > So the options you have (as you have a phy that doesn't need the reset > handling): > > - enable GPIOLIB (either in your .config or introduce a Kconfig >dependency) > - improve reset_handling_not_necessary() to return true for your case > > There is nothing else. Here are some numbers for GPIOLIB, on an ARM build: textdata bss dec hex filename 1830 0 01830 726 devres.o 627 0 0 627 273 gpiolib-legacy.o 11018 40 4 110622b36 gpiolib.o 1598 0 01598 63e gpiolib-of.o 15073 40 4 151173b0d built-in.o So ~15 kilobytes. By the way, since the "reset-by-GPIO" solution is used only for the Atheros 8030, would it be possible to make the devm_gpiod_get_optional conditional on ATH8030_PHY_ID? I'm thinking of something along these lines, for illustration: diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 2d020a3ec0b5..576e7873e049 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -198,12 +198,16 @@ static int at803x_probe(struct phy_device *phydev) if (!priv) return -ENOMEM; + if (phydev->drv->phy_id != ATH8030_PHY_ID) + goto no_gpio; + gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(gpiod_reset)) return PTR_ERR(gpiod_reset); priv->gpiod_reset = gpiod_reset; +no_gpio: phydev->priv = priv; return 0; Regards.
[PATCH v4 00/23] ncr5380: Eliminate macros, reduce code duplication, fix bugs etc
This patch series has more macro elimination and some tweaks to the DMA hooks so that all the wrapper drivers can share the same core DMA algorithm. This resolves the major discrepancies between the two core drivers, which relate to code conditional on the REAL_DMA and PSEUDO_DMA macros. After all the wrapper drivers agree on the DMA hook api, the core driver fork gets resolved. NCR5380.c is adopted by atari_scsi and sun3_scsi and atari_NCR5380.c is then deleted. Historically, the 5380 drivers suffered from over-use of conditional compilation, which caused the compile-time configuration space to explode, leading to core driver code that was practically untestable, unmaintainable and difficult to reason about. It also prevented driver modules from sharing object code. Along with REAL_DMA, REAL_DMA_POLL and PSEUDO_DMA, most of the remaining macros are also eradicated, such as CONFIG_SCSI_GENERIC_NCR53C400, SUPPORT_TAGS, DONT_USE_INTR, AUTOPROBE_IRQ and BIOSPARAM. Also in this patch series, some duplicated documentation is removed and the PDMA implementation in mac_scsi finally gets fixed. This patch series has been tested on several platforms. I tested the dmx3191d and mac_scsi modules on suitable hardware, Michael tested atari_scsi on an Atari Falcon and Ondrej has tested g_NCR5380 and g_NCR5380_mmio on various ISA cards. Changes since v1: - Patch 4: don't remove MIN_DMA_SIZE macro from wrapper drivers. - Patch 9: improve commit log entry and add 'Reviewed-by' tag. - Patch 14: reduce shost->max_lun limit instead of adding MAX_LUN limit. - Patches 20 and 22: set the default cmd_per_lun to 4. - For the rest: add 'Reviewed-by' tag. Changes since v2: - Patches 20 and 22: revert the default cmd_per_lun to 2, like the v1 patch series. - Add patch 23 to fix a theoretical bus reset/autosense issue. Changes since v3: - Added 'Tested-by' tags from Ondrej and 'Reviewed-by' tags from Hannes. --- Documentation/scsi/g_NCR5380.txt | 17 Documentation/scsi/scsi-parameters.txt | 11 drivers/scsi/Kconfig | 11 drivers/scsi/NCR5380.c | 659 drivers/scsi/NCR5380.h | 143 - drivers/scsi/arm/cumana_1.c| 25 drivers/scsi/arm/oak.c | 22 drivers/scsi/atari_NCR5380.c | 2676 - drivers/scsi/atari_scsi.c | 144 - drivers/scsi/dmx3191d.c| 10 drivers/scsi/dtc.c | 27 drivers/scsi/dtc.h |7 drivers/scsi/g_NCR5380.c | 143 - drivers/scsi/g_NCR5380.h | 26 drivers/scsi/mac_scsi.c| 239 +- drivers/scsi/pas16.c | 27 drivers/scsi/pas16.h |5 drivers/scsi/sun3_scsi.c | 47 drivers/scsi/t128.c| 19 drivers/scsi/t128.h|7 20 files changed, 634 insertions(+), 3631 deletions(-)
[PATCH v4 23/23] ncr5380: Call complete_cmd() for disconnected commands on bus reset
I'm told that some targets are liable to disconnect a REQUEST SENSE command. Theoretically this would cause a command undergoing autosense to be moved onto the disconnected list. The bus reset handler must call complete_cmd() for these commands, otherwise the hostdata->sensing pointer will not get cleared. That would cause autosense processing to stall and a timeout or an incorrect scsi_eh_restore_cmnd() would eventually follow. Signed-off-by: Finn Thain Reported-by: Michael Schmitz Tested-by: Ondrej Zary Reviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:10:00.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:10:07.0 +1100 @@ -2437,7 +2437,7 @@ static int NCR5380_bus_reset(struct scsi struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); set_host_byte(cmd, DID_RESET); - cmd->scsi_done(cmd); + complete_cmd(instance, cmd); } INIT_LIST_HEAD(&hostdata->disconnected);
[PATCH v4 11/23] atari_scsi: Adopt NCR5380.c core driver
Add support for the Atari ST DMA chip to the NCR5380.c core driver. This code is copied from atari_NCR5380.c. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c| 32 drivers/scsi/atari_scsi.c |6 +++--- 2 files changed, 35 insertions(+), 3 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:47.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:51.0 +1100 @@ -29,6 +29,8 @@ * Ronald van Cuijlenborg, Alan Cox and others. */ +/* Ported to Atari by Roman Hodek and others. */ + /* * Further development / testing that should be done : * @@ -141,6 +143,14 @@ #define NCR5380_io_delay(x) #endif +#ifndef NCR5380_acquire_dma_irq +#define NCR5380_acquire_dma_irq(x) (1) +#endif + +#ifndef NCR5380_release_dma_irq +#define NCR5380_release_dma_irq(x) +#endif + static int do_abort(struct Scsi_Host *); static void do_reset(struct Scsi_Host *); @@ -658,6 +668,9 @@ static int NCR5380_queue_command(struct cmd->result = 0; + if (!NCR5380_acquire_dma_irq(instance)) + return SCSI_MLQUEUE_HOST_BUSY; + spin_lock_irqsave(&hostdata->lock, flags); /* @@ -682,6 +695,19 @@ static int NCR5380_queue_command(struct return 0; } +static inline void maybe_release_dma_irq(struct Scsi_Host *instance) +{ + struct NCR5380_hostdata *hostdata = shost_priv(instance); + + /* Caller does the locking needed to set & test these data atomically */ + if (list_empty(&hostdata->disconnected) && + list_empty(&hostdata->unissued) && + list_empty(&hostdata->autosense) && + !hostdata->connected && + !hostdata->selecting) + NCR5380_release_dma_irq(instance); +} + /** * dequeue_next_cmd - dequeue a command for processing * @instance: the scsi host instance @@ -783,6 +809,7 @@ static void NCR5380_main(struct work_str if (!NCR5380_select(instance, cmd)) { dsprintk(NDEBUG_MAIN, instance, "main: select complete\n"); + maybe_release_dma_irq(instance); } else { dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance, "main: select failed, returning %p to queue\n", cmd); @@ -1828,6 +1855,8 @@ static void NCR5380_information_transfer /* Enable reselect interrupts */ NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); + + maybe_release_dma_irq(instance); return; case MESSAGE_REJECT: /* Accept message by clearing ACK */ @@ -1963,6 +1992,7 @@ static void NCR5380_information_transfer hostdata->connected = NULL; cmd->result = DID_ERROR << 16; complete_cmd(instance, cmd); + maybe_release_dma_irq(instance); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); return; } @@ -2256,6 +2286,7 @@ out: dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd); queue_work(hostdata->work_q, &hostdata->main_task); + maybe_release_dma_irq(instance); spin_unlock_irqrestore(&hostdata->lock, flags); return result; @@ -2336,6 +2367,7 @@ static int NCR5380_bus_reset(struct scsi hostdata->dma_len = 0; queue_work(hostdata->work_q, &hostdata->main_task); + maybe_release_dma_irq(instance); spin_unlock_irqrestore(&hostdata->lock, flags); return SUCCESS; Index: linux/drivers/scsi/atari_scsi.c === --- linux.orig/drivers/scsi/atari_scsi.c2016-03-23 21:09:44.0 +1100 +++ linux/drivers/scsi/atari_scsi.c 2016-03-23 21:09:51.0 +1100 @@ -99,9 +99,9 @@ #define NCR5380_abort atari_scsi_abort #define NCR5380_infoatari_scsi_info -#define NCR5380_dma_read_setup(instance, data, count) \ +#define NCR5380_dma_recv_setup(instance, data, count) \ atari_scsi_dma_setup(instance, data, count, 0) -#define NCR5380_dma_write_setup(instance, data, count) \ +#define NCR5380_dma_send_setup(instance, data, count) \ atari_scsi_dma_setup(instance, data, count, 1) #define NCR5380_dma_residual(instance) \ atari_scsi_dma_residual(instance) @@ -715,7 +715,7 @@
[PATCH v4 19/23] ncr5380: Update usage documentation
Update kernel parameter documentation for atari_scsi, mac_scsi and g_NCR5380 drivers. Remove duplication. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- Documentation/scsi/g_NCR5380.txt | 17 ++- Documentation/scsi/scsi-parameters.txt | 11 +++--- drivers/scsi/g_NCR5380.c | 36 - 3 files changed, 16 insertions(+), 48 deletions(-) Index: linux/Documentation/scsi/scsi-parameters.txt === --- linux.orig/Documentation/scsi/scsi-parameters.txt 2016-03-23 21:05:15.0 +1100 +++ linux/Documentation/scsi/scsi-parameters.txt2016-03-23 21:10:02.0 +1100 @@ -27,13 +27,15 @@ parameters may be changed at runtime by aic79xx=[HW,SCSI] See Documentation/scsi/aic79xx.txt. - atascsi=[HW,SCSI] Atari SCSI + atascsi=[HW,SCSI] + See drivers/scsi/atari_scsi.c. BusLogic= [HW,SCSI] See drivers/scsi/BusLogic.c, comment before function BusLogic_ParseDriverOptions(). dtc3181e= [HW,SCSI] + See Documentation/scsi/g_NCR5380.txt. eata= [HW,SCSI] @@ -51,8 +53,8 @@ parameters may be changed at runtime by ips=[HW,SCSI] Adaptec / IBM ServeRAID controller See header of drivers/scsi/ips.c. - mac5380=[HW,SCSI] Format: - + mac5380=[HW,SCSI] + See drivers/scsi/mac_scsi.c. max_luns= [SCSI] Maximum number of LUNs to probe. Should be between 1 and 2^32-1. @@ -65,10 +67,13 @@ parameters may be changed at runtime by See header of drivers/scsi/NCR_D700.c. ncr5380=[HW,SCSI] + See Documentation/scsi/g_NCR5380.txt. ncr53c400= [HW,SCSI] + See Documentation/scsi/g_NCR5380.txt. ncr53c400a= [HW,SCSI] + See Documentation/scsi/g_NCR5380.txt. ncr53c406a= [HW,SCSI] Index: linux/Documentation/scsi/g_NCR5380.txt === --- linux.orig/Documentation/scsi/g_NCR5380.txt 2016-03-23 21:05:15.0 +1100 +++ linux/Documentation/scsi/g_NCR5380.txt 2016-03-23 21:10:02.0 +1100 @@ -23,11 +23,10 @@ supported by the driver. If the default configuration does not work for you, you can use the kernel command lines (eg using the lilo append command): - ncr5380=port,irq,dma - ncr53c400=port,irq -or - ncr5380=base,irq,dma - ncr53c400=base,irq + ncr5380=addr,irq + ncr53c400=addr,irq + ncr53c400a=addr,irq + dtc3181e=addr,irq The driver does not probe for any addresses or ports other than those in the OVERRIDE or given to the kernel as above. @@ -36,19 +35,17 @@ This driver provides some information on /proc/scsi/g_NCR5380/x where x is the scsi card number as detected at boot time. More info to come in the future. -When NCR53c400 support is compiled in, BIOS parameters will be returned by -the driver (the raw 5380 driver does not and I don't plan to fiddle with -it!). - This driver works as a module. When included as a module, parameters can be passed on the insmod/modprobe command line: ncr_irq=xx the interrupt ncr_addr=xx the port or base address (for port or memory mapped, resp.) - ncr_dma=xx the DMA ncr_5380=1 to set up for a NCR5380 board ncr_53c400=1 to set up for a NCR53C400 board + ncr_53c400a=1 to set up for a NCR53C400A board + dtc_3181e=1 to set up for a Domex Technology Corp 3181E board + hp_c2502=1 to set up for a Hewlett Packard C2502 board e.g. modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1 for a port mapped NCR5380 board or Index: linux/drivers/scsi/g_NCR5380.c === --- linux.orig/drivers/scsi/g_NCR5380.c 2016-03-23 21:10:00.0 +1100 +++ linux/drivers/scsi/g_NCR5380.c 2016-03-23 21:10:02.0 +1100 @@ -18,42 +18,8 @@ * * Added ISAPNP support for DTC436 adapters, * Thomas Sailer, sai...@ife.ee.ethz.ch - */ - -/* - * TODO : flesh out DMA support, find some one actually using this (I have - * a memory mapped Trantor board that works fine) - */ - -/* - * The card is detected and initialized in one of several ways : - * 1. With command line overrides - NCR5380=port,irq may be - * used on the LILO command line to override the defaults. - * - * 2. With the GENERIC_NCR5380_OVERRIDE compile time define. This is - * specified as an array of address, irq, dma, board tuples. Ie, for - * one board at 0x350, IRQ5, no dma, I could say - * -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5,
[PATCH v4 21/23] atari_scsi: Allow can_queue to be increased for Falcon
The benefit of limiting can_queue to 1 is that atari_scsi shares the ST DMA chip more fairly with other drivers (e.g. falcon-ide). Unfortunately, this can limit SCSI bus utilization. On systems without IDE, atari_scsi should issue SCSI commands whenever it can arbitrate for the bus. Make that possible by making can_queue configurable. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz --- drivers/scsi/atari_scsi.c | 83 -- 1 file changed, 22 insertions(+), 61 deletions(-) Index: linux/drivers/scsi/atari_scsi.c === --- linux.orig/drivers/scsi/atari_scsi.c2016-03-23 21:10:03.0 +1100 +++ linux/drivers/scsi/atari_scsi.c 2016-03-23 21:10:04.0 +1100 @@ -14,55 +14,23 @@ * */ - -/**/ -/**/ -/* Notes for Falcon SCSI: */ -/* -- */ -/**/ -/* Since the Falcon SCSI uses the ST-DMA chip, that is shared among */ -/* several device drivers, locking and unlocking the access to this */ -/* chip is required. But locking is not possible from an interrupt, */ -/* since it puts the process to sleep if the lock is not available. */ -/* This prevents "late" locking of the DMA chip, i.e. locking it just */ -/* before using it, since in case of disconnection-reconnection */ -/* commands, the DMA is started from the reselection interrupt. */ -/**/ -/* Two possible schemes for ST-DMA-locking would be: */ -/* 1) The lock is taken for each command separately and disconnecting*/ -/* is forbidden (i.e. can_queue = 1). */ -/* 2) The DMA chip is locked when the first command comes in and */ -/* released when the last command is finished and all queues are */ -/* empty. */ -/* The first alternative would result in bad performance, since the */ -/* interleaving of commands would not be used. The second is unfair to*/ -/* other drivers using the ST-DMA, because the queues will seldom be */ -/* totally empty if there is a lot of disk traffic. */ -/**/ -/* For this reasons I decided to employ a more elaborate scheme: */ -/* - First, we give up the lock every time we can (for fairness), this*/ -/*means every time a command finishes and there are no other commands */ -/*on the disconnected queue. */ -/* - If there are others waiting to lock the DMA chip, we stop */ -/*issuing commands, i.e. moving them onto the issue queue. */ -/*Because of that, the disconnected queue will run empty in a */ -/*while. Instead we go to sleep on a 'fairness_queue'.*/ -/* - If the lock is released, all processes waiting on the fairness */ -/*queue will be woken. The first of them tries to re-lock the DMA, */ -/*the others wait for the first to finish this task. After that, */ -/*they can all run on and do their commands...*/ -/* This sounds complicated (and it is it :-(), but it seems to be a */ -/* good compromise between fairness and performance: As long as no one */ -/* else wants to work with the ST-DMA chip, SCSI can go along as */ -/* usual. If now someone else comes, this behaviour is changed to a */ -/* "fairness mode": just already initiated commands are finished and */ -/* then the lock is released. The other one waiting will probably win */ -/* the race for locking the DMA, since it was waiting for longer. And */ -/* after it has finished, SCSI can go ahead again. Finally: I hope I */ -/* have not produced any deadlock possibilities! */ -/**/ -/**/ - +/* + * Notes for Falcon SCSI DMA + * + * The 5380 device is one of several that all share the DMA chip. Hence + * "locking" and "unlocking" access to this chip is required. + * + * Two possible schemes for ST DMA acquisition by atari_scsi are: + * 1) The lock is taken for each command separately (i.e. can_queue == 1). + * 2) The lock is taken when the first command arrives and released + * when the last command is finished (i.e. can_queue > 1). + * + * The firs
[PATCH v4 03/23] ncr5380: Remove REAL_DMA and REAL_DMA_POLL macros
For the NCR5380.c core driver, these macros are never used. If REAL_DMA were to be defined, compilation would fail. For the atari_NCR5380.c core driver, REAL_DMA is always defined. Hence these macros are pointless. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 218 +-- drivers/scsi/NCR5380.h | 112 -- drivers/scsi/atari_NCR5380.c | 62 +--- drivers/scsi/atari_scsi.c| 32 -- drivers/scsi/sun3_scsi.c | 13 -- 5 files changed, 22 insertions(+), 415 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:20.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:22.0 +1100 @@ -35,18 +35,10 @@ * code so that everything does the same thing that's done at the * end of a pseudo-DMA read operation. * - * 2. Fix REAL_DMA (interrupt driven, polled works fine) - - * basically, transfer size needs to be reduced by one - * and the last byte read as is done with PSEUDO_DMA. - * * 4. Test SCSI-II tagged queueing (I have no devices which support * tagged queueing) */ -#ifndef notyet -#undef REAL_DMA -#endif - #ifdef BOARD_REQUIRES_NO_DELAY #define io_recovery_delay(x) #else @@ -131,12 +123,6 @@ * * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. * - * REAL_DMA - if defined, REAL DMA is used during the data transfer phases. - * - * REAL_DMA_POLL - if defined, REAL DMA is used but the driver doesn't - * rely on phase mismatch and EOP interrupts to determine end - * of phase. - * * These macros MUST be defined : * * NCR5380_read(register) - read from the specified register @@ -147,15 +133,9 @@ * specific implementation of the NCR5380 * * Either real DMA *or* pseudo DMA may be implemented - * REAL functions : - * NCR5380_REAL_DMA should be defined if real DMA is to be used. * Note that the DMA setup functions should return the number of bytes * that they were able to program the controller for. * - * Also note that generic i386/PC versions of these macros are - * available as NCR5380_i386_dma_write_setup, - * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual. - * * NCR5380_dma_write_setup(instance, src, count) - initialize * NCR5380_dma_read_setup(instance, dst, count) - initialize * NCR5380_dma_residual(instance); - residual count @@ -486,12 +466,6 @@ static void prepare_info(struct Scsi_Hos #ifdef DIFFERENTIAL "DIFFERENTIAL " #endif -#ifdef REAL_DMA -"REAL_DMA " -#endif -#ifdef REAL_DMA_POLL -"REAL_DMA_POLL " -#endif #ifdef PARITY "PARITY " #endif @@ -551,9 +525,8 @@ static int NCR5380_init(struct Scsi_Host hostdata->id_higher_mask |= i; for (i = 0; i < 8; ++i) hostdata->busy[i] = 0; -#ifdef REAL_DMA - hostdata->dmalen = 0; -#endif + hostdata->dma_len = 0; + spin_lock_init(&hostdata->lock); hostdata->connected = NULL; hostdata->sensing = NULL; @@ -850,11 +823,7 @@ static void NCR5380_main(struct work_str requeue_cmd(instance, cmd); } } - if (hostdata->connected -#ifdef REAL_DMA - && !hostdata->dmalen -#endif - ) { + if (hostdata->connected && !hostdata->dma_len) { dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n"); NCR5380_information_transfer(instance); done = 0; @@ -919,34 +888,6 @@ static irqreturn_t NCR5380_intr(int irq, dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n", irq, basr, sr, mr); -#if defined(REAL_DMA) - if ((mr & MR_DMA_MODE) || (mr & MR_MONITOR_BSY)) { - /* Probably End of DMA, Phase Mismatch or Loss of BSY. -* We ack IRQ after clearing Mode Register. Workarounds -* for End of DMA errata need to happen in DMA Mode. -*/ - - dsprintk(NDEBUG_INTR, instance, "interrupt in DMA mode\n"); - - int transferred; - - if (!hostdata->connected) - panic("scsi%d : DMA interrupt with no connected cmd\n", - instance->hostno); - - transferred = hostdata->dmalen - NCR5380_dma_residual(instance); - hostdata->connected->SCp.this_residual -= transferred; - hostdata->connected->SCp.ptr += transferred; - hostdata->dmalen = 0; - -
[PATCH v4 09/23] ncr5380: Adopt uniform DMA setup convention
Standardize the DMA setup hooks so that the DMA implementation in atari_NCR5380.c can be reconciled with pseudo DMA implementation in NCR5380.c. Calls to NCR5380_dma_recv_setup() and NCR5380_dma_send_setup() return a negative value on failure, zero on PDMA transfer success and a positive byte count for DMA setup success. This convention is not entirely new, but is now applied consistently. Also remove a pointless Status Register access: the *phase assignment is redundant because after NCR5380_transfer_dma() returns control to NCR5380_information_transfer(), that routine then returns control to NCR5380_main(), which means *phase is dead. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 21 ++--- drivers/scsi/arm/cumana_1.c | 10 -- drivers/scsi/arm/oak.c |4 ++-- drivers/scsi/atari_scsi.c |3 --- 4 files changed, 20 insertions(+), 18 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:37.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:44.0 +1100 @@ -1431,7 +1431,7 @@ static int NCR5380_transfer_dma(struct S register unsigned char p = *phase; register unsigned char *d = *data; unsigned char tmp; - int foo; + int result; if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) { *phase = tmp; @@ -1505,9 +1505,9 @@ static int NCR5380_transfer_dma(struct S */ if (p & SR_IO) { - foo = NCR5380_dma_recv_setup(instance, d, + result = NCR5380_dma_recv_setup(instance, d, hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c); - if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { + if (!result && (hostdata->flags & FLAG_DMA_FIXUP)) { /* * The workaround was to transfer fewer bytes than we * intended to with the pseudo-DMA read function, wait for @@ -1525,19 +1525,19 @@ static int NCR5380_transfer_dma(struct S if (NCR5380_poll_politely(instance, BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, HZ) < 0) { - foo = -1; + result = -1; shost_printk(KERN_ERR, instance, "PDMA read: DRQ timeout\n"); } if (NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, HZ) < 0) { - foo = -1; + result = -1; shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n"); } d[c - 1] = NCR5380_read(INPUT_DATA_REG); } } else { - foo = NCR5380_dma_send_setup(instance, d, c); - if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { + result = NCR5380_dma_send_setup(instance, d, c); + if (!result && (hostdata->flags & FLAG_DMA_FIXUP)) { /* * Wait for the last byte to be sent. If REQ is being asserted for * the byte we're interested, we'll ACK it and it will go false. @@ -1545,7 +1545,7 @@ static int NCR5380_transfer_dma(struct S if (NCR5380_poll_politely2(instance, BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, BUS_AND_STATUS_REG, BASR_PHASE_MATCH, 0, HZ) < 0) { - foo = -1; + result = -1; shost_printk(KERN_ERR, instance, "PDMA write: DRQ and phase timeout\n"); } } @@ -1555,8 +1555,7 @@ static int NCR5380_transfer_dma(struct S NCR5380_read(RESET_PARITY_INTERRUPT_REG); *data = d + c; *count = 0; - *phase = NCR5380_read(STATUS_REG) & PHASE_MASK; - return foo; + return result; } /* @@ -1652,7 +1651,7 @@ static void NCR5380_information_transfer if (!cmd->device->borken) transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); - if (transfersize) { + if (transfersize > 0) { len = transfersize; if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **)&cmd->SCp.ptr)) { Index: linux/drivers/scsi/arm/cumana_1.c === --- linux.or
[PATCH v4 08/23] ncr5380: Use DMA hooks for PDMA
Those wrapper drivers which use DMA define the REAL_DMA macro and those which use pseudo DMA define PSEUDO_DMA. These macros need to be removed for a number of reasons, not least of which is to have drivers share more code. Redefine the PDMA send and receive hooks as DMA setup hooks, so that the DMA code can be shared by all 5380 wrapper drivers. This will help to reunify the forked core driver. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 10 ++ drivers/scsi/arm/cumana_1.c | 10 ++ drivers/scsi/arm/oak.c | 10 ++ drivers/scsi/dmx3191d.c |4 ++-- drivers/scsi/dtc.c |6 -- drivers/scsi/dtc.h |2 ++ drivers/scsi/g_NCR5380.c| 10 ++ drivers/scsi/g_NCR5380.h|4 ++-- drivers/scsi/mac_scsi.c |5 ++--- drivers/scsi/pas16.c| 14 -- drivers/scsi/pas16.h|2 ++ drivers/scsi/t128.c | 12 ++-- drivers/scsi/t128.h |2 ++ 13 files changed, 50 insertions(+), 41 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:34.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:37.0 +1100 @@ -127,17 +127,11 @@ * specific implementation of the NCR5380 * * Either real DMA *or* pseudo DMA may be implemented - * Note that the DMA setup functions should return the number of bytes - * that they were able to program the controller for. * * NCR5380_dma_write_setup(instance, src, count) - initialize * NCR5380_dma_read_setup(instance, dst, count) - initialize * NCR5380_dma_residual(instance); - residual count * - * PSEUDO functions : - * NCR5380_pwrite(instance, src, count) - * NCR5380_pread(instance, dst, count); - * * The generic driver is initialized by calling NCR5380_init(instance), * after setting the appropriate host specific fields and ID. If the * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance, @@ -1511,7 +1505,7 @@ static int NCR5380_transfer_dma(struct S */ if (p & SR_IO) { - foo = NCR5380_pread(instance, d, + foo = NCR5380_dma_recv_setup(instance, d, hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c); if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { /* @@ -1542,7 +1536,7 @@ static int NCR5380_transfer_dma(struct S d[c - 1] = NCR5380_read(INPUT_DATA_REG); } } else { - foo = NCR5380_pwrite(instance, d, c); + foo = NCR5380_dma_send_setup(instance, d, c); if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { /* * Wait for the last byte to be sent. If REQ is being asserted for Index: linux/drivers/scsi/arm/cumana_1.c === --- linux.orig/drivers/scsi/arm/cumana_1.c 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/arm/cumana_1.c 2016-03-23 21:09:37.0 +1100 @@ -18,6 +18,8 @@ #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) +#define NCR5380_dma_recv_setup cumanascsi_pread +#define NCR5380_dma_send_setup cumanascsi_pwrite #define NCR5380_intr cumanascsi_intr #define NCR5380_queue_command cumanascsi_queue_command @@ -39,8 +41,8 @@ void cumanascsi_setup(char *str, int *in #define L(v) (((v)<<16)|((v) & 0x)) #define H(v) (((v)>>16)|((v) & 0x)) -static inline int -NCR5380_pwrite(struct Scsi_Host *host, unsigned char *addr, int len) +static inline int cumanascsi_pwrite(struct Scsi_Host *host, +unsigned char *addr, int len) { unsigned long *laddr; void __iomem *dma = priv(host)->dma + 0x2000; @@ -102,8 +104,8 @@ end: return len; } -static inline int -NCR5380_pread(struct Scsi_Host *host, unsigned char *addr, int len) +static inline int cumanascsi_pread(struct Scsi_Host *host, + unsigned char *addr, int len) { unsigned long *laddr; void __iomem *dma = priv(host)->dma + 0x2000; Index: linux/drivers/scsi/arm/oak.c === --- linux.orig/drivers/scsi/arm/oak.c 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/arm/oak.c2016-03-23 21:09:37.0 +1100 @@ -24,6 +24,8 @@ writeb(value, priv(instance)->base + ((reg) << 2)) #define NCR5380_dma_xfer_len(instance, cmd, phase) (0) +#define NCR5380_dma_recv_setup oakscsi_pread +#define NCR5380_dma_send_setup oakscsi_pwrite #define NCR5380_queue_comm
[PATCH v4 07/23] ncr5380: Remove BOARD_REQUIRES_NO_DELAY macro
The io_recovery_delay macro is intended to insert a microsecond delay between the chip register accesses that begin a DMA operation. This is reportedly needed for some ISA boards. Reverse the sense of the macro test so that in the common case, where no delay is required, drivers need not define the macro. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 18 -- drivers/scsi/dtc.h |2 ++ drivers/scsi/g_NCR5380.h |2 ++ drivers/scsi/t128.h |2 ++ 4 files changed, 14 insertions(+), 10 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:34.0 +1100 @@ -39,12 +39,6 @@ * tagged queueing) */ -#ifdef BOARD_REQUIRES_NO_DELAY -#define io_recovery_delay(x) -#else -#define io_recovery_delay(x) udelay(x) -#endif - /* * Design * @@ -150,6 +144,10 @@ * possible) function may be used. */ +#ifndef NCR5380_io_delay +#define NCR5380_io_delay(x) +#endif + static int do_abort(struct Scsi_Host *); static void do_reset(struct Scsi_Host *); @@ -1468,14 +1466,14 @@ static int NCR5380_transfer_dma(struct S */ if (p & SR_IO) { - io_recovery_delay(1); + NCR5380_io_delay(1); NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0); } else { - io_recovery_delay(1); + NCR5380_io_delay(1); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA); - io_recovery_delay(1); + NCR5380_io_delay(1); NCR5380_write(START_DMA_SEND_REG, 0); - io_recovery_delay(1); + NCR5380_io_delay(1); } /* Index: linux/drivers/scsi/dtc.h === --- linux.orig/drivers/scsi/dtc.h 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/dtc.h2016-03-23 21:09:34.0 +1100 @@ -28,6 +28,8 @@ #define NCR5380_bus_reset dtc_bus_reset #define NCR5380_info dtc_info +#define NCR5380_io_delay(x)udelay(x) + /* 15 12 11 10 1001 1100 */ Index: linux/drivers/scsi/g_NCR5380.h === --- linux.orig/drivers/scsi/g_NCR5380.h 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/g_NCR5380.h 2016-03-23 21:09:34.0 +1100 @@ -71,6 +71,8 @@ #define NCR5380_pwrite generic_NCR5380_pwrite #define NCR5380_info generic_NCR5380_info +#define NCR5380_io_delay(x)udelay(x) + #define BOARD_NCR5380 0 #define BOARD_NCR53C4001 #define BOARD_NCR53C400A 2 Index: linux/drivers/scsi/t128.h === --- linux.orig/drivers/scsi/t128.h 2016-03-23 21:09:28.0 +1100 +++ linux/drivers/scsi/t128.h 2016-03-23 21:09:34.0 +1100 @@ -84,6 +84,8 @@ #define NCR5380_bus_reset t128_bus_reset #define NCR5380_info t128_info +#define NCR5380_io_delay(x)udelay(x) + /* 15 14 12 10 7 5 3 1101 0100 1010 1000 */
[PATCH v4 10/23] ncr5380: Merge DMA implementation from atari_NCR5380 core driver
Adopt the DMA implementation from atari_NCR5380.c. This means that atari_scsi and sun3_scsi can make use of the NCR5380.c core driver and the atari_NCR5380.c driver fork can be made redundant. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 170 +++- drivers/scsi/arm/cumana_1.c |3 drivers/scsi/arm/oak.c |3 drivers/scsi/dmx3191d.c |1 drivers/scsi/dtc.c |2 drivers/scsi/dtc.h |1 drivers/scsi/g_NCR5380.c|2 drivers/scsi/g_NCR5380.h|1 drivers/scsi/mac_scsi.c |3 drivers/scsi/pas16.c|2 drivers/scsi/pas16.h|1 drivers/scsi/t128.c |2 drivers/scsi/t128.h |1 13 files changed, 152 insertions(+), 40 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:44.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:47.0 +1100 @@ -31,9 +31,6 @@ /* * Further development / testing that should be done : - * 1. Cleanup the NCR5380_transfer_dma function and DMA operation complete - * code so that everything does the same thing that's done at the - * end of a pseudo-DMA read operation. * * 4. Test SCSI-II tagged queueing (I have no devices which support * tagged queueing) @@ -117,6 +114,8 @@ * * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. * + * REAL_DMA - if defined, REAL DMA is used during the data transfer phases. + * * These macros MUST be defined : * * NCR5380_read(register) - read from the specified register @@ -801,6 +800,72 @@ static void NCR5380_main(struct work_str } while (!done); } +/* + * NCR5380_dma_complete - finish DMA transfer + * @instance: the scsi host instance + * + * Called by the interrupt handler when DMA finishes or a phase + * mismatch occurs (which would end the DMA transfer). + */ + +static void NCR5380_dma_complete(struct Scsi_Host *instance) +{ + struct NCR5380_hostdata *hostdata = shost_priv(instance); + int transferred; + unsigned char **data; + int *count; + int saved_data = 0, overrun = 0; + unsigned char p; + + if (hostdata->read_overruns) { + p = hostdata->connected->SCp.phase; + if (p & SR_IO) { + udelay(10); + if ((NCR5380_read(BUS_AND_STATUS_REG) & +(BASR_PHASE_MATCH | BASR_ACK)) == + (BASR_PHASE_MATCH | BASR_ACK)) { + saved_data = NCR5380_read(INPUT_DATA_REG); + overrun = 1; + dsprintk(NDEBUG_DMA, instance, "read overrun handled\n"); + } + } + } + + NCR5380_write(MODE_REG, MR_BASE); + NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); + NCR5380_read(RESET_PARITY_INTERRUPT_REG); + + transferred = hostdata->dma_len - NCR5380_dma_residual(instance); + hostdata->dma_len = 0; + + data = (unsigned char **)&hostdata->connected->SCp.ptr; + count = &hostdata->connected->SCp.this_residual; + *data += transferred; + *count -= transferred; + + if (hostdata->read_overruns) { + int cnt, toPIO; + + if ((NCR5380_read(STATUS_REG) & PHASE_MASK) == p && (p & SR_IO)) { + cnt = toPIO = hostdata->read_overruns; + if (overrun) { + dsprintk(NDEBUG_DMA, instance, +"Got an input overrun, using saved byte\n"); + *(*data)++ = saved_data; + (*count)--; + cnt--; + toPIO--; + } + if (toPIO > 0) { + dsprintk(NDEBUG_DMA, instance, +"Doing %d byte PIO to 0x%p\n", cnt, *data); + NCR5380_transfer_pio(instance, &p, &cnt, data); + *count -= toPIO - cnt; + } + } + } +} + #ifndef DONT_USE_INTR /** @@ -855,7 +920,22 @@ static irqreturn_t NCR5380_intr(int irq, dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n", irq, basr, sr, mr); - if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) && + if ((mr & MR_DMA_MODE) || (mr & MR_MONITOR_BSY)) { + /* Probably End of DMA, Phase Mismatch or Loss of BSY. +* We ack IRQ after clearing Mode Register. Workarounds +
[PATCH v4 06/23] ncr5380: Remove PSEUDO_DMA macro
For those wrapper drivers which only implement Programmed IO, have NCR5380_dma_xfer_len() evaluate to zero. That allows PDMA to be easily disabled at run-time and so the PSEUDO_DMA macro is no longer needed. Also remove the spin counters used for debugging pseudo DMA drivers. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/NCR5380.h |4 drivers/scsi/arm/cumana_1.c |2 -- drivers/scsi/arm/oak.c |3 +-- drivers/scsi/dmx3191d.c |4 drivers/scsi/dtc.c |7 --- drivers/scsi/dtc.h |2 -- drivers/scsi/g_NCR5380.c|1 - drivers/scsi/g_NCR5380.h|1 - drivers/scsi/mac_scsi.c | 10 -- drivers/scsi/pas16.c| 10 -- drivers/scsi/pas16.h|2 -- drivers/scsi/t128.c |4 drivers/scsi/t128.h |2 -- 14 files changed, 6 insertions(+), 78 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:26.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:28.0 +1100 @@ -469,34 +469,9 @@ static void prepare_info(struct Scsi_Hos #ifdef PARITY "PARITY " #endif -#ifdef PSEUDO_DMA -"PSEUDO_DMA " -#endif ""); } -#ifdef PSEUDO_DMA -static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, - char *buffer, int length) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - hostdata->spin_max_r = 0; - hostdata->spin_max_w = 0; - return 0; -} - -static int __maybe_unused NCR5380_show_info(struct seq_file *m, -struct Scsi_Host *instance) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n", - hostdata->spin_max_w, hostdata->spin_max_r); - return 0; -} -#endif - /** * NCR5380_init - initialise an NCR5380 * @instance: adapter to configure @@ -1436,7 +1411,6 @@ timeout: return -1; } -#if defined(PSEUDO_DMA) /* * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, * unsigned char *phase, int *count, unsigned char **data) @@ -1592,7 +1566,6 @@ static int NCR5380_transfer_dma(struct S *phase = NCR5380_read(STATUS_REG) & PHASE_MASK; return foo; } -#endif /* PSEUDO_DMA */ /* * Function : NCR5380_information_transfer (struct Scsi_Host *instance) @@ -1683,7 +1656,6 @@ static void NCR5380_information_transfer * in an unconditional loop. */ -#if defined(PSEUDO_DMA) transfersize = 0; if (!cmd->device->borken) transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); @@ -1706,9 +1678,7 @@ static void NCR5380_information_transfer /* XXX - need to source or sink data here, as appropriate */ } else cmd->SCp.this_residual -= transfersize - len; - } else -#endif /* PSEUDO_DMA */ - { + } else { /* Break up transfer into 3 ms chunks, * presuming 6 accesses per handshake. */ Index: linux/drivers/scsi/NCR5380.h === --- linux.orig/drivers/scsi/NCR5380.h 2016-03-23 21:09:26.0 +1100 +++ linux/drivers/scsi/NCR5380.h2016-03-23 21:09:28.0 +1100 @@ -257,10 +257,6 @@ struct NCR5380_hostdata { #ifdef SUPPORT_TAGS struct tag_alloc TagAlloc[8][8];/* 8 targets and 8 LUNs */ #endif -#ifdef PSEUDO_DMA - unsigned spin_max_r; - unsigned spin_max_w; -#endif struct workqueue_struct *work_q; unsigned long accesses_per_ms; /* chip register accesses per ms */ }; Index: linux/drivers/scsi/arm/cumana_1.c === --- linux.orig/drivers/scsi/arm/cumana_1.c 2016-03-23 21:09:26.0 +1100 +++ linux/drivers/scsi/arm/cumana_1.c 2016-03-23 21:09:28.0 +1100 @@ -13,8 +13,6 @@ #include -#define PSEUDO_DMA - #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) #define NCR5380_read(reg) cumanascsi_read(instance, reg) #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) Index: linux/drivers/scsi/arm/oak.c
[PATCH v4 05/23] ncr5380: Disable the DMA errata workaround flag by default
The only chip that needs the workarounds enabled is an early NMOS device. That means that the common case is to disable them. Unfortunately the sense of the flag is such that it has to be set for the common case. Rename the flag so that zero can be used to mean "no errata workarounds needed". This simplifies the code. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Tested-by: Ondrej Zary --- drivers/scsi/NCR5380.c | 14 +++--- drivers/scsi/NCR5380.h |2 +- drivers/scsi/arm/cumana_1.c |2 +- drivers/scsi/arm/oak.c |2 +- drivers/scsi/dtc.c |2 +- drivers/scsi/g_NCR5380.c|8 +--- drivers/scsi/pas16.c|2 +- drivers/scsi/t128.c |2 +- 8 files changed, 14 insertions(+), 20 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-23 21:09:22.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-23 21:09:26.0 +1100 @@ -457,7 +457,7 @@ static void prepare_info(struct Scsi_Hos instance->base, instance->irq, instance->can_queue, instance->cmd_per_lun, instance->sg_tablesize, instance->this_id, -hostdata->flags & FLAG_NO_DMA_FIXUP ? "NO_DMA_FIXUP " : "", +hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "", hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "", #ifdef AUTOPROBE_IRQ @@ -1480,11 +1480,11 @@ static int NCR5380_transfer_dma(struct S * before the setting of DMA mode to after transfer of the last byte. */ - if (hostdata->flags & FLAG_NO_DMA_FIXUP) + if (hostdata->flags & FLAG_DMA_FIXUP) + NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY); + else NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY | MR_ENABLE_EOP_INTR); - else - NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY); dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG)); @@ -1540,8 +1540,8 @@ static int NCR5380_transfer_dma(struct S if (p & SR_IO) { foo = NCR5380_pread(instance, d, - hostdata->flags & FLAG_NO_DMA_FIXUP ? c : c - 1); - if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { + hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c); + if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { /* * The workaround was to transfer fewer bytes than we * intended to with the pseudo-DMA read function, wait for @@ -1571,7 +1571,7 @@ static int NCR5380_transfer_dma(struct S } } else { foo = NCR5380_pwrite(instance, d, c); - if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { + if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) { /* * Wait for the last byte to be sent. If REQ is being asserted for * the byte we're interested, we'll ACK it and it will go false. Index: linux/drivers/scsi/NCR5380.h === --- linux.orig/drivers/scsi/NCR5380.h 2016-03-23 21:09:22.0 +1100 +++ linux/drivers/scsi/NCR5380.h2016-03-23 21:09:26.0 +1100 @@ -220,7 +220,7 @@ #define NO_IRQ 0 #endif -#define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */ +#define FLAG_DMA_FIXUP 1 /* Use DMA errata workarounds */ #define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */ #define FLAG_LATE_DMA_SETUP32 /* Setup NCR before DMA H/W */ #define FLAG_TAGGED_QUEUING64 /* as X3T9.2 spelled it */ Index: linux/drivers/scsi/dtc.c === --- linux.orig/drivers/scsi/dtc.c 2016-03-23 21:05:15.0 +1100 +++ linux/drivers/scsi/dtc.c2016-03-23 21:09:26.0 +1100 @@ -229,7 +229,7 @@ found: instance->base = addr; ((struct NCR5380_hostdata *)(instance)->hostdata)->base = base; - if (NCR5380_init(instance, FLAG_NO_DMA_FIXUP)) + if (NCR5380_init(instance, 0)) goto out_unregister; NCR5380_maybe_reset_bus(instance); Index: linux/drivers/scsi/g_NCR5380.c === --- linux.orig/drivers/scsi/g_NCR5380.c 2016-03-23 21:09:20.0 +1100 +++ linux/drivers/scsi/g_NCR5380.c 2016-03-23 21:09:26.0 +1100 @@ -348
[PATCH v4 01/23] g_ncr5380: Remove CONFIG_SCSI_GENERIC_NCR53C400
This change brings a number of improvements: fewer macros, better test coverage, simpler code and sane Kconfig options. The downside is a small chance of incompatibility (which seems unavoidable). CONFIG_SCSI_GENERIC_NCR53C400 exists to enable or inhibit pseudo DMA transfers when the driver is used with 53C400-compatible cards. Thanks to Ondrej Zary's patches, PDMA now works which means it can be enabled unconditionally. Due to bad design, CONFIG_SCSI_GENERIC_NCR53C400 ties together unrelated functionality as it sets both PSEUDO_DMA and BIOSPARAM macros. This patch effectively enables PSEUDO_DMA and disables BIOSPARAM. The defconfigs and the Kconfig default leave CONFIG_SCSI_GENERIC_NCR53C400 undefined. Red Hat 9 and CentOS 2.1 were the same. This leaves both PSEUDO_DMA and BIOSPARAM disabled. The effect of this patch should be better performance from enabling PSEUDO_DMA. On the other hand, Debian 4 and SLES 10 had CONFIG_SCSI_GENERIC_NCR53C400 enabled, so both PSEUDO_DMA and BIOSPARAM were enabled. This patch might affect configurations like this by disabling BIOSPARAM. My best guess is that this could be a problem only in the vanishingly rare case that 1) the CHS values stored in the boot device partition table are wrong and 2) a 5380 card is in use (because PDMA on 53C400 used to be broken). Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Ondrej Zary --- Here are the distro kernel versions I looked at: CentOS 2.1: $ strings kernel-2.4.9-e.40.i686/lib/modules/2.4.9-e.40/kernel/drivers/scsi/g_NCR5380.o | grep extension NO NCR53C400 driver extensions Red Hat 7: $ strings kernel-2.4.18-3.i386/lib/modules/2.4.18-3/kernel/drivers/scsi/g_NCR5380.o | grep extension NO NCR53C400 driver extensions Red Hat 9: $ strings kernel-2.4.20-8.i586/lib/modules/2.4.20-8/kernel/drivers/scsi/g_NCR5380.o | grep extension NO NCR53C400 driver extensions Debian 4: $ strings linux-image-2.6.24-etchnhalf.1-486_2.6.24-6-etchnhalf.9etch3_i386/lib/modules/2.6.24-etchnhalf.1-486/kernel/drivers/scsi/g_NCR5380_mmio.ko | grep extension NCR53C400 extension version %d $ strings kernel-image-2.6.8-2-386_2.6.8-13_i386/lib/modules/2.6.8-2-386/kernel/drivers/scsi/g_NCR5380_mmio.ko | grep extension NCR53C400 extension version %d SLES 10.2: $ strings kernel-default-2.6.18.2-34.i586/lib/modules/2.6.18.2-34-default/kernel/drivers/scsi/g_NCR5380_mmio.ko | grep extension NCR53C400 extension version %d --- drivers/scsi/Kconfig | 11 -- drivers/scsi/g_NCR5380.c | 75 ++- drivers/scsi/g_NCR5380.h | 16 +- 3 files changed, 25 insertions(+), 77 deletions(-) Index: linux/drivers/scsi/Kconfig === --- linux.orig/drivers/scsi/Kconfig 2016-03-23 21:05:16.0 +1100 +++ linux/drivers/scsi/Kconfig 2016-03-23 21:09:19.0 +1100 @@ -812,17 +812,6 @@ config SCSI_GENERIC_NCR5380_MMIO To compile this driver as a module, choose M here: the module will be called g_NCR5380_mmio. -config SCSI_GENERIC_NCR53C400 - bool "Enable NCR53c400 extensions" - depends on SCSI_GENERIC_NCR5380 - help - This enables certain optimizations for the NCR53c400 SCSI cards. - You might as well try it out. Note that this driver will only probe - for the Trantor T130B in its default configuration; you might have - to pass a command line option to the kernel at boot time if it does - not detect your card. See the file - for details. - config SCSI_IPS tristate "IBM ServeRAID support" depends on PCI && SCSI Index: linux/drivers/scsi/g_NCR5380.c === --- linux.orig/drivers/scsi/g_NCR5380.c 2016-03-23 21:05:16.0 +1100 +++ linux/drivers/scsi/g_NCR5380.c 2016-03-23 21:09:19.0 +1100 @@ -57,10 +57,7 @@ */ #define AUTOPROBE_IRQ - -#ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define PSEUDO_DMA -#endif #include #include @@ -270,7 +267,7 @@ static int __init generic_NCR5380_detect #ifndef SCSI_G_NCR5380_MEM int i; int port_idx = -1; - unsigned long region_size = 16; + unsigned long region_size; #endif static unsigned int __initdata ncr_53c400a_ports[] = { 0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0 @@ -290,6 +287,7 @@ static int __init generic_NCR5380_detect #ifdef SCSI_G_NCR5380_MEM unsigned long base; void __iomem *iomem; + resource_size_t iomem_size; #endif if (ncr_irq) @@ -353,9 +351,7 @@ static int __init generic_NCR5380_detect flags = FLAG_NO_PSEUDO_DMA; break; case BOARD_NCR53C400: -#ifdef PSEUDO_DMA flags = FLAG_NO_DMA_FIXUP; -#endif break; case BOARD_NCR53C400A:
RE: [RFC PATCH 0/4] ACPI based PCI host driver with generic ECAM
Hi Jayachandran > -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Jayachandran C > Sent: 18 March 2016 17:48 > To: Bjorn Helgaas; Tomasz Nowicki; raf...@kernel.org > Cc: Jayachandran C; Arnd Bergmann; Will Deacon; Catalin Marinas; Hanjun > Guo; Lorenzo Pieralisi; ok...@codeaurora.org; > jiang@linux.intel.com; Stefano Stabellini; > robert.rich...@caviumnetworks.com; Marcin Wojtas; liviu.du...@arm.com; > David Daney; Wangyijing; suravee.suthikulpa...@amd.com; > msal...@redhat.com; linux-...@vger.kernel.org; linux-arm- > ker...@lists.infradead.org; linux-a...@vger.kernel.org; linux- > ker...@vger.kernel.org; linaro-a...@lists.linaro.org; Jon Masters > Subject: Re: [RFC PATCH 0/4] ACPI based PCI host driver with generic > ECAM > > On Fri, Mar 18, 2016 at 1:48 AM, Jayachandran C > wrote: > > Hi Bjorn, > > > > Here is a new patchset for the ACPI PCI controller driver based on > the > > earlier discussion[1]. > > > > The first two patches in the patchset implements pci/ecam.c for > generic > > config space access and uses it in pci-host-generic.c and related > files. > > > > The third patch implements the ACPI PCI host driver using the same > ecam > > access functions. The fourth patch adds the implementation of raw > > operations. > > > > I have not used the pci_mmcfg_list or the region definitions from > x86, > > but have used a much simpler approach here. > > > > This should apply cleanly on top of the current pci next tree, and > > can be reviewed as a patchset. To use it on ARM64, we need to pull > > in about 7 patches more from Tomasz patchset that fixes various > > issues (like stub code in arm64 pci.c, ACPI companion setup, > > domain number assignment, IO resources fixup etc.). > > > > If you are okay with this approach, I will work with Tomasz and > > post the full patchset. > > > > This has been tested on qemu with OVMF for the ACPI part and with > > device tree for pci-host-generic code. > > The full patchset is available at https://github.com/jchandra- > brcm/linux.git on > branch arm64-acpi-pci, if anyone wants to try it. I had a look at your patchset and also in your git repo at the other patches that you ported over from Tomasz; it seems that now we miss a quirk mechanism to enable controller that are not fully ECAM. This was provided before by Tomasz in: https://lkml.org/lkml/2016/2/16/410 I think we should put something like that back in... Thanks Gab > > Comments, suggestions and testing would be welcome. > > Thanks, > JC.
Re: [PATCH] drivers: firmware: psci: make two helper functions static
On Tue, Mar 22, 2016 at 10:31:45PM +0800, Jisheng Zhang wrote: > psci_power_state_loses_context() and psci_power_state_is_valid are only > used internally now, so make them static. > > Signed-off-by: Jisheng Zhang > --- > drivers/firmware/psci.c | 4 ++-- > include/linux/psci.h| 2 -- > 2 files changed, 2 insertions(+), 4 deletions(-) Thanks, I will apply it and send it for next cycle. Lorenzo > diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c > index 11bfee8..6d86881 100644 > --- a/drivers/firmware/psci.c > +++ b/drivers/firmware/psci.c > @@ -91,7 +91,7 @@ static inline bool psci_has_ext_power_state(void) > PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; > } > > -bool psci_power_state_loses_context(u32 state) > +static bool psci_power_state_loses_context(u32 state) > { > const u32 mask = psci_has_ext_power_state() ? > PSCI_1_0_EXT_POWER_STATE_TYPE_MASK : > @@ -100,7 +100,7 @@ bool psci_power_state_loses_context(u32 state) > return state & mask; > } > > -bool psci_power_state_is_valid(u32 state) > +static bool psci_power_state_is_valid(u32 state) > { > const u32 valid_mask = psci_has_ext_power_state() ? > PSCI_1_0_EXT_POWER_STATE_MASK : > diff --git a/include/linux/psci.h b/include/linux/psci.h > index 393efe2..bdea1cb 100644 > --- a/include/linux/psci.h > +++ b/include/linux/psci.h > @@ -21,8 +21,6 @@ > #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 > > bool psci_tos_resident_on(int cpu); > -bool psci_power_state_loses_context(u32 state); > -bool psci_power_state_is_valid(u32 state); > > int psci_cpu_init_idle(unsigned int cpu); > int psci_cpu_suspend_enter(unsigned long index); > -- > 2.8.0.rc3 >
Re: [PATCH v12 08/29] HMM: add device page fault support v6.
Jerome Glisse writes: > [ text/plain ] > On Wed, Mar 23, 2016 at 12:22:23PM +0530, Aneesh Kumar K.V wrote: >> Jérôme Glisse writes: >> >> > [ text/plain ] >> > This patch add helper for device page fault. Thus helpers will fill >> > the mirror page table using the CPU page table and synchronizing >> > with any update to CPU page table. >> > >> > Changed since v1: >> > - Add comment about directory lock. >> > >> > Changed since v2: >> > - Check for mirror->hmm in hmm_mirror_fault() >> > >> > Changed since v3: >> > - Adapt to HMM page table changes. >> > >> > Changed since v4: >> > - Fix PROT_NONE, ie do not populate from protnone pte. >> > - Fix huge pmd handling (start address may != pmd start address) >> > - Fix missing entry case. >> > >> > Signed-off-by: Jérôme Glisse >> > Signed-off-by: Sherry Cheung >> > Signed-off-by: Subhash Gutti >> > Signed-off-by: Mark Hairgrove >> > Signed-off-by: John Hubbard >> > Signed-off-by: Jatin Kumar >> > --- >> >> >> >> >> >> +static int hmm_mirror_fault_hpmd(struct hmm_mirror *mirror, >> > + struct hmm_event *event, >> > + struct vm_area_struct *vma, >> > + struct hmm_pt_iter *iter, >> > + pmd_t *pmdp, >> > + struct hmm_mirror_fault *mirror_fault, >> > + unsigned long start, >> > + unsigned long end) >> > +{ >> > + struct page *page; >> > + unsigned long addr, pfn; >> > + unsigned flags = FOLL_TOUCH; >> > + spinlock_t *ptl; >> > + int ret; >> > + >> > + ptl = pmd_lock(mirror->hmm->mm, pmdp); >> > + if (unlikely(!pmd_trans_huge(*pmdp))) { >> > + spin_unlock(ptl); >> > + return -EAGAIN; >> > + } >> > + flags |= event->etype == HMM_DEVICE_WFAULT ? FOLL_WRITE : 0; >> > + page = follow_trans_huge_pmd(vma, start, pmdp, flags); >> > + pfn = page_to_pfn(page); >> > + spin_unlock(ptl); >> > + >> > + /* Just fault in the whole PMD. */ >> > + start &= PMD_MASK; >> > + end = start + PMD_SIZE - 1; >> > + >> > + if (!pmd_write(*pmdp) && event->etype == HMM_DEVICE_WFAULT) >> > + return -ENOENT; >> > + >> > + for (ret = 0, addr = start; !ret && addr < end;) { >> > + unsigned long i, next = end; >> > + dma_addr_t *hmm_pte; >> > + >> > + hmm_pte = hmm_pt_iter_populate(iter, addr, &next); >> > + if (!hmm_pte) >> > + return -ENOMEM; >> > + >> > + i = hmm_pt_index(&mirror->pt, addr, mirror->pt.llevel); >> > + >> > + /* >> > + * The directory lock protect against concurrent clearing of >> > + * page table bit flags. Exceptions being the dirty bit and >> > + * the device driver private flags. >> > + */ >> > + hmm_pt_iter_directory_lock(iter); >> > + do { >> > + if (!hmm_pte_test_valid_pfn(&hmm_pte[i])) { >> > + hmm_pte[i] = hmm_pte_from_pfn(pfn); >> > + hmm_pt_iter_directory_ref(iter); >> >> I looked at that and it is actually >> static inline void hmm_pt_iter_directory_ref(struct hmm_pt_iter *iter) >> { >> BUG_ON(!iter->ptd[iter->pt->llevel - 1]); >> hmm_pt_directory_ref(iter->pt, iter->ptd[iter->pt->llevel - 1]); >> } >> >> static inline void hmm_pt_directory_ref(struct hmm_pt *pt, >> struct page *ptd) >> { >> if (!atomic_inc_not_zero(&ptd->_mapcount)) >> /* Illegal this should not happen. */ >> BUG(); >> } >> >> what is the mapcount update about ? > > Unlike regular CPU page table we do not rely on unmap to prune HMM mirror > page table. Rather we free/prune it aggressively once the device no longer > have anything mirror in a given range. Which patch does this ? > > As such mapcount is use to keep track of any many valid entry there is per > directory. > > Moreover mapcount is also use to protect from concurrent pruning when > you walk through the page table you increment refcount by one along your > way. When you done walking you decrement refcount. > > Because of that last aspect, the mapcount can never reach zero because we > unmap page, it can only reach zero once we cleanup the page table walk. > >> >> > + } >> > + BUG_ON(hmm_pte_pfn(hmm_pte[i]) != pfn); >> > + if (pmd_write(*pmdp)) >> > + hmm_pte_set_write(&hmm_pte[i]); >> > + } while (addr += PAGE_SIZE, pfn++, i++, addr != next); >> > + hmm_pt_iter_directory_unlock(iter); >> > + mirror_fault->addr = addr; >> > + } >> > + >> >> So we don't have huge page mapping in hmm page table ? > > No we don't right now. First reason is that i wanted to keep things simple for > device driver. Second motivation is to keep first patchset simpler especialy > the page migration code. > > Memory overhead
[PATCH] [media] dvb-usb: hide unused functions
A couple of data structures in the dibusb-common file are only accessed when CONFIG_DVB_DIB3000MC is enabled, otherwise we get a harmless gcc warning: usb/dvb-usb/dibusb-common.c:223:34: error: 'dib3000p_panasonic_agc_config' defined but not used usb/dvb-usb/dibusb-common.c:211:32: error: 'stk3000p_dib3000p_config' defined but not used This moves the existing #ifdef a few lines up to correctly cover all the conditional data structures, which gets rid of the warning. Signed-off-by: Arnd Bergmann --- drivers/media/usb/dvb-usb/dibusb-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 35de6095926d..6eea4e68891d 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -184,6 +184,8 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) } EXPORT_SYMBOL(dibusb_read_eeprom_byte); +#if IS_ENABLED(CONFIG_DVB_DIB3000MC) + /* 3000MC/P stuff */ // Config Adjacent channels Perf -cal22 static struct dibx000_agc_config dib3000p_mt2060_agc_config = { @@ -242,8 +244,6 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = { .agc2_slope2 = 0x1e, }; -#if IS_ENABLED(CONFIG_DVB_DIB3000MC) - static struct dib3000mc_config mod3000p_dib3000p_config = { &dib3000p_panasonic_agc_config, -- 2.7.0
Re: regmap: mmio: regression in pre-v4.6-rc1
On Wed, Mar 23, 2016 at 09:48:42AM +0100, Alexander Stein wrote: Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to. > I'm currently trying to get PCIe working on LS1021A (little-endian > ARM). For link-detection I need access to a syscon perpheral (SCFG) > which is attched to CPU as big-endian. Are you *sure* that this is actually big endian? Are you basing this on documentation or on what happened to work for you in the past. > Based on current linus's master (a24e3d414e59ac765, "Merge branch > 'akpm' (patches from Andrew)") I noticed the access is actually done > as little-endian. I could track it down to commit 922a9f936e40001f > ("regmap: mmio: Convert to regmap_bus and fix accessor usage"). > Reverting it, the access is fine now and I get my PCIe link. Have you tried tracing through the code to see what ends up happening to the I/O? It should come out using your architecture's big endian accessors. signature.asc Description: PGP signature
[PATCH] i40iw: avoid potential uninitialized variable use
gcc finds that the i40iw_make_cm_node() function in the recently added i40iw driver uses an uninitilized variable as an index into an array if CONFIG_IPV6 is disabled and the driver uses IPv6 mode: drivers/infiniband/hw/i40iw/i40iw_cm.c: In function 'i40iw_make_cm_node': drivers/infiniband/hw/i40iw/i40iw_cm.c:2206:52: error: 'arpindex' may be used uninitialized in this function [-Werror=maybe-uninitialized] ether_addr_copy(cm_node->rem_mac, iwdev->arp_table[arpindex].mac_addr); As far as I can tell, this code path can not be used because the ipv4 variable is always set with CONFIG_IPV6 is disabled, but it's better to be sure and prevent the undefined behavior, as well as shut up that warning in a proper way. This adds an 'else' clause for the case we get the warning about, causing the function to return an error in a controlled way. To avoid adding extra mess with combined io()/#ifdef clauses, I'm also converting the existing #ifdef into a more readable if(IS_ENABLED()) check. Signed-off-by: Arnd Bergmann Fixes: f27b4746f378 ("i40iw: add connection management code") --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 92745d755272..38f917a6c778 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -1992,7 +1992,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device *iwdev, /** * i40iw_get_dst_ipv6 */ -#if IS_ENABLED(CONFIG_IPV6) static struct dst_entry *i40iw_get_dst_ipv6(struct sockaddr_in6 *src_addr, struct sockaddr_in6 *dst_addr) { @@ -2008,7 +2007,6 @@ static struct dst_entry *i40iw_get_dst_ipv6(struct sockaddr_in6 *src_addr, dst = ip6_route_output(&init_net, NULL, &fl6); return dst; } -#endif /** * i40iw_addr_resolve_neigh_ipv6 - resolve neighbor ipv6 address @@ -2016,7 +2014,6 @@ static struct dst_entry *i40iw_get_dst_ipv6(struct sockaddr_in6 *src_addr, * @dst_ip: remote ip address * @arpindex: if there is an arp entry */ -#if IS_ENABLED(CONFIG_IPV6) static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev, u32 *src, u32 *dest, @@ -2089,7 +2086,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev, dst_release(dst); return rc; } -#endif /** * i40iw_ipv4_is_loopback - check if loopback @@ -2190,13 +2186,13 @@ static struct i40iw_cm_node *i40iw_make_cm_node( cm_info->loc_addr[0], cm_info->rem_addr[0], oldarpindex); -#if IS_ENABLED(CONFIG_IPV6) - else + else if (IS_ENABLED(CONFIG_IPV6)) arpindex = i40iw_addr_resolve_neigh_ipv6(iwdev, cm_info->loc_addr, cm_info->rem_addr, oldarpindex); -#endif + else + arpindex = -EINVAL; } if (arpindex < 0) { i40iw_pr_err("cm_node arpindex\n"); -- 2.7.0
[PATCH] mfd: syscon: include errno.h from header
The syscon header uses the ENOTSUPP error constant, but doesn't include the header that defines it. This causes a build error after the imx pinctrl driver started using syscon: include/linux/mfd/syscon.h: In function 'syscon_node_to_regmap': include/linux/mfd/syscon.h:32:18: error: 'ENOTSUPP' undeclared (first use in this function) return ERR_PTR(-ENOTSUPP); ^~~~ This adds the missing #include. Signed-off-by: Arnd Bergmann Fixes: 8626ada871f1 ("pinctrl: imx: attach iomuxc device to gpr syscon") --- include/linux/mfd/syscon.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index 1088149be0c9..40a76b97b7ab 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h @@ -16,6 +16,7 @@ #define __LINUX_MFD_SYSCON_H__ #include +#include struct device_node; -- 2.7.0