----- Original Message ----- > From: "CAI Qian" <caiqian@xxxxxxxxxx> > To: "Al Viro" <viro@xxxxxxxxxxxxxxxxxx> > Cc: "Linus Torvalds" <torvalds@xxxxxxxxxxxxxxxxxxxx>, "Dave Chinner" <david@xxxxxxxxxxxxx>, "linux-xfs" > <linux-xfs@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, "Jens Axboe" <axboe@xxxxxxxxx>, "Nick Piggin" <npiggin@xxxxxxxxx>, > linux-fsdevel@xxxxxxxxxxxxxxx > Sent: Friday, September 30, 2016 9:32:53 AM > Subject: Re: [RFC][CFT] splice_read reworked > > > > ----- Original Message ----- > > From: "Al Viro" <viro@xxxxxxxxxxxxxxxxxx> > > To: "Linus Torvalds" <torvalds@xxxxxxxxxxxxxxxxxxxx> > > Cc: "Dave Chinner" <david@xxxxxxxxxxxxx>, "CAI Qian" <caiqian@xxxxxxxxxx>, > > "linux-xfs" <linux-xfs@xxxxxxxxxxxxxxx>, > > xfs@xxxxxxxxxxx, "Jens Axboe" <axboe@xxxxxxxxx>, "Nick Piggin" > > <npiggin@xxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx > > Sent: Friday, September 23, 2016 3:00:32 PM > > Subject: [RFC][CFT] splice_read reworked > > > > The series is supposed to solve the locking order problems for > > ->splice_read() and get rid of code duplication between the read-side > > methods. > > pipe_lock is lifted out of ->splice_read() instances, along with > > waiting for empty space in pipe, etc. - we do that stuff in callers. > > A new variant of iov_iter is introduced - it's backed by a pipe, > > copy_to_iter() results in allocating pages and copying into those, > > copy_page_to_iter() just sticks a reference to that page into pipe. > > Running out of space in pipe yields a short read, as a fault in > > iovec-backed > > iov_iter would have. Enough primitives are implemented for normal > > ->read_iter() instances to work. > > generic_file_splice_read() switched to feeding such iov_iter to > > ->read_iter() instance. That turns out to be enough to kill almost all > > ->splice_read() instances; the only ones _not_ using > > generic_file_splice_read() > > or default_file_splice_read() (== no zero-copy fallback) are > > fuse_dev_splice_read(), 3 instances in kernel/{relay.c,trace/trace.c} and > > sock_splice_read(). It's almost certainly possible to convert fuse one > > and the same might be possible to do to socket one. relay and tracing > > stuff is just plain weird; might or might not be doable. > > > > Something hopefully working is in > > git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git > > #work.splice_read > Tested-by: CAI Qian <caiqian@xxxxxxxxxx> Except... One warning just pop up while running trinity. [ 1599.151286] ------------[ cut here ]------------ [ 1599.156457] WARNING: CPU: 37 PID: 95143 at lib/iov_iter.c:316 sanity+0x75/0x80 [ 1599.164818] Modules linked in: af_key ieee802154_socket ieee802154 vmw_vsock_vmci_transport vsock vmw_vmci hidp cmtp kernelcapi bnep rfcomm bluetooth rfkill can_bcm can_raw can pptp gre l2tp_ppp l2tp_netlink l2tp_core ip6_udp_tunnel udp_tunnel pppoe pppox ppp_generic slhc nfnetlink scsi_transport_iscsi atm sctp ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 xt_addrtype iptable_filter xt_conntrack nf_nat nf_conntrack br_netfilter bridge stp llc overlay intel_rapl sb_edac edac_core x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd iTCO_wdt iTCO_vendor_support pcspkr mei_me sg i2c_i801 mei shpchp lpc_ich i2c_smbus ipmi_ssif wmi ipmi_si ipmi_msghandler acpi_power_meter acpi_pad nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod sr_mod cdrom mgag200 i2c_algo_bit drm_kms_helper syscopyarea s ysfillrect sysimgblt fb_sys_fops crc32c_intel ttm ixgbe drm ahci mdio libahci ptp libata i2c_core pps_core dca fjes dm_mirror dm_region_hash dm_log dm_mod [ 1599.278669] CPU: 50 PID: 95143 Comm: trinity-c142 Not tainted 4.8.0-rc8-usrns-scale+ #8 [ 1599.287604] Hardware name: Intel Corporation S2600WTT/S2600WTT, BIOS GRNDSDP1.86B.0044.R00.1501191641 01/19/2015 [ 1599.298962] 0000000000000286 000000007794c41e ffff8803c6c7fbb0 ffffffff813d5e93 [ 1599.307259] 0000000000000000 0000000000000000 ffff8803c6c7fbf0 ffffffff8109c87b [ 1599.315553] 0000013c00000000 0000000000000efe ffffea001de95240 ffff8802e1aca600 [ 1599.323847] Call Trace: [ 1599.326580] [<ffffffff813d5e93>] dump_stack+0x85/0xc2 [ 1599.332315] [<ffffffff8109c87b>] __warn+0xcb/0xf0 [ 1599.337660] [<ffffffff8109c9ad>] warn_slowpath_null+0x1d/0x20 [ 1599.344171] [<ffffffff813e9b45>] sanity+0x75/0x80 [ 1599.349518] [<ffffffff813ec739>] copy_page_to_iter+0xf9/0x1e0 [ 1599.356027] [<ffffffff8120691f>] shmem_file_read_iter+0x9f/0x340 [ 1599.362829] [<ffffffff812bbeb9>] generic_file_splice_read+0xb9/0x1b0 [ 1599.370015] [<ffffffff812bc206>] do_splice_to+0x76/0x90 [ 1599.375941] [<ffffffff812bc2db>] splice_direct_to_actor+0xbb/0x220 [ 1599.382935] [<ffffffff812bba80>] ? generic_pipe_buf_nosteal+0x10/0x10 [ 1599.390220] [<ffffffff812bc4d8>] do_splice_direct+0x98/0xd0 [ 1599.396537] [<ffffffff81281dd1>] do_sendfile+0x1d1/0x3b0 [ 1599.402563] [<ffffffff81282973>] SyS_sendfile64+0x73/0xd0 [ 1599.408685] [<ffffffff81003f8c>] do_syscall_64+0x6c/0x1e0 [ 1599.414820] [<ffffffff817d927f>] entry_SYSCALL64_slow_path+0x25/0x25 [ 1599.422087] ---[ end trace a3fb2953df356f80 ]--- CAI Qian _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs