Merge ra.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux
All conflicts were trivial overlapping changes, so reasonably easy to resolve. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
49
samples/bpf/.gitignore
vendored
Normal file
49
samples/bpf/.gitignore
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
cpustat
|
||||
fds_example
|
||||
lathist
|
||||
load_sock_ops
|
||||
lwt_len_hist
|
||||
map_perf_test
|
||||
offwaketime
|
||||
per_socket_stats_example
|
||||
sampleip
|
||||
sock_example
|
||||
sockex1
|
||||
sockex2
|
||||
sockex3
|
||||
spintest
|
||||
syscall_nrs.h
|
||||
syscall_tp
|
||||
task_fd_query
|
||||
tc_l2_redirect
|
||||
test_cgrp2_array_pin
|
||||
test_cgrp2_attach
|
||||
test_cgrp2_attach2
|
||||
test_cgrp2_sock
|
||||
test_cgrp2_sock2
|
||||
test_current_task_under_cgroup
|
||||
test_lru_dist
|
||||
test_map_in_map
|
||||
test_overhead
|
||||
test_probe_write_user
|
||||
trace_event
|
||||
trace_output
|
||||
tracex1
|
||||
tracex2
|
||||
tracex3
|
||||
tracex4
|
||||
tracex5
|
||||
tracex6
|
||||
tracex7
|
||||
xdp1
|
||||
xdp2
|
||||
xdp_adjust_tail
|
||||
xdp_fwd
|
||||
xdp_monitor
|
||||
xdp_redirect
|
||||
xdp_redirect_cpu
|
||||
xdp_redirect_map
|
||||
xdp_router_ipv4
|
||||
xdp_rxq_info
|
||||
xdp_tx_iptunnel
|
||||
xdpsock
|
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#define KBUILD_MODNAME "foo"
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/in.h>
|
||||
@@ -108,11 +109,6 @@ static int parse_ipv6(void *data, uint64_t nh_off, void *data_end)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct vlan_hdr {
|
||||
uint16_t h_vlan_TCI;
|
||||
uint16_t h_vlan_encapsulated_proto;
|
||||
};
|
||||
|
||||
SEC("varlen")
|
||||
int handle_ingress(struct __sk_buff *skb)
|
||||
{
|
||||
|
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <asm/unistd.h>
|
||||
@@ -44,8 +45,13 @@ static void test_task_rename(int cpu)
|
||||
exit(1);
|
||||
}
|
||||
start_time = time_get_ns();
|
||||
for (i = 0; i < MAX_CNT; i++)
|
||||
write(fd, buf, sizeof(buf));
|
||||
for (i = 0; i < MAX_CNT; i++) {
|
||||
if (write(fd, buf, sizeof(buf)) < 0) {
|
||||
printf("task rename failed: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
printf("task_rename:%d: %lld events per sec\n",
|
||||
cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
|
||||
close(fd);
|
||||
@@ -63,8 +69,13 @@ static void test_urandom_read(int cpu)
|
||||
exit(1);
|
||||
}
|
||||
start_time = time_get_ns();
|
||||
for (i = 0; i < MAX_CNT; i++)
|
||||
read(fd, buf, sizeof(buf));
|
||||
for (i = 0; i < MAX_CNT; i++) {
|
||||
if (read(fd, buf, sizeof(buf)) < 0) {
|
||||
printf("failed to read from /dev/urandom: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
printf("urandom_read:%d: %lld events per sec\n",
|
||||
cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
|
||||
close(fd);
|
||||
|
@@ -122,6 +122,16 @@ static void print_stacks(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline int generate_load(void)
|
||||
{
|
||||
if (system("dd if=/dev/zero of=/dev/null count=5000k status=none") < 0) {
|
||||
printf("failed to generate some load with dd: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_perf_event_all_cpu(struct perf_event_attr *attr)
|
||||
{
|
||||
int nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
@@ -142,7 +152,11 @@ static void test_perf_event_all_cpu(struct perf_event_attr *attr)
|
||||
assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
|
||||
assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE) == 0);
|
||||
}
|
||||
system("dd if=/dev/zero of=/dev/null count=5000k status=none");
|
||||
|
||||
if (generate_load() < 0) {
|
||||
error = 1;
|
||||
goto all_cpu_err;
|
||||
}
|
||||
print_stacks();
|
||||
all_cpu_err:
|
||||
for (i--; i >= 0; i--) {
|
||||
@@ -156,7 +170,7 @@ all_cpu_err:
|
||||
|
||||
static void test_perf_event_task(struct perf_event_attr *attr)
|
||||
{
|
||||
int pmu_fd;
|
||||
int pmu_fd, error = 0;
|
||||
|
||||
/* per task perf event, enable inherit so the "dd ..." command can be traced properly.
|
||||
* Enabling inherit will cause bpf_perf_prog_read_time helper failure.
|
||||
@@ -171,10 +185,17 @@ static void test_perf_event_task(struct perf_event_attr *attr)
|
||||
}
|
||||
assert(ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
|
||||
assert(ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE) == 0);
|
||||
system("dd if=/dev/zero of=/dev/null count=5000k status=none");
|
||||
|
||||
if (generate_load() < 0) {
|
||||
error = 1;
|
||||
goto err;
|
||||
}
|
||||
print_stacks();
|
||||
err:
|
||||
ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE);
|
||||
close(pmu_fd);
|
||||
if (error)
|
||||
int_exit(0);
|
||||
}
|
||||
|
||||
static void test_bpf_perf_event(void)
|
||||
|
@@ -16,8 +16,8 @@
|
||||
BPF_FILE=xdp2skb_meta_kern.o
|
||||
DIR=$(dirname $0)
|
||||
|
||||
export TC=/usr/sbin/tc
|
||||
export IP=/usr/sbin/ip
|
||||
[ -z "$TC" ] && TC=tc
|
||||
[ -z "$IP" ] && IP=ip
|
||||
|
||||
function usage() {
|
||||
echo ""
|
||||
@@ -53,7 +53,7 @@ function _call_cmd() {
|
||||
local allow_fail="$2"
|
||||
shift 2
|
||||
if [[ -n "$VERBOSE" ]]; then
|
||||
echo "$(basename $cmd) $@"
|
||||
echo "$cmd $@"
|
||||
fi
|
||||
if [[ -n "$DRYRUN" ]]; then
|
||||
return
|
||||
|
@@ -729,7 +729,7 @@ static void kick_tx(int fd)
|
||||
int ret;
|
||||
|
||||
ret = sendto(fd, NULL, 0, MSG_DONTWAIT, NULL, 0);
|
||||
if (ret >= 0 || errno == ENOBUFS || errno == EAGAIN)
|
||||
if (ret >= 0 || errno == ENOBUFS || errno == EAGAIN || errno == EBUSY)
|
||||
return;
|
||||
lassert(0);
|
||||
}
|
||||
|
@@ -178,6 +178,8 @@ static const char *vbe_name(u32 index)
|
||||
return "(invalid)";
|
||||
}
|
||||
|
||||
static struct page *__mbochs_get_page(struct mdev_state *mdev_state,
|
||||
pgoff_t pgoff);
|
||||
static struct page *mbochs_get_page(struct mdev_state *mdev_state,
|
||||
pgoff_t pgoff);
|
||||
|
||||
@@ -394,7 +396,7 @@ static ssize_t mdev_access(struct mdev_device *mdev, char *buf, size_t count,
|
||||
MBOCHS_MEMORY_BAR_OFFSET + mdev_state->memsize) {
|
||||
pos -= MBOCHS_MMIO_BAR_OFFSET;
|
||||
poff = pos & ~PAGE_MASK;
|
||||
pg = mbochs_get_page(mdev_state, pos >> PAGE_SHIFT);
|
||||
pg = __mbochs_get_page(mdev_state, pos >> PAGE_SHIFT);
|
||||
map = kmap(pg);
|
||||
if (is_write)
|
||||
memcpy(map + poff, buf, count);
|
||||
@@ -657,7 +659,7 @@ static void mbochs_put_pages(struct mdev_state *mdev_state)
|
||||
dev_dbg(dev, "%s: %d pages released\n", __func__, count);
|
||||
}
|
||||
|
||||
static int mbochs_region_vm_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t mbochs_region_vm_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
struct mdev_state *mdev_state = vma->vm_private_data;
|
||||
@@ -695,7 +697,7 @@ static int mbochs_mmap(struct mdev_device *mdev, struct vm_area_struct *vma)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mbochs_dmabuf_vm_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t mbochs_dmabuf_vm_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
struct mbochs_dmabuf *dmabuf = vma->vm_private_data;
|
||||
@@ -803,15 +805,6 @@ static void mbochs_release_dmabuf(struct dma_buf *buf)
|
||||
mutex_unlock(&mdev_state->ops_lock);
|
||||
}
|
||||
|
||||
static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf,
|
||||
unsigned long page_num)
|
||||
{
|
||||
struct mbochs_dmabuf *dmabuf = buf->priv;
|
||||
struct page *page = dmabuf->pages[page_num];
|
||||
|
||||
return kmap_atomic(page);
|
||||
}
|
||||
|
||||
static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
|
||||
{
|
||||
struct mbochs_dmabuf *dmabuf = buf->priv;
|
||||
@@ -820,12 +813,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
|
||||
return kmap(page);
|
||||
}
|
||||
|
||||
static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
|
||||
void *vaddr)
|
||||
{
|
||||
kunmap(vaddr);
|
||||
}
|
||||
|
||||
static struct dma_buf_ops mbochs_dmabuf_ops = {
|
||||
.map_dma_buf = mbochs_map_dmabuf,
|
||||
.unmap_dma_buf = mbochs_unmap_dmabuf,
|
||||
.release = mbochs_release_dmabuf,
|
||||
.map_atomic = mbochs_kmap_atomic_dmabuf,
|
||||
.map = mbochs_kmap_dmabuf,
|
||||
.unmap = mbochs_kunmap_dmabuf,
|
||||
.mmap = mbochs_mmap_dmabuf,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user