From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A47D632 for ; Thu, 24 Apr 2025 00:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745453385; cv=none; b=FVEuWHJJhc+lgLwHkBcyQk56nsdw1Kx38ZBRoHTc3sB3ss8CNEYHMxNwy6pDglt7qa+xHV8qQ15sN1ifCzgmv5sPNXN8lwsnZFfFhYruLLHqMz4QCKthMUGouP1Ejp39SHHWL9ZAssuujMZ3T/wuUHI6NDbzLE5rGkXV3SmG6ys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745453385; c=relaxed/simple; bh=OIFA5JWtqYQ4zBZiuzSIDYx6gLpW+HZEf9kXpX1C0NU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P7fV/D/Xx9yhvJP9R2WlL0PAA7LUXsZOyRD8rNH6pfH+rzuh+hvSfbZKwvbiZJ9f8kElAOOXyHZMAIKuKK+Vtp9wFjlAos4OxyOIpsW1XBhm64CIS5tDtghu/96RXaGAP947arw3K8ie9IVzlmORSxhIGCAjz0202Gw8l6Apx6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=0koLfvgQ; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="0koLfvgQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=jafQmx18FK88j94kUz99FrJs1Mc+p1ALbFDd7pnhsA0=; b=0koLfvgQStsqqDjvE0QlSSy/BT wNjUbLqPHJLGzxS22fizOCB4J5zecHRj4Au6kMroywxwWXMn9W0TNwmzOHR18c8t9wdogy8O+jGWC Eyt1385FPLaqsYyDypPVIwdbS2x/+FV3kSpsQMqhKgbI88tUVrOGQM9uS1RM9GlNyP09b4+lwD8jX DTKvLe9PVbFWzRccoj4Xx4RlrrWuycv7U1oiqrCtWBhxnMho7vV2CB8d8WjnjttIG+oxn5gPZL58H ryHQfi5jQctqcNR/iuu5ijgattCNuLLo+ZA4MU+xaNJVamvtv1WohL0pGXLuMiiZ1z1gHIVWOV4jS DddFgMXQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1u7k9u-0000000CLtG-3CnZ; Thu, 24 Apr 2025 00:09:42 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [RFT] bootlinux: add bisection support Date: Wed, 23 Apr 2025 17:09:41 -0700 Message-ID: <20250424000942.2944058-1-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain This adds automatic bisection support first through the CLI by using simple command line options. The first target goal to test is very simple, check if the kernel boots or not. There is no need for a custom workflow for this. We just enable the user to set the values through the command line interface like this: git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git \ --reference /mirror/linux-next.git linux make defconfig-bisection \ GOOD=v6.15-rc2 \ BAD=next-20250422 \ KDEVOPS_HOSTS_PREFIX="bisect" \ LINUX_TREE="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git" -j128 make -j128 make bringup make linux # Boots to good at first make linux-bisection # Runs the bisection script For now confine this feature to BOOTLINUX_9P as its not clear what to do about terraform yet. We can add that support later. Signed-off-by: Luis Chamberlain --- Request For Testing as I've only gotten this to at least run up to the script, and am debugging now to see if it actually does what I hope it should. The other bug is that the first 'make bringup' boots into linux-next not the good tag, but I can't see why yet. And so just two things are left here: 1) figure out why make bringup fails to use the good tag 2) see if we need to redo the simple boot script I'm hoping we can use this to bisect why linux-next tag next-20250422 was hosed on boot. defconfigs/bisection | 9 +++ playbooks/roles/bootlinux/defaults/main.yml | 6 ++ playbooks/roles/bootlinux/tasks/main.yml | 45 +++++++++++ .../bootlinux/templates/bisect-boot.sh.j2 | 7 ++ workflows/linux/Kconfig | 80 ++++++++++++++++++- workflows/linux/Makefile | 15 ++++ 6 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 defconfigs/bisection create mode 100755 playbooks/roles/bootlinux/templates/bisect-boot.sh.j2 diff --git a/defconfigs/bisection b/defconfigs/bisection new file mode 100644 index 000000000000..1c3112a0670e --- /dev/null +++ b/defconfigs/bisection @@ -0,0 +1,9 @@ +CONFIG_GUESTFS=y +CONFIG_LIBVIRT=y + +CONFIG_WORKFLOW_LINUX_CUSTOM=y +CONFIG_BOOTLINUX=y +CONFIG_BOOTLINUX_9P=y +CONFIG_BOOTLINUX_BISECT_ENABLE=y + +CONFIG_DEVCONFIG_ENABLE_SYSTEMD_JOURNAL_REMOTE=y diff --git a/playbooks/roles/bootlinux/defaults/main.yml b/playbooks/roles/bootlinux/defaults/main.yml index fd5674b5fc19..245ae43c5f0d 100644 --- a/playbooks/roles/bootlinux/defaults/main.yml +++ b/playbooks/roles/bootlinux/defaults/main.yml @@ -52,3 +52,9 @@ kdevops_workflow_enable_cxl: False bootlinux_cxl_test: False bootlinux_tree_set_by_cli: False +bootlinux_bisect_enable: False +bootlinux_bisect_enable_cli: False +bootlinux_bisect_ref_good_cli: False +bootlinux_bisect_ref_bad_cli: False +bootlinux_bisect_script_boot: False +bootlinux_bisect_script_custom: False diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index 9ad675b3f278..afa533c011f8 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -650,3 +650,48 @@ vars: running_kernel: "{{ uname_cmd.stdout_lines.0 }}" tags: [ 'linux', 'git', 'config', 'uname' ] + +- name: Copy git bisection script over + template: + src: "{{ bootlinux_bisect_script }}.j2" + dest: "{{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}" + mode: 0644 + tags: [ 'bisect' ] + when: + - bootlinux_bisect_enable|bool + run_once: true + delegate_to: localhost + +- name: Set up bisection for git + command: "git bisect start {{ bootlinux_bisect_ref_bad }} {{ bootlinux_bisect_ref_good }}" + register: build + changed_when: "build.rc == 0" + args: + chdir: "{{ bootlinux_9p_host_path }}" + tags: [ 'bisect' ] + when: + - bootlinux_bisect_enable|bool + run_once: true + delegate_to: localhost + +- name: Ensure bisection script is executable + file: + path: "{{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}" + mode: '0755' + state: file + when: bootlinux_bisect_enable | bool + delegate_to: localhost + run_once: true + tags: [ 'bisect' ] + +- name: Run the the bisection script + command: "git bisect run {{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}" + register: build + changed_when: "build.rc == 0" + args: + chdir: "{{ bootlinux_9p_host_path }}" + tags: [ 'bisect' ] + when: + - bootlinux_bisect_enable|bool + run_once: true + delegate_to: localhost diff --git a/playbooks/roles/bootlinux/templates/bisect-boot.sh.j2 b/playbooks/roles/bootlinux/templates/bisect-boot.sh.j2 new file mode 100755 index 000000000000..10dbacd307da --- /dev/null +++ b/playbooks/roles/bootlinux/templates/bisect-boot.sh.j2 @@ -0,0 +1,7 @@ +#!/bin/bash +# SPDX-License-Identifier: copyleft-next-0.3.1 +# +# If make linux-deploy fails for reasons unrelated to the bug we're tracking +# (e.g., a build error) we bail with exit code 125 to allow git to skip that +# commit. +make linux-deploy || exit 125 diff --git a/workflows/linux/Kconfig b/workflows/linux/Kconfig index 797469e60d20..b30187c80e6e 100644 --- a/workflows/linux/Kconfig +++ b/workflows/linux/Kconfig @@ -10,6 +10,21 @@ config BOOTLINUX_TREE_REF_SET_BY_CLI output yaml default $(shell, scripts/check-cli-set-var.sh LINUX_TREE_REF) +config BOOTLINUX_BISECT_ENABLE_CLI + bool + output yaml + default $(shell, scripts/check-cli-set-var.sh LINUX_BISECT) + +config BOOTLINUX_BISECT_REF_GOOD_CLI + bool + output yaml + default $(shell, scripts/check-cli-set-var.sh GOOD) + +config BOOTLINUX_BISECT_REF_BAD_CLI + bool + output yaml + default $(shell, scripts/check-cli-set-var.sh BAD) + config BOOTLINUX_HAS_PURE_IOMAP_CONFIG bool @@ -173,7 +188,8 @@ config BOOTLINUX_TREE_CUSTOM_URL config BOOTLINUX_TREE_CUSTOM_REF string "Custom Linux kernel tag or branch to use" - default $(shell, ./scripts/append-makefile-vars.sh $(LINUX_TREE_REF)) if BOOTLINUX_TREE_REF_SET_BY_CLI + default $(shell, ./scripts/append-makefile-vars.sh $(GOOD)) if BOOTLINUX_BISECT_REF_GOOD_CLI && !BOOTLINUX_TREE_REF_SET_BY_CLI + default $(shell, ./scripts/append-makefile-vars.sh $(LINUX_TREE_REF)) if BOOTLINUX_TREE_REF_SET_BY_CLI && !BOOTLINUX_BISECT_REF_GOOD_CLI default "master" if !BOOTLINUX_TREE_REF_SET_BY_CLI help The git ID or branch name to check out to compile linux. @@ -278,9 +294,71 @@ config BOOTLINUX_TREE_LOCALVERSION help The Linux local version to use (for uname). +config BOOTLINUX_BISECT_ENABLE + bool "Do you want to bisect a broken kernel?" + default y + depends on BOOTLINUX_9P + output yaml + help + Do you need to automate bisecting some broken kernel? + +if BOOTLINUX_BISECT_ENABLE + +choice + prompt "Bisection script to use" + default BOOTLINUX_BISECT_SCRIPT_BOOT + +config BOOTLINUX_BISECT_SCRIPT_BOOT + bool "Ensures we can at least boot" + help + This helps ensure we can at laest boot into the host. That's it. + +config BOOTLINUX_BISECT_SCRIPT_CUSTOM + bool "You will provide your own bisection script" + help + If you to test a new bisection script you can use this. + +endchoice + +config BOOTLINUX_BISECT_SCRIPT_CUSTOM_PATH + string "Custom path to git bisection script to use" + depends on BOOTLINUX_BISECT_SCRIPT_CUSTOM + default "" + output yaml + help + The custom path to the bisect script we will use. Instead of building + the kernel and booting it, 'make linux' will do the bisection + automatically for you based on the script. + +config BOOTLINUX_BISECT_SCRIPT + string + output yaml + default "bisect-boot.sh" if BOOTLINUX_BISECT_SCRIPT_BOOT + default BOOTLINUX_BISECT_SCRIPT_CUSTOM_PATH if BOOTLINUX_BISECT_SCRIPT_BOOT + + +config BOOTLINUX_BISECT_REF_GOOD + string "The last known good commit" + default BOOTLINUX_TREE_REF if !BOOTLINUX_BISECT_REF_GOOD_CLI + default $(shell, ./scripts/append-makefile-vars.sh $(GOOD)) if BOOTLINUX_BISECT_REF_GOOD_CLI + output yaml + help + The known kernel commit to be good. + +config BOOTLINUX_BISECT_REF_BAD + string "The known broken commit" + default BOOTLINUX_TREE_STABLE_REF if !BOOTLINUX_BISECT_REF_BAD_CLI + default $(shell, ./scripts/append-makefile-vars.sh $(BAD)) if BOOTLINUX_BISECT_REF_BAD_CLI + output yaml + help + The first broken tag. + +endif # BOOTLINUX_BISECT_ENABLE + config BOOTLINUX_SHALLOW_CLONE bool "Shallow git clone" default y + depends on !BOOTLINUX_BISECT_ENABLE help If enabled the git tree cloned with be cloned using a shallow tree with history truncated. You want to enable this if you really don't diff --git a/workflows/linux/Makefile b/workflows/linux/Makefile index ecce273a4f67..00ec13db74ca 100644 --- a/workflows/linux/Makefile +++ b/workflows/linux/Makefile @@ -104,6 +104,13 @@ linux-mount: --tags vars,9p_mount \ --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) +PHONY += linux-bisect +linux-bisect: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ + $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ + --tags vars,bisect \ + --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) + PHONY += linux-deploy linux-deploy: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ @@ -176,6 +183,14 @@ linux-help-cxl: LINUX_HELP_EXTRA += linux-help-cxl endif +ifeq (y,$(CONFIG_BOOTLINUX_BISECTION)) +PHONY += linux-help-bisection +linux-help-bisection: + @echo "linux-bisection - Bisects the kernel automatically for you" + +LINUX_HELP_EXTRA += linux-help-bisection +endif + HELP_TARGETS+=linux-help-menu HELP_TARGETS+=$(LINUX_HELP_EXTRA) HELP_TARGETS+=linux-help-end -- 2.45.2