stable rc 4.4 build breaks on arm64, arm, x86_64 and i386.
Here are the build log failures on arm64.
git_repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
target_arch: arm64
toolchain: gcc-9
git_short_log: 0b3898baf614 (\Linux 4.4.233-rc1\)
git_sha: 0b3898baf61459e1f963dcf893b4683174668975
git_describe: v4.4.232-33-g0b3898baf614
kernel_version: 4.4.233-rc1
make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j16 ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build Image
#
../arch/arm64/kernel/hw_breakpoint.c: In function ‘arch_bp_generic_fields’:
../arch/arm64/kernel/hw_breakpoint.c:348:5: note: parameter passing
for argument of type ‘struct arch_hw_breakpoint_ctrl’ changed in GCC
9.1
348 | int arch_bp_generic_fields(struct arch_hw_breakpoint_ctrl ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~
../fs/ext4/inode.c: In function ‘ext4_direct_IO’:
../fs/ext4/inode.c:3355:9: error: ‘offset’ redeclared as different
kind of symbol
3355 | loff_t offset = iocb->ki_pos;
| ^~~~~~
../fs/ext4/inode.c:3349:17: note: previous definition of ‘offset’ was here
3349 | loff_t offset)
| ~~~~~~~^~~~~~
make[3]: *** [../scripts/Makefile.build:277: fs/ext4/inode.o] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [../scripts/Makefile.build:484: fs/ext4] Error 2
../drivers/net/ethernet/apm/xgene/xgene_enet_main.c:32:36: warning:
array ‘xgene_enet_acpi_match’ assumed to have one element
32 | static const struct acpi_device_id xgene_enet_acpi_match[];
| ^~~~~~~~~~~~~~~~~~~~~
make[2]: Target '__build' not remade because of errors.
make[1]: *** [/linux/Makefile:1006: fs] Error 2
make[1]: Target 'Image' not remade because of errors.
make: *** [Makefile:152: sub-make] Error 2
make: Target 'Image' not remade because of errors.
--
Linaro LKFT
https://lkft.linaro.org
From: Mike Rapoport <rppt(a)linux.ibm.com>
When a configuration has NUMA disabled and SGI_IP27 enabled, the build
fails:
CC kernel/bounds.s
CC arch/mips/kernel/asm-offsets.s
In file included from arch/mips/include/asm/topology.h:11,
from include/linux/topology.h:36,
from include/linux/gfp.h:9,
from include/linux/slab.h:15,
from include/linux/crypto.h:19,
from include/crypto/hash.h:11,
from include/linux/uio.h:10,
from include/linux/socket.h:8,
from include/linux/compat.h:15,
from arch/mips/kernel/asm-offsets.c:12:
include/linux/topology.h: In function 'numa_node_id':
arch/mips/include/asm/mach-ip27/topology.h:16:27: error: implicit declaration of function 'cputonasid'; did you mean 'cpu_vpe_id'? [-Werror=implicit-function-declaration]
#define cpu_to_node(cpu) (cputonasid(cpu))
^~~~~~~~~~
include/linux/topology.h:119:9: note: in expansion of macro 'cpu_to_node'
return cpu_to_node(raw_smp_processor_id());
^~~~~~~~~~~
include/linux/topology.h: In function 'cpu_cpu_mask':
arch/mips/include/asm/mach-ip27/topology.h:19:7: error: implicit declaration of function 'hub_data' [-Werror=implicit-function-declaration]
&hub_data(node)->h_cpus)
^~~~~~~~
include/linux/topology.h:210:9: note: in expansion of macro 'cpumask_of_node'
return cpumask_of_node(cpu_to_node(cpu));
^~~~~~~~~~~~~~~
arch/mips/include/asm/mach-ip27/topology.h:19:21: error: invalid type argument of '->' (have 'int')
&hub_data(node)->h_cpus)
^~
include/linux/topology.h:210:9: note: in expansion of macro 'cpumask_of_node'
return cpumask_of_node(cpu_to_node(cpu));
^~~~~~~~~~~~~~~
Before switch from discontigmem to sparsemem, there always was
CONFIG_NEED_MULTIPLE_NODES=y because it was selected by DISCONTIGMEM.
Without DISCONTIGMEM it is possible to have SPARSEMEM without NUMA for
SGI_IP27 and as many things there rely on custom node definition, the
build breaks.
As Thomas noted "... there are right now too many places in IP27 code,
which assumes NUMA enabled", the simplest solution would be to always
enable NUMA for SGI-IP27 builds.
Reported-by: kernel test robot <lkp(a)intel.com>
Fixes: 397dc00e249e ("mips: sgi-ip27: switch from DISCONTIGMEM to SPARSEMEM")
Cc: stable(a)vger.kernel.org
Signed-off-by: Mike Rapoport <rppt(a)linux.ibm.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 6fee1a133e9d..a7e40bb1e5bc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -678,6 +678,7 @@ config SGI_IP27
select SYS_SUPPORTS_NUMA
select SYS_SUPPORTS_SMP
select MIPS_L1_CACHE_SHIFT_7
+ select NUMA
help
This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
workstations. To compile a Linux kernel that runs on these, say Y
--
2.26.2
stable rc 4.9 build breaks on arm64, arm, x86_64 and i386.
Here are the build log failures on arm64.
git_repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
target_arch: arm64
toolchain: gcc-9
git_short_log: 1f47445197d2 (\Linux 4.9.233-rc1\)
git_sha: 1f47445197d2c8eecafa2b996f635aa89851c123
git_describe: v4.9.232-51-g1f47445197d2
kernel_version: 4.9.233-rc1
make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j16 ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build Image
#
../arch/arm64/kernel/hw_breakpoint.c: In function ‘arch_bp_generic_fields’:
../arch/arm64/kernel/hw_breakpoint.c:352:5: note: parameter passing
for argument of type ‘struct arch_hw_breakpoint_ctrl’ changed in GCC
9.1
352 | int arch_bp_generic_fields(struct arch_hw_breakpoint_ctrl ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~
../fs/ext4/inode.c: In function ‘ext4_direct_IO’:
../fs/ext4/inode.c:3610:9: error: redefinition of ‘offset’
3610 | loff_t offset = iocb->ki_pos;
| ^~~~~~
../fs/ext4/inode.c:3608:9: note: previous definition of ‘offset’ was here
3608 | loff_t offset = iocb->ki_pos;
| ^~~~~~
make[3]: *** [../scripts/Makefile.build:304: fs/ext4/inode.o] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [../scripts/Makefile.build:555: fs/ext4] Error 2
../lib/vsprintf.c: In function ‘number’:
../lib/vsprintf.c:399:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
399 | char *number(char *buf, char *end, unsigned long long num,
| ^~~~~~
../lib/vsprintf.c: In function ‘widen_string’:
../lib/vsprintf.c:562:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
562 | char *widen_string(char *buf, int n, char *end, struct printf_spec spec)
| ^~~~~~~~~~~~
../lib/vsprintf.c: In function ‘string’:
../lib/vsprintf.c:583:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
583 | char *string(char *buf, char *end, const char *s, struct
printf_spec spec)
| ^~~~~~
../lib/vsprintf.c: In function ‘hex_string’:
../lib/vsprintf.c:803:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
803 | char *hex_string(char *buf, char *end, u8 *addr, struct
printf_spec spec,
| ^~~~~~~~~~
../lib/vsprintf.c: In function ‘mac_address_string’:
../lib/vsprintf.c:936:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
936 | char *mac_address_string(char *buf, char *end, u8 *addr,
| ^~~~~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘ip4_addr_string’:
../lib/vsprintf.c:1137:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1137 | char *ip4_addr_string(char *buf, char *end, const u8 *addr,
| ^~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘uuid_string’:
../lib/vsprintf.c:1305:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1305 | char *uuid_string(char *buf, char *end, const u8 *addr,
| ^~~~~~~~~~~
../lib/vsprintf.c: In function ‘symbol_string’:
../lib/vsprintf.c:668:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
668 | char *symbol_string(char *buf, char *end, void *ptr,
| ^~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘resource_string’:
../lib/vsprintf.c:695:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
695 | char *resource_string(char *buf, char *end, struct resource *res,
| ^~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘ip6_addr_string’:
../lib/vsprintf.c:1123:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1123 | char *ip6_addr_string(char *buf, char *end, const u8 *addr,
| ^~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘ip4_addr_string_sa’:
../lib/vsprintf.c:1210:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1210 | char *ip4_addr_string_sa(char *buf, char *end, const struct
sockaddr_in *sa,
| ^~~~~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘ip6_addr_string_sa’:
../lib/vsprintf.c:1148:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1148 | char *ip6_addr_string_sa(char *buf, char *end, const struct
sockaddr_in6 *sa,
| ^~~~~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘escaped_string’:
../lib/vsprintf.c:1245:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1245 | char *escaped_string(char *buf, char *end, u8 *addr, struct
printf_spec spec,
| ^~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘dentry_name’:
../lib/vsprintf.c:604:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
604 | char *dentry_name(char *buf, char *end, const struct dentry
*d, struct printf_spec spec,
| ^~~~~~~~~~~
../lib/vsprintf.c: In function ‘clock.isra.0’:
../lib/vsprintf.c:1387:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1387 | char *clock(char *buf, char *end, struct clk *clk, struct
printf_spec spec,
| ^~~~~
../lib/vsprintf.c: In function ‘bitmap_list_string.isra.0’:
../lib/vsprintf.c:896:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
896 | char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap,
| ^~~~~~~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘bitmap_string.isra.0’:
../lib/vsprintf.c:855:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
855 | char *bitmap_string(char *buf, char *end, unsigned long *bitmap,
| ^~~~~~~~~~~~~
../lib/vsprintf.c: In function ‘bdev_name.isra.0’:
../lib/vsprintf.c:649:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
649 | char *bdev_name(char *buf, char *end, struct block_device *bdev,
| ^~~~~~~~~
../lib/vsprintf.c: In function ‘pointer’:
../lib/vsprintf.c:1571:7: note: parameter passing for argument of type
‘struct printf_spec’ changed in GCC 9.1
1571 | char *pointer(const char *fmt, char *buf, char *end, void *ptr,
| ^~~~~~~
make[2]: Target '__build' not remade because of errors.
make[1]: *** [/linux/Makefile:1036: fs] Error 2
make[1]: Target 'Image' not remade because of errors.
make: *** [Makefile:152: sub-make] Error 2
make: Target 'Image' not remade because of errors.
--
Linaro LKFT
https://lkft.linaro.org
There are a few issues in DWC3 driver when preparing for TRB.
The driver needs to account the following:
* MPS alignment for ZLP OUT direction
* Extra TRBs when checking for available TRBs
* SG entries size > request length
Along with these fixes, there are some cleanup/refactoring patches in this
series .
Thinh Nguyen (7):
usb: dwc3: gadget: Don't setup more than requested
usb: dwc3: gadget: Fix handling ZLP
usb: dwc3: gadget: Handle ZLP for sg requests
usb: dwc3: gadget: Refactor preparing TRBs
usb: dwc3: gadget: Account for extra TRB
usb: dwc3: gadget: Rename misleading function names
usb: dwc3: ep0: Skip ZLP setup for OUT
drivers/usb/dwc3/ep0.c | 2 +-
drivers/usb/dwc3/gadget.c | 232 ++++++++++++++++++++++----------------
2 files changed, 137 insertions(+), 97 deletions(-)
base-commit: e3ee0e740c3887d2293e8d54a8707218d70d86ca
--
2.28.0
This patch is used to fix ext4 direct I/O read error when
the read size is not aligned with block size.
Then, I will use a test to explain the error.
(1) Make a file that is not aligned with block size:
$dd if=/dev/zero of=./test.jar bs=1000 count=3
(2) I wrote a source file named "direct_io_read_file.c" as following:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#define BUF_SIZE 1024
int main()
{
int fd;
int ret;
unsigned char *buf;
ret = posix_memalign((void **)&buf, 512, BUF_SIZE);
if (ret) {
perror("posix_memalign failed");
exit(1);
}
fd = open("./test.jar", O_RDONLY | O_DIRECT, 0755);
if (fd < 0){
perror("open ./test.jar failed");
exit(1);
}
do {
ret = read(fd, buf, BUF_SIZE);
printf("ret=%d\n",ret);
if (ret < 0) {
perror("write test.jar failed");
}
} while (ret > 0);
free(buf);
close(fd);
}
(3) Compile the source file:
$gcc direct_io_read_file.c -D_GNU_SOURCE
(4) Run the test program:
$./a.out
The result is as following:
ret=1024
ret=1024
ret=952
ret=-1
write test.jar failed: Invalid argument.
I have tested this program on XFS filesystem, XFS does not have
this problem, because XFS use iomap_dio_rw() to do direct I/O
read. And the comparing between read offset and file size is done
in iomap_dio_rw(), the code is as following:
if (pos < size) {
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
if (!retval) {
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
}
...
}
...only when "pos < size", direct I/O can be done, or 0 will be return.
I have tested the fix patch on Ext4, it is up to the mustard of
EINVAL in man2(read) as following:
#include <unistd.h>
ssize_t read(int fd, void *buf, size_t count);
EINVAL
fd is attached to an object which is unsuitable for reading;
or the file was opened with the O_DIRECT flag, and either the
address specified in buf, the value specified in count, or the
current file offset is not suitably aligned.
So I think this patch can be applied to fix ext4 direct I/O error.
However Ext4 introduces direct I/O read using iomap infrastructure
on kernel 5.5, the patch is commit <b1b4705d54ab>
("ext4: introduce direct I/O read using iomap infrastructure"),
then Ext4 will be the same as XFS, they all use iomap_dio_rw() to do direct
I/O read. So this problem does not exist on kernel 5.5 for Ext4.
>From above description, we can see this problem exists on all the kernel
versions between kernel 3.14 and kernel 5.4. It will cause the Applications
to fail to read. For example, when the search service downloads a new full
index file, the search engine is loading the previous index file and is
processing the search request, it can not use buffer io that may squeeze
the previous index file in use from pagecache, so the serch service must
use direct I/O read.
Please apply this patch on these kernel versions, or please use the method
on kernel 5.5 to fix this problem.
Fixes: 9fe55eea7e4b ("Fix race when checking i_size on direct i/o read")
Reviewed-by: Jan Kara <jack(a)suse.cz>
Co-developed-by: Wang Long <wanglong19(a)meituan.com>
Signed-off-by: Wang Long <wanglong19(a)meituan.com>
Signed-off-by: Jiang Ying <jiangying8582(a)126.com>
Changes since V3:
Add the info: this bug could break some application that use the
stable kernel releases.
Changes since V2:
Optimize the description of the commit message and make a variation for
the patch, e.g. with:
Before:
loff_t size;
size = i_size_read(inode);
After:
loff_t size = i_size_read(inode);
Changes since V1:
Signed-off use real name and add "Fixes:" flag
---
fs/ext4/inode.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 516faa2..a66b0ac 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3821,6 +3821,11 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter)
struct inode *inode = mapping->host;
size_t count = iov_iter_count(iter);
ssize_t ret;
+ loff_t offset = iocb->ki_pos;
+ loff_t size = i_size_read(inode);
+
+ if (offset >= size)
+ return 0;
/*
* Shared inode_lock is enough for us - it protects against concurrent
--
1.8.3.1