Re: [PATCH v2 00/33] locking/atomic: convert all architectures to ARCH_ATOMIC

From: Peter Zijlstra
Date: Wed May 26 2021 - 07:32:53 EST


On Tue, May 25, 2021 at 03:01:59PM +0100, Mark Rutland wrote:
> This series (based on v5.13-rc2) converts all architectures to
> ARCH_ATOMIC. This will allow the use of instrumented atomics on all
> architectures (e.g. for KASAN and similar), and simplifies the core
> atomic code (which should allow for easier rework of the fallbacks and
> other bits in future).
>
> I'm hoping that we can queue this via the tip tree for v5.14.
>
> I've build-tested this with the kernel.org crosstool GCC 10.3.0 binaries
> (all arches except hexagon), and I haven't seen issues with the configs
> I tried, so I'm fairly confident this is solid now. I'd like to get this
> into linux-next ASAP to flush out any remaining issues.
>
> The series is split into three parts:
>
> 1) Some preparatory work is done to prepare architectures and common
> code for the conversion. In this phase h8300 and microblaze are
> converted to use the asm-generic atomics exclusively, and the
> asm-generic implementations are made to function with or without
> ARCH_ATOMIC.
>
> 2) Architectures are converted one-by-one to use the ARCH_ATOMIC
> interface. I've converted each architecture with its own patch (even
> where the conversion is trivial) to make review and bisection easier.
>
> 3) The code handling !ARCH_ATOMIC is removed.
>
> Note: I've generated the patches with:
>
> git format-patch -C -M -D
>
> ... so the preimage of include/linux/atomic-fallback.h is not included
> in the diff when it is deleted.

So because I need the Link tag and things, I had to use b4 (or my own
scripts) and git-am, but that's incapable of digesting these patches.

I strongly feel that git-apply must be able to accept anything
git-format-patch generates, so I fixed it, see below.

With that; I could do:

$ b4 am -slo - 20210525140232.53872-1-mark.rutland@xxxxxxx | git am -D


Junio; can we get something like the below sorted?

---
diff --git a/apply.c b/apply.c
index 853d3ed385a6..20c3c8c5eddd 100644
--- a/apply.c
+++ b/apply.c
@@ -3650,7 +3650,7 @@ static int apply_data(struct apply_state *state, struct patch *patch,
add_to_fn_table(state, patch);
free(image.line_allocated);

- if (0 < patch->is_delete && patch->resultsize)
+ if (0 < patch->is_delete && patch->resultsize && !state->force_delete)
return error(_("removal patch leaves file contents"));

return 0;
@@ -5059,6 +5059,7 @@ int apply_parse_options(int argc, const char **argv,
OPT_CALLBACK(0, "directory", state, N_("root"),
N_("prepend <root> to all filenames"),
apply_option_parse_directory),
+ OPT_BOOL('D', "irreversible-delete", &state->force_delete, N_("DWIW")),
OPT_END()
};

diff --git a/apply.h b/apply.h
index da3d95fa5098..73819110387b 100644
--- a/apply.h
+++ b/apply.h
@@ -66,6 +66,7 @@ struct apply_state {
int threeway;
int unidiff_zero;
int unsafe_paths;
+ int force_delete;

/* Other non boolean parameters */
struct repository *repo;
diff --git a/builtin/am.c b/builtin/am.c
index 0b2d886c81b7..4776a42d5312 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2323,6 +2323,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
OPT_PASSTHRU_ARGV(0, "reject", &state.git_apply_opts, NULL,
N_("pass it through git-apply"),
PARSE_OPT_NOARG),
+ OPT_PASSTHRU_ARGV('D', "irreversible-delete", &state.git_apply_opts, NULL,
+ N_("pass it through git-apply"),
+ PARSE_OPT_NOARG),
OPT_STRING(0, "resolvemsg", &state.resolvemsg, NULL,
N_("override error message when patch failure occurs")),
OPT_CMDMODE(0, "continue", &resume.mode,