Skip to content

Commit

Permalink
Upgrade to run under Linux 6.10.6
Browse files Browse the repository at this point in the history
* Renamed install script to install_homa to avoid conflicts
  with the Linux install program
* Reworked the timetracing mechanism used by the main Linux
  kernel to avoid header file conflicts
  • Loading branch information
johnousterhout committed Sep 6, 2024
1 parent 840e54a commit df0daa5
Show file tree
Hide file tree
Showing 24 changed files with 381 additions and 338 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ This repo contains an implementation of the Homa transport protocol as a Linux k
- Please contact me if you have any problems using this repo; I'm happy to
provide advice and support.

- The head is known to work under Linux 6.1.38. In the past, Homa has
run under several earlier versions of Linux, including 5.17.7,
5.4.80, and 4.15.18. There is a separate branch for each of these
older versions, with a names such as linux_4.15.18. Older branches are
- The head is known to work under Linux 6.10.6. In the past, Homa has
run under several earlier versions of Linux. There is a separate branch
for each of these
older versions, with names such as linux_4.15.18. Older branches are
out of date feature-wise: recent commits have not been back-ported to them.
Other versions of Linux have not been tested and
may require code changes (these upgrades rarely take more than a couple
Expand All @@ -47,7 +47,7 @@ This repo contains an implementation of the Homa transport protocol as a Linux k
invoke it with no parameters to install and configure Homa on the current
machine.

- The script `cloudlab/bin/install` will copy relevant Homa files
- The script `cloudlab/bin/install_homa` will copy relevant Homa files
across a cluster of machines and configure Homa on each node. It assumes
that nodes have names `nodeN` where N is a small integer, and it also
assumes that you have already run `make` both in the top-level directory and
Expand Down
6 changes: 3 additions & 3 deletions cloudlab/bin/install → cloudlab/bin/install_homa
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# or more target machines; it also loads the Homa kernel module.
#
# Usage:
# install num_nodes [first]
# install_homa num_nodes [first]
#
# The "num_nodes" arguments indicates how many servers should be updated.
# The "first" argument is optional; it is an integer identifying the
Expand All @@ -24,15 +24,15 @@ if [ $# -eq 2 ]; then
elif [ $# -eq 1 ]; then
first=0
else
echo "Usage: install num_nodes [first]"
echo "Usage: install_homa num_nodes [first]"
exit 1
fi
last=`expr $first + $1 - 1` || true

for ((i = $first ; i <= $last; i++)); do
node=node$i
echo
echo '*** Installing on' $node '***'
echo '*** Installing Homa on' $node '***'
rsync --ipv4 -e "ssh -4 -o StrictHostKeyChecking=no" -rtv ~/.bashrc ~/.bash_profile ~/.gdbinit $node:
rsync --ipv4 -e "ssh -4 -o StrictHostKeyChecking=no" -rtv --exclude __pycache__ ~/bin/ $node:bin/
rsync --ipv4 -e "ssh -4 -o StrictHostKeyChecking=no" -rtv $root/homa.ko $root/util/cp_node $root/util/homa_prio $root/util/*.py $node:bin/
Expand Down
4 changes: 2 additions & 2 deletions homa_grant.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @rpc1: First RPC to consider.
* @rpc2: Second RPC to consider.
*/
int inline homa_grant_outranks(struct homa_rpc *rpc1, struct homa_rpc *rpc2)
inline int homa_grant_outranks(struct homa_rpc *rpc1, struct homa_rpc *rpc2)
{
/* Fewest bytes remaining is the primary criterion; if those are
* equal, then favor the older RPC.
Expand All @@ -39,7 +39,7 @@ int inline homa_grant_outranks(struct homa_rpc *rpc1, struct homa_rpc *rpc2)
* may be possible to send out additional grants to some RPCs (doing
* this is left to the caller).
*/
int inline homa_grant_update_incoming(struct homa_rpc *rpc, struct homa *homa) {
inline int homa_grant_update_incoming(struct homa_rpc *rpc, struct homa *homa) {
int incoming = rpc->msgin.granted - (rpc->msgin.length
- rpc->msgin.bytes_remaining);
if (incoming < 0)
Expand Down
85 changes: 50 additions & 35 deletions homa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
#include <linux/proc_fs.h>
#include <linux/sched/signal.h>
#include <linux/skbuff.h>
#include <linux/version.h>
#include <linux/socket.h>
#include <linux/version.h>
#include <linux/vmalloc.h>
#include <net/icmp.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/inet_common.h>
#include <net/gro.h>
#include <net/rps.h>
#pragma GCC diagnostic warning "-Wpointer-sign"
#pragma GCC diagnostic warning "-Wunused-variable"

Expand All @@ -53,53 +55,68 @@ typedef unsigned int __poll_t;
#endif

#ifdef __UNIT_TEST__
#define spin_unlock mock_spin_unlock
extern void mock_spin_unlock(spinlock_t *lock);

#undef get_cycles
#define get_cycles mock_get_cycles
extern cycles_t mock_get_cycles(void);
#undef alloc_pages
#define alloc_pages mock_alloc_pages
extern struct page *mock_alloc_pages(gfp_t gfp, unsigned order);

#define signal_pending(xxx) mock_signal_pending
extern int mock_signal_pending;

#define rcu_read_lock mock_rcu_read_lock
extern void mock_rcu_read_lock(void);
#define compound_order mock_compound_order
extern unsigned int mock_compound_order(struct page *page);

#define rcu_read_unlock mock_rcu_read_unlock
extern void mock_rcu_read_unlock(void);
#define cpu_to_node mock_cpu_to_node
extern int mock_cpu_to_node(int cpu);

#undef current
#define current current_task
extern struct task_struct *current_task;

#define kthread_complete_and_exit(comp, code)
#undef get_cycles
#define get_cycles mock_get_cycles
extern cycles_t mock_get_cycles(void);

#define get_page mock_get_page
extern void mock_get_page(struct page *page);

#undef kmalloc
#define kmalloc mock_kmalloc
extern void *mock_kmalloc(size_t size, gfp_t flags);

#define get_page mock_get_page
extern void mock_get_page(struct page *page);
#define kthread_complete_and_exit(comp, code)

#define put_page mock_put_page
extern void mock_put_page(struct page *page);
#ifdef page_address
#undef page_address
#endif
#define page_address(page) ((void *) page)

#define compound_order mock_compound_order
extern unsigned int mock_compound_order(struct page *page);
#define page_ref_count mock_page_refs
extern int mock_page_refs(struct page *page);

#define page_to_nid mock_page_to_nid
extern int mock_page_to_nid(struct page *page);

#define page_ref_count mock_page_refs
extern int mock_page_refs(struct page *page);
#define put_page mock_put_page
extern void mock_put_page(struct page *page);

#define cpu_to_node mock_cpu_to_node
extern int mock_cpu_to_node(int cpu);
#define rcu_read_lock mock_rcu_read_lock
extern void mock_rcu_read_lock(void);

#ifdef page_address
#undef page_address
#endif
#define page_address(page) ((void *) page)
#endif
#define rcu_read_unlock mock_rcu_read_unlock
extern void mock_rcu_read_unlock(void);

#undef register_net_sysctl
#define register_net_sysctl mock_register_net_sysctl
extern struct ctl_table_header *mock_register_net_sysctl(struct net *net,
const char *path, struct ctl_table *table);

#define signal_pending(xxx) mock_signal_pending
extern int mock_signal_pending;

#define spin_unlock mock_spin_unlock
extern void mock_spin_unlock(spinlock_t *lock);

#undef vmalloc
#define vmalloc mock_vmalloc
extern void *mock_vmalloc(size_t size);
#endif /* __UNIT_TEST__ */

/* Null out things that confuse VSCode Intellisense */
#ifdef __VSCODE__
Expand Down Expand Up @@ -879,7 +896,7 @@ struct homa_interest {
* of a struct homa_interest.
* @interest: Struct to initialize.
*/
static void inline homa_interest_init(struct homa_interest *interest)
inline static void homa_interest_init(struct homa_interest *interest)
{
interest->thread = current;
atomic_long_set(&interest->ready_rpc, 0);
Expand Down Expand Up @@ -3682,8 +3699,8 @@ extern enum hrtimer_restart
homa_hrtimer(struct hrtimer *timer);
extern int homa_init(struct homa *homa);
extern void homa_incoming_sysctl_changed(struct homa *homa);
extern int homa_ioc_abort(struct sock *sk, unsigned long arg);
extern int homa_ioctl(struct sock *sk, int cmd, unsigned long arg);
extern int homa_ioc_abort(struct sock *sk, int *karg);
extern int homa_ioctl(struct sock *sk, int cmd, int *karg);
extern void homa_log_throttled(struct homa *homa);
extern int homa_message_in_init(struct homa_rpc *rpc, int length,
int unsched);
Expand Down Expand Up @@ -3777,8 +3794,6 @@ extern struct homa_rpc
extern int homa_rpc_reap(struct homa_sock *hsk, int count);
extern void homa_send_ipis(void);
extern int homa_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
extern int homa_sendpage(struct sock *sk, struct page *page, int offset,
size_t size, int flags);
extern int homa_setsockopt(struct sock *sk, int level, int optname,
sockptr_t __user optval, unsigned int optlen);
extern int homa_shutdown(struct socket *sock, int how);
Expand Down
5 changes: 2 additions & 3 deletions homa_incoming.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ int homa_copy_to_user(struct homa_rpc *rpc)
int pkt_length = homa_data_len(skbs[i]);
int copied = 0;
char *dst;
struct iovec iov;
struct iov_iter iter;
int buf_bytes, chunk_size;

Expand All @@ -276,8 +275,8 @@ int homa_copy_to_user(struct homa_rpc *rpc)
}
chunk_size = buf_bytes;
}
error = import_single_range(READ, dst,
chunk_size, &iov, &iter);
error = import_ubuf(READ, dst, chunk_size,
&iter);
if (error)
goto free_skbs;
error = skb_copy_datagram_iter(skbs[i],
Expand Down
7 changes: 4 additions & 3 deletions homa_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ static inline void homa_set_softirq_cpu(struct sk_buff *skb, int cpu)
struct rps_sock_flow_table *sock_flow_table;
int hash;

sock_flow_table = rcu_dereference(rps_sock_flow_table);
sock_flow_table = rcu_dereference(net_hotdata.rps_sock_flow_table);
if (sock_flow_table == NULL)
return;
hash = cpu + rps_cpu_mask + 1;
hash = cpu + net_hotdata.rps_cpu_mask + 1;
if (sock_flow_table->ents[hash] != hash) {
rcu_read_lock();
sock_flow_table = rcu_dereference(rps_sock_flow_table);
sock_flow_table = rcu_dereference(
net_hotdata.rps_sock_flow_table);
sock_flow_table->ents[hash] = hash;
rcu_read_unlock();
}
Expand Down
31 changes: 6 additions & 25 deletions homa_plumbing.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const struct proto_ops homa_proto_ops = {
.sendmsg = inet_sendmsg,
.recvmsg = inet_recvmsg,
.mmap = sock_no_mmap,
.sendpage = sock_no_sendpage,
.set_peek_off = sk_set_peek_off,
};

Expand All @@ -85,7 +84,6 @@ const struct proto_ops homav6_proto_ops = {
.sendmsg = inet_sendmsg,
.recvmsg = inet_recvmsg,
.mmap = sock_no_mmap,
.sendpage = sock_no_sendpage,
.set_peek_off = sk_set_peek_off,
};

Expand All @@ -108,7 +106,6 @@ struct proto homa_prot = {
.getsockopt = homa_getsockopt,
.sendmsg = homa_sendmsg,
.recvmsg = homa_recvmsg,
.sendpage = homa_sendpage,
.backlog_rcv = homa_backlog_rcv,
.release_cb = ip4_datagram_release_cb,
.hash = homa_hash,
Expand Down Expand Up @@ -136,7 +133,6 @@ struct proto homav6_prot = {
.getsockopt = homa_getsockopt,
.sendmsg = homa_sendmsg,
.recvmsg = homa_recvmsg,
.sendpage = homa_sendpage,
.backlog_rcv = homa_backlog_rcv,
.release_cb = ip6_datagram_release_cb,
.hash = homa_hash,
Expand Down Expand Up @@ -744,17 +740,17 @@ int homa_disconnect(struct sock *sk, int flags) {
* homa_ioc_abort() - The top-level function for the ioctl that implements
* the homa_abort user-level API.
* @sk: Socket for this request.
* @arg: Used to pass information from user space.
* @karg: Used to pass information from user space.
*
* Return: 0 on success, otherwise a negative errno.
*/
int homa_ioc_abort(struct sock *sk, unsigned long arg) {
int homa_ioc_abort(struct sock *sk, int *karg) {
int ret = 0;
struct homa_sock *hsk = homa_sk(sk);
struct homa_abort_args args;
struct homa_rpc *rpc;

if (unlikely(copy_from_user(&args, (void *) arg, sizeof(args))))
if (unlikely(copy_from_user(&args, (void *) karg, sizeof(args))))
return -EFAULT;

if (args._pad1 || args._pad2[0] || args._pad2[1]) {
Expand All @@ -781,18 +777,18 @@ int homa_ioc_abort(struct sock *sk, unsigned long arg) {
* homa_ioctl() - Implements the ioctl system call for Homa sockets.
* @sk: Socket on which the system call was invoked.
* @cmd: Identifier for a particular ioctl operation.
* @arg: Operation-specific argument; typically the address of a block
* @karg: Operation-specific argument; typically the address of a block
* of data in user address space.
*
* Return: 0 on success, otherwise a negative errno.
*/
int homa_ioctl(struct sock *sk, int cmd, unsigned long arg) {
int homa_ioctl(struct sock *sk, int cmd, int *karg) {
int result;
__u64 start = get_cycles();

switch (cmd) {
case HOMAIOCABORT:
result = homa_ioc_abort(sk, arg);
result = homa_ioc_abort(sk, karg);
INC_METRIC(abort_calls, 1);
INC_METRIC(abort_cycles, get_cycles() - start);
break;
Expand Down Expand Up @@ -1157,21 +1153,6 @@ int homa_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags,
return result;
}

/**
* homa_sendpage() - ??.
* @sk: Socket for the operation
* @page: ??
* @offset: ??
* @size: ??
* @flags: ??
* Return: 0 on success, otherwise a negative errno.
*/
int homa_sendpage(struct sock *sk, struct page *page, int offset,
size_t size, int flags) {
printk(KERN_WARNING "unimplemented sendpage invoked on Homa socket\n");
return -ENOSYS;
}

/**
* homa_hash() - ??.
* @sk: Socket for the operation
Expand Down
2 changes: 1 addition & 1 deletion homa_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The caller must own the lock for @pool->hsk.
* @pool: Pool to update.
*/
static void inline set_bpages_needed(struct homa_pool *pool) {
inline static void set_bpages_needed(struct homa_pool *pool) {
struct homa_rpc *rpc = list_first_entry(&pool->hsk->waiting_for_bufs,
struct homa_rpc, buf_links);
pool->bpages_needed = (rpc->msgin.length + HOMA_BPAGE_SIZE - 1)
Expand Down
Loading

0 comments on commit df0daa5

Please sign in to comment.