Merge ~kajiya/+git/gce-compute-image-packages:upstream into ~ubuntu-core-dev/+git/gce-compute-image-packages:upstream

Proposed by Chloé Smith
Status: Merged
Merged at revision: 6ed6854b26784ac30670694cd8b547fe0304422c
Proposed branch: ~kajiya/+git/gce-compute-image-packages:upstream
Merge into: ~ubuntu-core-dev/+git/gce-compute-image-packages:upstream
Diff against target: 154 lines (+44/-21)
4 files modified
OWNERS (+5/-2)
src/lib/udev/google_nvme_id (+1/-1)
src/usr/bin/google_set_hostname (+2/-1)
src/usr/bin/google_set_multiqueue (+36/-17)
Reviewer Review Type Date Requested Status
Utkarsh Gupta Approve
Review via email: mp+466197@code.launchpad.net

Commit message

Update to upstream tag 20240307.00 (LP: #2066314)

To post a comment you must log in.
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Thanks, Chlo. I just had to adjust the d/ch entry per the usual standard line which gbp generates. But everything looks good. No vendoring required in the package, no complicated build, and no lintian shenanigans. I've sponsored the upload:

$ dput ubuntu ../gce-compute-image-packages_20240307.00-0ubuntu1_source.changes
Uploading gce-compute-image-packages using ftp to ubuntu (host: upload.ubuntu.com; directory: /ubuntu)
running supported-distribution: check whether the target distribution is currently supported (using distro-info)
{'allowed': ['release', 'proposed', 'backports', 'security'], 'known': ['release', 'proposed', 'updates', 'backports', 'security']}
running required-fields: check whether a field is present and non-empty in the changes file
running checksum: verify checksums before uploading
running suite-mismatch: check the target distribution for common errors
running check-debs: makes sure the upload contains a binary package
running gpg: check GnuPG signatures before the upload
Uploading gce-compute-image-packages_20240307.00-0ubuntu1.dsc
Uploading gce-compute-image-packages_20240307.00.orig.tar.xz
Uploading gce-compute-image-packages_20240307.00-0ubuntu1.debian.tar.xz
Uploading gce-compute-image-packages_20240307.00-0ubuntu1_source.buildinfo
Uploading gce-compute-image-packages_20240307.00-0ubuntu1_source.changes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/OWNERS b/OWNERS
2index 80fc96d..59fca61 100644
3--- a/OWNERS
4+++ b/OWNERS
5@@ -2,12 +2,15 @@
6 # See the OWNERS docs at https://go.k8s.io/owners
7
8 approvers:
9+ - a-crate
10+ - ajorg
11 - bkatyl
12 - chaitanyakulkarni28
13 - dorileo
14+ - drewhli
15+ - elicriffield
16+ - gaughen
17 - jjerger
18 - karnvadaliya
19 - koln67
20- - quintonamore
21- - vorakl
22 - zmarano
23diff --git a/src/lib/udev/google_nvme_id b/src/lib/udev/google_nvme_id
24index ef02963..f0bba67 100755
25--- a/src/lib/udev/google_nvme_id
26+++ b/src/lib/udev/google_nvme_id
27@@ -69,7 +69,7 @@ function get_namespace_device_name() {
28 fi
29
30 local device_name
31- device_name="$(echo "$nvme_json" | grep device_name | sed -e 's/.*"device_name":[ \t]*"\([a-zA-Z0-9_-]\+\)".*/\1/')"
32+ device_name="$(echo "$nvme_json" | grep device_name | sed -e 's/.*"device_name":[ \t]*"\([.a-zA-Z0-9_-]\+\)".*/\1/')"
33
34 # Error if our device name is empty
35 if [[ -z "$device_name" ]]; then
36diff --git a/src/usr/bin/google_set_hostname b/src/usr/bin/google_set_hostname
37index 317768f..05a0412 100755
38--- a/src/usr/bin/google_set_hostname
39+++ b/src/usr/bin/google_set_hostname
40@@ -62,7 +62,8 @@ if [ -n "$new_host_name" ] && [ "${new_host_name%%.*}" != "$old_hostname" ] && !
41 # Restart rsyslog to update the hostname.
42 systemctl=$(which systemctl 2> /dev/null)
43 if [ -x "$systemctl" ]; then
44- hasrsyslog=$($systemctl | grep rsyslog | cut -f1 -d' ')
45+ # See man 5 systemd.unit for systemd unit naming rules
46+ hasrsyslog=$($systemctl | grep rsyslog | grep -oE '[a-zA-Z0-9:-_.\]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)')
47 if [ ! -z "$hasrsyslog" ]; then
48 $systemctl -q --no-block restart "$hasrsyslog"
49 fi
50diff --git a/src/usr/bin/google_set_multiqueue b/src/usr/bin/google_set_multiqueue
51index fa87a1e..8e51934 100755
52--- a/src/usr/bin/google_set_multiqueue
53+++ b/src/usr/bin/google_set_multiqueue
54@@ -45,7 +45,7 @@ function set_channels() {
55
56 function set_irq_range() {
57 local -r nic="$1"
58- local core="$2"
59+ local bind_cores_begin="$2"
60
61 # The user may not have this $nic configured on their VM, if not, just skip
62 # it, no need to error out.
63@@ -53,16 +53,26 @@ function set_irq_range() {
64 return;
65 fi
66
67+
68 # We count the number of rx queues and assume number of rx queues == tx
69- # queues. Currently the GVE configuration at boot is 16 rx + 16 tx.
70+ # queues. The number of queues shown in the sysfs stands for the initial
71+ # queues while the number of IRQs stands for the max queues. The number of
72+ # initial queues should be always less than or equal to that of the max
73+ # queues.
74+ core=$bind_cores_begin
75+ num_irqs=$(( $(ls /sys/class/net/"$nic"/device/msi_irqs | wc -l) / 2 ))
76 num_q=$(ls -1 /sys/class/net/"$nic"/queues/ | grep rx | wc -l)
77
78 echo "Setting irq binding for "$nic" to core [$core - $((core + num_q - 1))] ..."
79
80 irqs=($(ls /sys/class/net/"$nic"/device/msi_irqs | sort -g))
81- for ((queue = 0; queue < "$num_q"; queue++)); do
82- tx_irq=${irqs[$queue]}
83- rx_irq=${irqs[$((queue + num_q))]}
84+ for ((irq = 0; irq < "$num_irqs"; irq++)); do
85+ tx_irq=${irqs[$irq]}
86+ rx_irq=${irqs[$((irq + num_irqs))]}
87+
88+ # Only allocate $num_q cores to the IRQs and queues. If the number of IRQs
89+ # is more than that of queues, the CPUs will be wrapped around.
90+ core=$(( bind_cores_begin + irq % num_q ))
91
92 # this is GVE's TX irq. See gve_tx_idx_to_ntfy().
93 echo "$core" > /proc/irq/"$tx_irq"/smp_affinity_list
94@@ -70,23 +80,32 @@ function set_irq_range() {
95 # this is GVE's RX irq. See gve_rx_idx_to_ntfy().
96 echo "$core" > /proc/irq/"$rx_irq"/smp_affinity_list
97
98- # XPS (Transmit Packet Steering) allows a core to decide which queue to
99- # select if its mask is found in one of the queue's xps_cpus
100- cp /proc/irq/"$tx_irq"/smp_affinity /sys/class/net/"$nic"/queues/tx-"$queue"/xps_cpus
101-
102- echo -en "$nic:q-$queue: \ttx: irq $tx_irq bind to $core \trx: irq $rx_irq bind to $core"
103- echo -e " \txps_cpus bind to $(cat /sys/class/net/"$nic"/queues/tx-"$queue"/xps_cpus)"
104+ # Check if the queue exists at present because the number of IRQs equals
105+ # the max number of queues allocated and could be greater than the current
106+ # number of queues.
107+ tx_queue=/sys/class/net/"$nic"/queues/tx-"$irq"
108+ if ls $tx_queue 1> /dev/null 2>&1; then
109+ # XPS (Transmit Packet Steering) allows a core to decide which queue to
110+ # select if its mask is found in one of the queue's xps_cpus
111+ cp /proc/irq/"$tx_irq"/smp_affinity $tx_queue/xps_cpus
112+
113+ echo -en "$nic:q-$irq: \ttx: irq $tx_irq bind to $core \trx: irq $rx_irq bind to $core"
114+ echo -e " \txps_cpus bind to $(cat $tx_queue/xps_cpus)"
115+ else
116+ echo -e "$nic:q-$irq: \ttx: irq $tx_irq bind to $core \trx: irq $rx_irq bind to $core"
117+ fi
118
119- core=$((core + 1))
120 done
121 }
122
123-# returns 0 (success) if it's running on a3 platform.
124+# returns 0 (success) if it's running on a3 or a3plus platform.
125 function is_a3_platform() {
126- machine_type=$(curl -H "Metadata-Flavor: Google" \
127+ machine_type=$(curl -m 1 -H "Metadata-Flavor: Google" \
128 http://169.254.169.254/computeMetadata/v1/instance/machine-type)
129
130- [[ "$machine_type" == *"a3-highgpu-8g"* ]] || return 1
131+ [[ "$machine_type" == *"a3-highgpu-8g"* \
132+ || "$machine_type" == *"a3-ultragpu-8g"* \
133+ || "$machine_type" == *"a3-megagpu-8g"* ]] || return 1
134
135 return 0
136 }
137@@ -234,7 +253,7 @@ fi
138
139 # IRQ binding for numa 0, CPUs [0, 51] and [104, 155] are for numa 0.
140 numa0_irq_start=1
141-find /sys/class/net -type l | xargs -L 1 realpath | sort | xargs -L 1 basename | grep -v lo | while read nic_name; do
142+find /sys/class/net -type l | xargs -L 1 realpath | grep '/sys/devices/pci' | sort | xargs -L 1 basename | while read nic_name; do
143 nic_numa_node=$(cat /sys/class/net/"$nic_name"/device/numa_node)
144 if [[ $nic_numa_node -ne 0 ]]; then
145 continue
146@@ -256,7 +275,7 @@ done
147
148 # IRQ binding for numa 1, CPUs [52, 103] and [156, 207] are for numa 1.
149 numa1_irq_start=52
150-find /sys/class/net -type l | xargs -L 1 realpath | sort | xargs -L 1 basename | grep -v lo | while read nic_name; do
151+find /sys/class/net -type l | xargs -L 1 realpath | grep '/sys/devices/pci' | sort | xargs -L 1 basename | while read nic_name; do
152 nic_numa_node=$(cat /sys/class/net/"$nic_name"/device/numa_node)
153 if [[ $nic_numa_node -ne 1 ]]; then
154 continue

Subscribers

People subscribed via source and target branches