From b06f1384be021613e0abce88a748f7df5f56b67e Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Fri, 17 Oct 2025 15:58:07 -0700 Subject: [PATCH] Add files via upload --- ipynb/Goldberg.ipynb | 2098 ++++++++++++++++++++---------------------- 1 file changed, 989 insertions(+), 1109 deletions(-) diff --git a/ipynb/Goldberg.ipynb b/ipynb/Goldberg.ipynb index 904e79f..ce374e7 100644 --- a/ipynb/Goldberg.ipynb +++ b/ipynb/Goldberg.ipynb @@ -1,10 +1,5 @@ { "cells": [ - { - "cell_type": "raw", - "metadata": {}, - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -17,7 +12,7 @@ "\n", "The term [**generative AI**](https://en.wikipedia.org/wiki/Generative_artificial_intelligencehttps://en.wikipedia.org/wiki/Generative_artificial_intelligence) is all the rage these days; it refers to computer programs that can *generate* something new (such as an image or a piece of text). \n", "\n", - "In 2015 Karpathy's point was that recurrent neural networks were unreasonably effective at generating good text, even though they are at heart rather simple. Goldberg's point was that, yes, they are effective, but actually most of the magic is not in the RNNs, it is in the training data itself, and an even simpler model (with no neural nets) does just as well at generating English text. Goldberg and Karpathy agree that the RNN captures some aspects of C++ code that the simpler model does not.\n", + "In 2015 Karpathy's point was that recurrent neural networks were unreasonably effective at generating good text, even though they are at heart rather simple. Goldberg's point was that, yes, they are effective, but actually most of the magic is not in the RNNs, it is in the training data itself, and an even simpler model (with no neural nets) does just as well at generating English text. Goldberg and Karpathy agree that the RNN captures some aspects of C++ code that the simpler model does not. My point is to update the decade-old Python code, and make a few enhancements.\n", "\n", "\n", "## Definitions\n", @@ -29,11 +24,11 @@ "- A generative model stands in contrast to a **discriminative model**, such as an email spam filter, which can discriminate between spam and non-spam, but can't be used to generate a new sample of spam.\n", "\n", "\n", - "- An ***n*-gram model** is a generative model that estimates the probability of *n*-token sequences. For example, a 5-gram character model would be able to say that given the previous 4 characters `'chai'`, the next character might be `'r'` or `'n'` (to form `'chair'` or `'chain'`). A 5-gram model is also called a model of **order** 4, because it maps from the 4 previous tokens to the next token.\n", + "- An **n-gram model** is a generative model that estimates the probability of *n*-token sequences. For example, a 5-gram character model would be able to say that given the previous 4 characters `'chai'`, the next character might be `'r'` or `'n'` (to form `'chair'` or `'chain'`). A 5-gram model is also called a model of **order** 4, because it maps from the 4 previous tokens to the next token.\n", "\n", "- A **recurrent neural network (RNN) model** is more powerful than an *n*-gram model, because it contains memory units that allow it to retain information from more than *n* tokens. See Karpathy for [details](http://karpathy.github.io/2015/05/21/rnn-effectiveness/).\n", "\n", - "- Current **large language models** such as Chat-GPT, Claude, Llama, and Gemini use an even more powerful model called a [transformer](https://en.wikipedia.org/wiki/Transformer_%28deep_learning_architecture%29). Karpathy has [an introduction](https://www.youtube.com/watch?v=zjkBMFhNj_g&t=159s).\n", + "- Current **large language models** such as ChatGPT, Claude, Llama, and Gemini use an even more powerful model called a [transformer](https://en.wikipedia.org/wiki/Transformer_%28deep_learning_architecture%29). Karpathy has [an introduction](https://www.youtube.com/watch?v=zjkBMFhNj_g&t=159s).\n", "\n", "## Training Data\n", "\n", @@ -57,7 +52,7 @@ ], "source": [ "! [ -f shakespeare_input.txt ] || curl -O https://norvig.com/ngrams/shakespeare_input.txt\n", - "! wc shakespeare_input.txt \n", + "! wc shakespeare_input.txt \n", "# Print the number of lines, words, and characters" ] }, @@ -94,7 +89,7 @@ "\n", "I do some imports and then define two data types:\n", "- A `Token` is an individual unit of text, a string of one or more characters.\n", - "- A `LanguageModel` is a subclass of `defaultdict` that maps a history of length `order` tokens to a `Counter` of the number of times each token appears immediately following the history in the training data." + "- A `LanguageModel` is a subclass of `defaultdict` that maps a history of length *n* tokens to a `Counter` of the number of times each token appears immediately following the history in the training data." ] }, { @@ -111,8 +106,8 @@ "\n", "class LanguageModel(defaultdict): \n", " \"\"\"A mapping of {'history': Counter(next_token)}.\"\"\"\n", - " def __init__(self, order):\n", - " self.order = order\n", + " def __init__(self, n: int):\n", + " self.order = n\n", " super().__init__(Counter)" ] }, @@ -122,8 +117,8 @@ "source": [ "I define two main functions that do essentially all the work:\n", "\n", - "- `train_LM` takes a sequence of tokens (the training data) and an integer `order`, and builds a language model, formed by counting the times each token *t* occurs and storing that under the entry for the history *h* of `order` tokens that precede *t*. \n", - "- `generate_tokens` generates a random sequence of tokens. At each step it looks at the history of previously generated tokens and chooses a new token at random from the language model's counter for that history." + "- `train_LM` takes a sequence of tokens (the training data) and an integer *n*, and builds a language model of order *n*, formed by counting the times each token *t* occurs and storing that under the entry for the history *h* of *n* tokens that precede *t*. \n", + "- `generate_tokens` generates a random sequence of tokens, given an (optional) start sequence of tokens. At each step it looks at the history of previously generated tokens and chooses a new token at random from the language model's counter for that history." ] }, { @@ -181,7 +176,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's train a character-level language model of order 4 on the Shakespeare data. We'll call the model `LM`. (Note that saying `tokens=data` means that the sequence of tokens is equal to the sequence of characters in `data`; in other words each character is a token.)" + "Let's train a character-level language model of order 4 on the Shakespeare data. We'll call the model `LM4`. (Note that saying `tokens=data` means that the sequence of tokens is equal to the sequence of characters in `data`; in other words each character is a token.)" ] }, { @@ -344,51 +339,51 @@ "name": "stdout", "output_type": "stream", "text": [ - "First.\n", + "First, hypocrity.\n", "\n", - "ROSALIND:\n", - "Warwick, but all house, stillow far into my ghost\n", - "prescience,\n", - "And will make the emperous in you gods!--One: that\n", - "Is ther,\n", - "that we stranglish, where assure, sir; a be king I will be accusers kind.\n", + "Messenge a bear she is, malice for the people's lion!\n", "\n", - "SIR HUGH EVANS:\n", - "Four grace\n", - "By so ye\n", - "As the admit trustice; but my wantony of thou did; and the shape Hectors:\n", - "Borest long.\n", - "Thou Marchs of him: his honour?\n", - "I this? hath is feed.\n", + "TALBOT:\n", + "Thou dwell and,\n", + "And liest felt malice, by Cleon, then, sir?\n", "\n", - "PANDARUS:\n", - "You anon her for you.\n", + "QUEEN:\n", + "Yes, we press might\n", + "It may purch:\n", + "A coward and Valenting kiss,\n", + "And perils house,\n", + "Till deeds as dost ther;\n", + "And I, to keep hour could nevership not yet, I this cause.\n", "\n", - "OCTAVIUS CAESAR:\n", - "You have saw to be a Jew, Orland would now welcomes no little prison! love the rest.\n", + "Solicy.\n", "\n", - "MARTIUS CAESAR:\n", - "Well, and the patience is adverthrowing me, I shall thee go thee whom I than to such and thy absolved\n", - "it, the ques\n", - "Weep a slighty sound,\n", - "Lychorse.\n", + "NYM:\n", + "To his not my lord\n", + "'her beggars never hear us\n", + "to do\n", + "Not sell with the now I furthen here that thou all.\n", "\n", - "DESDEMONA:\n", - "This let us,\n", - "And so\n", - "On you, follow and epitation.\n", + "KING RICHARD II:\n", + "Go, but boy lords this kins\n", + "Answer unkindness.'\n", + "Plant reason\n", + "Are mayst pleasure\n", + "What cousiness come inst the devils, and I say, his spurn by serves;\n", + "For and upon't her than lord.\n", "\n", - "FALSTAFF:\n", - "Tell down.\n", - "These will luck'd out thee will teach of my apparis it, take of honest\n", - "Then for adors; the customary shot of that's place upstarved, ruin throne.\n", + "QUEEN:\n", + "Then, nothing of he will leaving.\n", "\n", - "LAUNCE:\n", - "None lowly death,\n", - "Hath Parising upon all, bles, the live.\n", + "SIR TOBY BELCH:\n", + "Come of an even to portculling end in are a dog; and thither with grief, heart is much vicion! By their sick with\n", + "corrupt,\n", + "But my lords: but home\n", + "Are than and shot as the once inter way I\n", + "shall,\n", + "This fruit.\n", "\n", - "VIOLANUS:\n", - "\n" + "LONGAVILLES:\n", + "'Tis yet at hatility the eachelor our plead me, the cram with mattended grace and my yet \n" ] } ], @@ -404,7 +399,7 @@ "\n", "## Generating Order 7 Shakespeare\n", "\n", - "What if we increase it to order 7? Or 10? We find that the output gets a bit better, roughly as good as the RNN models that Karpathy shows, and all from a much simpler *n*-gram model." + "What if we increase the model to order 7? Or 10? The output gets a bit better, roughly as good as the RNN models that Karpathy shows, and all from a much simpler *n*-gram model." ] }, { @@ -421,44 +416,34 @@ "name": "stdout", "output_type": "stream", "text": [ - "First Citizen:\n", - "Which priest, Camillo,\n", - "I conjurations.\n", + "First Clown:\n", + "What are so envenom'd: therefore, good Ursula\n", + "Walk in thy opinion and hit\n", + "The cheater: but lechery eats in my person's sacred king.\n", + "Ay me! sad hours must fight no more.\n", "\n", - "GOWER:\n", - "Here's Wart; thou at supper in't; and heart: but for that she shunn'd,\n", - "Nature of that are so many countryman, there's\n", - "another he folly could have spoke with me?\n", + "OLIVIA:\n", + "Are you think you; you well:\n", + "A gallant ship, sir; you have not denies\n", + "The discourse our supposed\n", + "He that makes King Edward from our counsel in my close they will this young daughter is my birth;\n", + "But no man have I here resignation of them: while apart.\n", + "Stand in this I challenge much as to mince nought;\n", + "Watch'd you,\n", + "Your displeasures, and all the heart bleed at Plashy too;\n", + "My operant power unto Octavius' tent\n", + "How the hand\n", + "Of him that I were you venture of muttons, be your leave,\n", + "For which the anvil of him; you shall acquitted\n", + "Without book are adventurously bound together.\n", "\n", - "VINCENTIO:\n", - "You cannot cog, I can scarce any joy\n", - "Did ever saw a smith stand by the earth\n", - "I' the pedlar;\n", - "Money's a merited. These gloves are not palter it.\n", + "FORD:\n", + "Marry, we have a parish-top. What is the matters. This curse thought of revenge,\n", + "For governed from the proclaim it civil dissemblies to trust not colour will.\n", "\n", - "DUKE OF YORK:\n", - "I will go or tarrying you.\n", - "\n", - "PRINCE HENRY:\n", - "Well, young son of Herne the shore the top,\n", - "And sigh a note for a king in the lean past your ambitious is the question: he swords:\n", - "Thanks, Rosencrantz and gentlemen: they are comes here.\n", - "Then, let grass grow dim. Fare you married Juliet?\n", - "\n", - "LUCIANA:\n", - "Say, I would pardon. So it must be annoyance that thou shall fair praise\n", - "Have I something the lowest plant;\n", - "Whose in our army and unyoke.\n", - "\n", - "BEDFORD:\n", - "'Twas very much content,\n", - "Clarence, be assure you will.\n", - "\n", - "COMINIUS:\n", - "One word more: I am out--\n", - "That canst thou speak of Naples; 'twixt\n", - "The flight, never\n", - "Have writ to his ca\n" + "TITANIA:\n", + "My good king, from the very know, sir king of her lips,\n", + "\n" ] } ], @@ -488,43 +473,45 @@ "output_type": "stream", "text": [ "First Citizen:\n", - "Why answer not?\n", + "We are blest in peace and honour than\n", + "Your gates against an alien\n", + "That by direct or by collateral hand\n", + "They find us touch'd, or carved to thee.\n", "\n", - "ADRIANA:\n", - "By thee; and put a tongue,\n", - "That in civility and patience waiteth on true sorrow.\n", - "And see where comes another man, if I live.\n", + "CARDINAL WOLSEY:\n", + "Your grace hath blessed and engaged to many Greeks,\n", + "Even in these cases, where in gore he lay insteep'd,\n", + "And take it.\n", "\n", - "TITUS ANDRONICUS:\n", - "Titus, prepare yourself in Egypt?\n", + "PROTEUS:\n", + "My gracious king:\n", + "And I do wish\n", + "That your pains the hire;\n", + "If you do wrong you? alas, our places.\n", "\n", - "Soothsayer:\n", - "Beware the foul fiend! five\n", - "fiends have brought to be commander of the night gone by.\n", + "SATURNINUS:\n", + "Why, worthy Margaret, that is the mad mothers than snow,\n", + "And all the posterns\n", + "Clear them out.\n", "\n", - "OCTAVIUS CAESAR:\n", - "O Antony, beg not your offence:\n", - "If you accept of grace: and from thy bed, fresh lily,\n", - "And when she was gone, but his judgment pattern of mine eyes;\n", - "Examine other be, some Florentine,\n", - "Deliver'd, both in one key,\n", - "As if our hands, our lives--\n", + "All:\n", + "A heavy reckoning to make\n", + "Mine eyes too, examined my parts with death, goodman Dull.\n", "\n", - "MACBETH:\n", - "I'll call them all encircle him about the streets?\n", + "DULL:\n", + "Which is not confess she does: there's another place\n", + "And find me well deliver:\n", + "Mark Antony, she pursed up\n", + "his heart think it cites us, brother, I go; I'll win them, fear it not;\n", + "Let not thy nature; let not every man's Hero:\n", "\n", - "First Gentleman:\n", - "That is intended drift\n", - "Than, by concealing it, heap on your way, which\n", - "is the way to Chester; and I would I wear them o' the city.\n", + "CLAUDIO:\n", + "I know him; 'tis a mere scutcheon: and so\n", + "ends my catechism.\n", "\n", - "Citizens:\n", - "No, no, no; not so; I did not think,--\n", - "My wife is dead.\n", - "Your majesty is\n", - "returned with some few bands of chosen shot I had,\n", - "That man may question? You seem to have said, my noble and valiant;\n", - "For thou has\n" + "EARL OF DOUGLAS:\n", + "'Faith, that hath gull'd thee there.\n", + "But, room, fairy! here comes your father's \n" ] } ], @@ -547,7 +534,7 @@ "metadata": {}, "outputs": [], "source": [ - "def P(t, h, LM=LM): \n", + "def P(t, h, LM: LanguageModel): \n", " \"The probability that token t follows history h.\"\"\"\n", " return LM[h][t] / sum(LM[h].values())" ] @@ -569,7 +556,7 @@ } ], "source": [ - "P('s', 'the ')" + "P('s', 'the ', LM)" ] }, { @@ -589,7 +576,7 @@ } ], "source": [ - "P('n', 'chai')" + "P('n', 'chai', LM)" ] }, { @@ -609,7 +596,7 @@ } ], "source": [ - "P('r', 'chai')" + "P('r', 'chai', LM)" ] }, { @@ -629,7 +616,7 @@ } ], "source": [ - "P('s', 'chai')" + "P('s', 'chai', LM)" ] }, { @@ -649,14 +636,14 @@ } ], "source": [ - "P(' ', 'chai')" + "P(' ', 'chai', LM)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Shakespeare never wrote about \"chaise longues,\" or \"chai tea\" so the probability of an `'s'` or `' '` following `'chai'` is zero, according to our language model. But do we really want to say it is absolutely impossible for the sequence of letters `'chais'` or `'chai '` to appear in a gebnerated text, just because we didn't happen to see it in our training data? More sophisticated language models use [**smoothing**](https://en.wikipedia.org/wiki/Kneser%E2%80%93Ney_smoothing) to assign non-zero (but small) probabilities to previously-unseen sequences. In this notebook we stick to the basic unsmoothed model." + "Shakespeare never wrote about \"chaise longues,\" or \"chai tea\" so the probability of an `'s'` or `' '` following `'chai'` is zero, according to our language model. But do we really want to say it is absolutely impossible for the sequence of letters `'chais'` or `'chai '` to appear in a generated text, just because we didn't happen to see it in our training data? More sophisticated language models use [**smoothing**](https://en.wikipedia.org/wiki/Kneser%E2%80%93Ney_smoothing) to assign non-zero (but small) probabilities to previously-unseen sequences. In this notebook we stick to the basic unsmoothed model." ] }, { @@ -680,54 +667,47 @@ "output_type": "stream", "text": [ "ROMEO:\n", - "Ay, strong;\n", - "A little. Prince of such matten a virtue's states:\n", - "Now country's quent again,\n", - "A most unacceptre her no leave-thou true shot, and, to\n", - "things of mine hath done alehousand pride\n", - "For be, whithee thus with of damm'st fly and came which he rank,\n", - "Put not wages woman! Harform\n", - "So long agon's side,\n", - "Singer's me her my slinged! He wit:' quoth Dorse! art than manner\n", - "straine.\n", + "What swifter of so much a doubled,\n", + "And I may, the dare, by the lives done own rich, that you naughter-out appearancess of your turn us,\n", + "Whose heave born blow be prology.\n", + "Keeper: proud.\n", "\n", - "AGAMEMNON:\n", - "I would says.\n", + "BALTHAZAR:\n", + "Let so shall a picture we mercy,\n", + "And the king this bondage an e'er that I storator:\n", "\n", - "BEATRICE:\n", - "Between my secreason ragined our uncrowned justing in thither naturer?\n", + "FERDINAL CAMPEIUS:\n", + "First Servant:\n", + "I this on your end\n", + "Louder with methink I do bid it: if heavens:\n", + "shall this vest; and run, my troops then, good and so forty wife.\n", + "Invited.\n", "\n", - "GLOUCESTER:\n", - "The king.\n", + "MACBETH:\n", + "Avaunt,\n", + "And Here is days.\n", "\n", - "DOGBERRY:\n", - "Do now nothink you\n", - "The tired.\n", + "ORLEANS:\n", + "And friend;\n", + "Dismissing, she detain the time thou scourselves itself:\n", + "but with the gent the half abused!\n", "\n", - "HORATIAN:\n", - "It stray\n", - "To see, peers, eo me, while; this days this man carbona-mi's, and for\n", - "in this late ther's loath,\n", - "Diminutes, shepher, sir.\n", + "QUEEN:\n", + "Their daughteous most in my lost fight\n", + "The prey to say you give himselves Lord's the comes bold your look the lady, look you, Fabian:\n", + "A pass!\n", "\n", - "BARDOLPH:\n", - "So.\n", + "EMILIA:\n", + "Is heater is they my him; and chard for my lord, ripe to Pompey, I and let us have your woo?\n", "\n", - "PETRUCHIO:\n", - "'Tis Angels upon me?\n", - "Hath no fare on,\n", - "what's the\n", - "moods.\n", + "Think upon: indeed? Do noison.\n", + "'Tis most in a suddenly out, sir; you are\n", + "A cist\n", + "For noble Antent our\n", + "daughter disclose him.\n", "\n", - "KING RICHARLES:\n", - "Thou odourse first Servantas, given in the life' thee, he same world I have spirit,\n", - "Or lord Phoebus' Corne.\n", - "\n", - "KENT:\n", - "Go you shafts that satisfied; leaven blession what charge of a this: for.\n", - "\n", - "ACHIMO:\n", - "'Zou\n" + "CELIA:\n", + "Dou\n" ] } ], @@ -766,7 +746,7 @@ ], "source": [ "! [ -f linux_input.txt ] || curl -O https://norvig.com/ngrams/linux_input.txt\n", - "! wc linux_input.txt" + "! wc linux_input.txt" ] }, { @@ -808,126 +788,135 @@ "text": [ "/*\n", " * linux/kernel.h>\n", - "#include \n", - "#include \n", - "#include \n", - "#include list, &ap->list) && kprobe_disarmed(p))\n", - "\t\treturn;\n", - "\n", - "\t/*\n", - "\t * Actually logging the members for stats sorting */\n", - "\tint\t\t\twork_color = next_color;\n", - "\t\t\t\tatomic_inc(&bt->dropped, 0);\n", - "\tINIT_LIST_HEAD(&rp->free_instance *pinst, int cpu)\n", - "{\n", - "\tstruct list_head *timers = tsk->cpu_timers_exit.\n", - " */\n", - "void __weak arch_show_interrupt(), \"Trying to figure out\n", - "\t * to the pending nohz_balance_enter_idle(void) { return -EAGAIN;\n", - "}\n", - "\n", - "/**\n", - " * irq_domain *domain;\n", - "\n", - "\tdomain = irq_data_to_desc(data);\n", - "\n", - "\tif (unlikely(iter->cache_reader_page->list, pages);\n", - "\tswsusp_show_speed(start, end = ULLONG_MAX;\n", - "\t\treturn;\n", - "\n", - "preempt:\n", - "\tresched_curr(rq);\n", - "#endif\n", - "\t\tsiginitset(&flush, sigmask(SIGSTOP));\n", - "\t__set_current_state(TASK_INTERRUPTS)\n", - "\t\treturn -EINVAL;\n", - "\t\terror = prepare_image(&orig_bm, ©_bm);\n", - "\n", - "\twhile (ptr < buf + buf_len) {\n", - "\t\tab = audit_log_lost(const char __user *uss, stack_t __user *, uset,\n", - "\t\tcompat_size_t __user *, out)\n", - "{\n", - "\tstruct ring_buffer_event_data(event);\n", - "\tuserpg->size = cnt;\n", - "\n", - "\tif (trace_probe_ops = {\n", - "\t.start\t\t= enum_map_next,\n", - "\t.show\t= ls_show,\n", - "};\n", - "\n", - "static inline int try_force_unload(unsigned long symbols have no timeslice manager)\n", - " * 3. give it to the parent interval. Besides, a forking task.\n", - "\t */\n", - "\ttsk->flags |= FTRACE_UPDATE_MAKE_NOP;\n", - "}\n", - "\n", - "/**\n", - " * ktime_get_fast_ns(&tk_fast_mono ____cacheline_aligned_in_smp;\n", - "\t\t\t\t\t/* did other CPUs / NUMA node within the range\n", - " *\tof pages statically initialized\n", - " */\n", - "static int rcu_is_cpu_rrupt_from_idle(void)\n", - "{\n", - "\tif (!ab)\n", - "\t\treturn;\n", - "\t}\n", - "#endif\n", - "\treturn 1;\n", - "}\n", - "__setup(\"nohz_full=\", tick_nohz_irq_exit(void)\n", - "{\n", - "\tstruct kmsg_dump_get_line);\n", - "\n", - "/**\n", - " * clockevents_shutdown(bc);\n", - "\t} else {\n", - "\t\tif (ret)\n", - "\t\t\t\tbreak;\n", - "\t\t\t\t}\n", - "\t\t\t}\n", - "\t\t}\n", - "\t}\n", - "\n", - "\t/*\n", - "\t * First we add the event header)\n", + "#include \n", + "#include irqs-off \\n\");\n", + " * recursive. An event enabled cpu */\n", + "\t\tdetach_timer(struct sched_domain_span(sd);\n", + "\tstruct ftrace_func(tk, ri, regs);\n", + "\n", + "\tif (!chip->irq_unmask\t= noop,\n", + "\t.irq_enable)\n", + "\t\tclear_frozen = false;\n", + "\n", + "\tif (time_before(end_time, timer_t, timer_id, &flag);\n", + "\tif (err)\n", + "\t\treturn;\n", + "\n", + "\ttracing_resize_ring_buffer_record_disabled)\n", + "\t\treturn;\n", + "\tif (desc) {\n", + "\t\traw_spin_lock_irqsave(&tracepoint_str + (*pos - 1);\n", + "\ti++;\n", + "\n", + "find_first_elem;\n", + "\t}\n", + "\n", + "\t/* sort them */\n", + "\tarray_desc\n", + "#define CAP_PI\t\t(void *)rec->ip);\n", + "\t\t\t/* Ftrace is shutting down system\");\n", + "\tshutdown_task != NULL)\n", + "\t\tevent->rcu_pending()) {\n", + "\t\terr = -EINVAL;\n", "}\n", "\n", - "static int __ftrace_graph_function(&trace_ops,\n", - "\t\t * it cannot be lesser than the corresponding to the\n", - " * func_stack, struct k_sigaction *action;\n", - "\tstruct ftrace_func_entry *ent, *next = buff;\n", - "\tstruct css_set is dead. So we can share the same order on entry: not idle task\n", - " * @prio: prio value (kernel-internal declarations,\n", - " * signal watchdog clocksource_max_adjustment caused clocksources\n", - " */\n", - "struct audit_krule *r, *nextr;\n", - "\tstruct pid *find_pid_ns(nr, ns);\n", - "\t\tif (!op->trampoline call the subsystem *system = NULL;\n", - "\t\treturn;\n", - "\t\t}\n", - "\t\treturn 0;\n", - "\t\t}\n", - "\t\tunlock_timer_bases) =\n", - "{\n", + "/* Special cases that /proc allows\n", + "\t * for built-in exception is the concept of\n", + "a \"sequence count */\n", + "\t\titer->trace is a kernel\n", + " * and userspace address.\n", + "\t\t * Either we have now waited for the first call.\n", + " * Return: %false if it was a timeout or signal will be freed in case of UMH_NO_WAIT)\t/* task has the given prefix.\n", + " *\t0 if no string for all tasks in the system configuration.\n", + " *\n", + " * Use this only\n", + " * one call to synchronized by task_work_add()\n", + " *\n", + " * Flush any pending */\n", + "\tdiv = div_s64(offset64 << NTP_SCALE_SHIFT. */\n", + "extern unsigned long msleep_interruptible(\n", + "\t\t\trnp->nocb_gp_tail;\n", + "\tbool nocb_leader = rdp_spawn)\n", + "\t\t\t\trdp_last = rdp;\n", + "\t\t\t\trdp = rdp->nocb_follower_head;\n", + "}\n", "\n", - "\t.lock = __MUTEX_INITIALIZED.\n", - " * (Initialization\n", - " * to reset tstamp_enabled accounting. Freeze the statistics), fill\n", - " * an iteration and returns the least surprise, but since kill is not\n", - "\t * run yet) will take care of permission check was made by the (now remove its dependency(struct trace_event_read_unlock(&pinst->lock);\n", - "\t\treturn WALK_PRED_DEFAULT,\n", - "\t.cap_inheritable;\n", - "\tax->old_pcap.effective_cpus, GFP_KERNEL);\n", - "\tif (!ctx->prio) {\n", - "\t\t\tsp.s\n" + "/*\n", + " * RCU global state. */\n", + "\n", + "/*\n", + " * Priority Inheritance state:\n", + " */\n", + "struct task_struct *p, int user_namespace *user_ns, struct task_struct() in task_numa_env env = {\n", + "\t\t.p = p,\n", + "\n", + "\t\t.src_cpu = busiest;\n", + "\n", + "out_balanced:\n", + "\t\t/*\n", + "\t\t * If the scheduled. */\n", + "\tMULTI_STOP_PREPARE, cpu);\n", + "\tBUG_ON(event->parent)\n", + "\t\tgoto out;\n", + "\t}\n", + "\ttrace_access_lock, cpu);\n", + "\tatomic_inc(&buffer->mutex);\n", + "\tINIT_LIST_HEAD(&cset->mg_tasks);\n", + "\t\tfakewriters, 4, \"Number of page frames total] + PAGES_FOR_IO)) / 2\n", + "\t\t\t- 2 * DIV_ROUND_UP(NR_CPUS, RCU_FANOUT;\n", + "\n", + "\t/*\n", + "\t * The taskstats *mk_reply(struct sched_rt_entity *rt_se)\n", + "{\n", + "\tstruct fd output;\n", + "\t\t\tret = blk_trace_getrq, NULL);\n", + "\tcd.wrap_kt, HRTIMER_MODE_ABS_PINNED, 0);\n", + "}\n", + "\n", + "/**\n", + " * ptrace_trap_notify(t);\n", + "\t\t\t}\n", + "\t\t\tif (later_mask = mask;\n", + "\tcurrent->curr_ret_stack, cpu);\n", + "\t}\n", + "\tpreempt_disable_cmds(void)\n", + "{\n", + "\treturn wl;\n", + "}\n", + "#else\n", + "static inline void module_unload_free(struct module *mod;\n", + "\n", + "\tmod = __module_get(dev->owner))\n", + "\t\treturn -EINVAL;\n", + "\n", + "\traw_spin_unlock(&cfs_b->lock\n", + " * must be able to reap\n", + "\t * it yet.\n", + "\t */\n", + "\tftrace_hash(new_hash);\n", + "\t\t}\n", + "\t\tmemory_bm_clear_bit(KTHREAD_IS_PARKED, &self->flags)) {\n", + "\t\tif (desc->wake_depth++ == 0) {\n", + "\t\t/* We should not be called unless tick_nohz_full_enabled() || rt_b->rt_runtime == period, ie unlimited)\\n\"\n", + "#endif\n", + "\t\"\\n trace_marker\\t\\t- Write 0/1 to enable function */\n", + "\tcur_stack >= env->prog->aux->ops->\n", + "\t\t\tconvert_ctx_access(int off, int size,\n", + "\t\t\t\tenv->flags &= ~mask;\n", + "}\n", + "\n", + "static const struct cpupri *cp,\n", + "\t\t struct held_lock *hlock)\n", + "{\n", + "\treturn __wakeup_reset(tr);\n", + "\n", + "\tset_tracer_flags->val;\n", + "\ttrace_on = tracing_open,\n", + "\t.read\t\t= seq_read,\n", + "\t.write\t\t= kgdb_console_write,\n", + "\t.seq_show = cpuset_read_u64,\n", + "\t\t.write_u64 = cpuset_write_res\n" ] } ], @@ -957,139 +946,139 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel/irq/pm.c\n", + " * linux/kernel/irq/proc.c\n", " *\n", - " * Copyright (C) 2004 Pavel Machek \n", - " * Copyright (C) 2007-2008 Steven Rostedt \n", - " * Copyright (C) 2014 Seth Jennings \n", - " * Copyright (C) 2005-2006 Thomas Gleixner\n", + " * Copyright (C) 2009 Jason Baron \n", + " * Copyright (C) 2009 Jason Baron \n", + " * Copyright (C) 2006 Rafael J. Wysocki \n", " *\n", - " * No idle tick implementation for gcov data files. Release resources allocated\n", - " * by open().\n", + " * This file is released under the GPLv2.\n", " */\n", - "static int gcov_seq_release(struct inode *inode, struct file *file)\n", - "{\n", - "\tput_event(file->private_data);\n", + "\n", + "#include \n", + "#include \n", + "#include \n", + "\n", + "#include \n", + "#include \n", + "\n", + "#include \"trace_probe.h\"\n", + "\n", + "#define KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(ret)) {\n", + "\t\tpr_warn(\"error enabling all events\\n\");\n", + "\t\treturn;\n", "\t}\n", "\n", + "\tcancel_delayed_work_sync(&req->work);\n", + "\n", + "\ttrace_pm_qos_update_request(req->pm_qos_class,\n", + "\t\t\t\t\t new_value, timeout_us);\n", + "\tif (new_value != req->node.prio)\n", + "\t\tpm_qos_update_target(struct pm_qos_constraints network_tput_constraints,\n", + "\t.name = \"memory_bandwidth\",\n", + "};\n", + "\n", + "\n", + "static struct pm_qos_object memory_bandwidth_pm_qos,\n", + "};\n", + "\n", + "static ssize_t\n", + "tracing_write_stub(struct file *filp, const char __user *ubuf, size_t cnt,\n", + "\t\t loff_t *ppos)\n", + "{\n", + "\tint ret = -ENODEV;\n", + "\n", + "\tmutex_lock(&trace_types_lock);\n", + "\n", + "\ttr->current_trace = &nop_trace;\n", + "\n", + "#ifdef CONFIG_BRANCH_TRACER\n", + "int\n", + "trace_selftest_startup_wakeup,\n", + "#endif\n", + "\t.open\t\t= wakeup_trace_open,\n", + "\t.close\t\t= graph_trace_close,\n", + "\t.init\t\t= graph_trace_init,\n", + "\t.reset\t\t= function_trace_start,\n", + "\t.flags\t\t= &func_flags,\n", + "\t.set_flag\t= wakeup_set_flag,\n", + "\t.flag_changed\t= irqsoff_flag_changed,\n", + "#ifdef CONFIG_FTRACE_SELFTEST\n", + "\t.selftest = trace_selftest_startup_preemptirqsoff(struct tracer *tracer = tr->current_trace;\n", + "\tinfo->iter.trace_buffer = &tr->trace_buffer;\n", + "\tinfo->spare\t\t= NULL;\n", + "\t/* Force reading ring buffer for first read */\n", + "\tinfo->read\t\t= (unsigned int)-1;\n", + "\n", + "\tfilp->private_data = dir;\n", + "\n", "\treturn 0;\n", - "\n", - "free:\n", - "\tklp_free_funcs_limited(obj, NULL);\n", - "\t\tkobject_put(obj->kobj);\n", - "\t}\n", "}\n", "\n", - "static void print_other_cpu_stall(rsp, gpnum);\n", + "static void mmio_trace_start(struct trace_iterator *iter, int flags,\n", + "\t\t struct timespec *tp)\n", + "{\n", + "\treturn posix_cpu_clock_get,\n", + "\t.timer_create\t= posix_cpu_timer_create(&timer);\n", + "\ttimer.it_process = current;\n", + "\tif (!error) {\n", + "\t\tstatic struct itimerspec zero_it;\n", + "\n", + "\t\tmemset(it, 0, sizeof *it);\n", + "\t\tit->it_value = *rqtp;\n", + "\n", + "\t\tspin_lock_irq(&callback_lock);\n", + "\n", + "\tif (!cpumask_empty(desc->percpu_enabled));\n", + "\t\tgoto bad;\n", "\t}\n", - "}\n", "\n", - "/**\n", - " * rcu_cpu_stall_reset(void)\n", - "{\n", - "\tstruct tick_sched *ts)\n", - "{\n", - "\tktime_t now = ktime_get();\n", - "\n", - "\tif (ts->idle_active && nr_iowait_cpu(cpu) > 0) {\n", - "\t\t\tktime_t delta = ktime_sub(now, alarm->node.expires,\n", - "\t\t\t\t\t\t\tincr*overrun);\n", - "\n", - "\t\tif (alarm->node.expires,\n", - "\t\t\t\t\t\t\tincr*overrun);\n", - "\n", - "\t\tif (alarm->node.expires,\n", - "\t\t\t\tHRTIMER_MODE_ABS);\n", - "\t\tif (!hrtimer_active(&t.timer))\n", - "\t\tt.task = NULL;\n", - "\n", - "\tif (likely(!audit_ever_enabled))\n", - "\t\treturn;\n", - "\n", - "\t/*\n", - "\t * if we're unable to extend our runtime we resched so that the active\n", - "\t * hierarchy can be throttled\n", + "\t/* Found it - now remove it from the stack, and add back the other\n", + "\t * entries (if any), recalculating the hash along the way:\n", "\t */\n", - "\tif (!assign_cfs_rq_runtime(cfs_rq);\n", "\n", - "\ttg->cfs_rq[cpu] = cfs_rq;\n", - "\ttg->se[cpu] = se;\n", + "\tcurr->lockdep_depth++;\n", + "\tcheck_chain_key(curr);\n", + "}\n", "\n", - "\t/* se could be NULL for root_task_group */\n", - "\tif (!se)\n", - "\t\treturn;\n", - "\n", - "\tif (!parent) {\n", - "\t\tse->cfs_rq = &rq->cfs;\n", - "\t\tse->depth = 0;\n", - "\t} else {\n", - "\t\tse->cfs_rq = parent->my_q;\n", - "\t\tse->depth = parent->depth + 1;\n", + "static int __lock_is_held(struct lockdep_map *lock)\n", + "{\n", + "\tstruct task_struct *p, int head)\n", + "{\n", + "\tstruct sched_rt_entity *rt_se)\n", + "{\n", + "\treturn !list_empty(&pool->worklist) &&\n", + "\t\tatomic_read(&pool->nr_running);\n", "\t}\n", - "\n", - "\tse->my_q = cfs_rq;\n", - "\t/* guarantee group entities always have weight */\n", - "\tupdate_load_set(&se->load, weight);\n", - "\n", - "\tif (se->on_rq)\n", - "\t\taccount_entity_enqueue(cfs_rq, se);\n", - "\tupdate_cfs_shares(cfs_rq);\n", - "\n", - "#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER */\n", - "\n", - "long prctl_get_seccomp(void)\n", - "{\n", - "\treturn current->seccomp.mode is non-zero, it may not be changed.\n", - " *\n", - " * Returns 0 on success.\n", - " */\n", - "int proc_dostring(struct ctl_table *table, int write,\n", - "\t\t void __user *buffer, size_t *lenp,\n", - "\t\t loff_t *ppos)\n", - "{\n", - "\tint err = 0;\n", - "\tbool first = 1;\n", - "\tsize_t left = *lenp;\n", - "\tunsigned long bitmap_size)\n", - "{\n", - "\tint i, j;\n", - "\tunsigned long all_timers;\n", - "\tint cpu;\n", - "\tstruct trace_array_cpu *data);\n", - "\n", - "struct trace_entry *ent)\n", - "{\n", - "\tconst __u64 *val = pdu_start(ent);\n", - "\t__u64 sector_from = __r->sector_from;\n", - "\n", - "\tr->device_from = be32_to_cpu(__r->device_from);\n", - "\tr->device_to = be32_to_cpu(__r->device_to);\n", - "\tr->sector_from = be64_to_cpu(sector_from);\n", "}\n", "\n", - "typedef void (blk_log_action_t) (struct trace_iterator *iter;\n", - "\tstruct seq_file *m = file->private_data;\n", - "\n", - "\tstruct ring_buffer_event *\n", - "trace_event_buffer_lock_reserve(buffer, 10);\n", - "\t\t\tif (!event) {\n", - "\t\t\t\tmissed++;\n", - "\t\t\t} else {\n", - "\t\t\t\tverbose(\"invalid bpf_context access off=%d size=%d\\n\", off, size);\n", - "\treturn -EACCES;\n", + "static void update_cond_flag(struct ftrace_event_field *field;\n", + "\tstruct list_head *head_page, *prev_page, *r;\n", + "\t\tstruct list_head *firing,\n", + "\t\t unsigned long len,\n", + "\t\t\t unsigned long len,\n", + "\t\t\t\t struct load_info *info)\n", + "{\n", "}\n", "\n", - "/* check whether memory at (regno + off) is accessible for t = (read | write)\n", - " * if t==write, value_regno is a register which value is stored into memory\n", - " * if t==read && value_regno==-1, some unknown value is stored into memory\n", - " * if t==read && value_regno==-1, don't care what we read from memory\n", - " */\n", - "static int check_prlimit_permission(tsk);\n", - "\tif (ret) {\n", - "\t\trcu_read_unlock();\n", + "static void add_kallsyms(struct module *mod)\n", + "{\n", + "\tdel_usage_links(mod);\n", + "\tadd_sect_attrs(mod, info);\n", + "\tadd_notes_attrs(mod, info);\n", "\n", - "\tif (!child)\n", - "\t\tret\n" + "\tkobject_uevent(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));\n", + "\tmod->mkobj.kobj.kset = module_kset;\n", + "\t\terr = kobject_init_and_add(&mk->kobj, &module_uevent.attr);\n", + "#endif\n", + "\t\tif (err) {\n", + "\t\t\tkobject_put(&mk->kobj);\n", + "\t\t}\n", + "\t}\n", + "}\n", + "\n", + "/* module\n" ] } ], @@ -1109,7 +1098,7 @@ "\n", "Karpathy and Goldberg both used character models, because the exact formatting of characters (especially indentation and line breaks) is important in the format of plays and C++ programs. But if you are interested in generating paragraphs of text that don't have any specific format, it is common to use a **word** model, which represents the probability of the next word given the previous words, or a **token** model in which tokens can be words, punctuation, or parts of words. For example, the text `\"Spiderman!\"` might be broken up into the three tokens `\"Spider\"`, `\"man\"`, and `\"!\"`. \n", "\n", - "One simple way of tokenizing a text is to break it up into alternating word and non-word characters; the function `tokenize` does that by default:" + "One simple way of tokenizing a text is to break it up into alternating strings of word and non-word characters; the function `tokenize` does that by default:" ] }, { @@ -1120,9 +1109,10 @@ "source": [ "import re\n", "\n", - "def tokenize(text: str, regex=r'\\w+|\\W+') -> List[Token]: \n", - " \"\"\"Break text up into tokens using regex; \n", - " by default break into alternating word-character and non-word-character tokens.\"\"\"\n", + "word_or_nonword = r'\\w+|\\W+' # Regular expression to parse a string of either word or non-word characters.\n", + "\n", + "def tokenize(text: str, regex=word_or_nonword) -> List[Token]: \n", + " \"\"\"Break text up into tokens using regex.\"\"\"\n", " return re.findall(regex, text)" ] }, @@ -1133,14 +1123,17 @@ "outputs": [], "source": [ "assert tokenize('Soft! who comes here?') == [\n", - " 'Soft', '! ', 'who', ' ', 'comes', ' ', 'here', '?']" + " 'Soft', '! ', 'who', ' ', 'comes', ' ', 'here', '?']\n", + "\n", + "assert tokenize('wherefore art thou ') == [\n", + " 'wherefore', ' ', 'art', ' ', 'thou', ' ']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "We can train a token model on the Shakespeare data. A model of order 6 keeps a history of up to three word and three non-word tokens. The keys of the language model dictionary consist of strings formed by concatenating the 6 tokens together." + "We can train a token model on the Shakespeare data. A model of order 6 keeps a history of up to three word and three non-word tokens. " ] }, { @@ -1249,98 +1242,87 @@ "output_type": "stream", "text": [ "First Citizen:\n", - "Before we proceed any further, hear me speak.\n", + "Before we proceed any further, hear me speak,\n", + "Before you answer Warwick. His demand\n", + "Springs not from Edward's well-meant honest love,\n", + "But from deceit bred by necessity;\n", + "For how can I grace my talk,\n", + "Wanting a hand to hold a sceptre up\n", + "And with the clamour of thy drum,\n", + "And even at hand a drum is ready braced\n", + "That shall reverberate all as loud as Mars. By Jupiter,\n", + "Were I the Moor, I would not be awaked.\n", "\n", - "CASSIO:\n", - "Madam, not now: I am glad to hear you tell my worth\n", - "Than you much willing to be counted wise\n", - "In spending your wit in the praise.\n", + "LORENZO:\n", + "That is the very note of it: and it is known she is, these moral laws\n", + "Of nature and of nations, 'long\n", + "To him and his virtue;\n", + "By her election may be truly read\n", + "What kind of man,\n", + "So keen and greedy to confound a man:\n", + "He plies the duke at dinner: by two o'clock I'll get me such a question: stand again:\n", + "Think'st thou I am an old man's life is done:\n", + "Then, dear my liege, mine honour let me try;\n", + "In that I live and for that will I cause these of Cyprus to\n", + "mutiny; whose qualification shall come into no true\n", + "taste again but by the recorder.\n", + "Then he was urged to tell my tale again,\n", + "'Thus saith the duke, thus hath the duke inferr'd;'\n", + "But nothing spake in warrant from himself.\n", + "When he had done, some followers of mine own lie heavy in my breast\n", + "And go well satisfied to France again.\n", "\n", - "AJAX:\n", - "I do hate him\n", - "As rootedly as I. Burn but his books.\n", - "He has brave utensils,--for so he calls me: now I feed myself\n", - "With most delicious poison. Think on me,\n", - "That cropp'd the golden prime of this sweet prince,\n", - "And if your grace mark every circumstance,\n", - "You have great reason to do Richard right;\n", - "Especially for those occasions\n", - "At Eltham Place I told your majesty as much before:\n", - "This proveth Edward's love and Warwick's, and must have my will;\n", - "If one good deed in a naughty world.\n", + "PRINCESS:\n", + "You do the nobler.\n", "\n", - "NERISSA:\n", - "When the moon shone, we did not see your grace.\n", + "CORIOLANUS:\n", + "I muse my Lord of Winchester, I charge you,\n", + "Not fearing the displeasure of your master,\n", + "Which on your just proceeding I'll keep what I have said to you?\n", "\n", - "DUKE:\n", - "I am sorry, madam, I have hurt your kinsman:\n", - "But, had it been a carbuncle\n", - "Of Phoebus' wheel, and might so safely, had it\n", - "Been all the worth of man's flesh taken from a man\n", - "Is not so estimable, profitable neither,\n", - "As flesh of muttons, beefs, or goats. I say,\n", - "To buy his favour, I extend this friendship:\n", - "If he will touch the gate.\n", - "You are a saucy fellow:\n", - "Deserve we no more reverence?\n", + "OPHELIA:\n", + "So please you, it is true, indeed.\n", "\n", - "GRIFFITH:\n", - "You are to blame,\n", - "Knowing she will not, I\n", - "will; for good things should be praised.\n", + "GRATIANO:\n", + "'Tis a strange serpent.\n", "\n", - "SPEED:\n", - "'Item: She is curst.'\n", + "MARK ANTONY:\n", + "'Tis said, man; and farewell.\n", "\n", - "LAUNCE:\n", - "Well, the best is, he lives not in them.\n", - "\n", - "LUCIO:\n", - "Friar, thou knowest not the duke so well as plain-dealing, which will not show without knocking.\n", - "The man's undone forever; for if Hector break not his\n", - "neck i' the combat, he'll break 't himself in\n", - "vain-glory. He knows not me: I said 'Good morrow,\n", - "Ajax;' and he replies 'Thanks, Agamemnon.' What think\n", - "you of this fair company\n", - "Clapp'd wings to me.\n", - "\n", - "Chamberlain:\n", - "You are young, Sir Harry Guildford.\n", - "\n", - "SANDS:\n", - "Sir Thomas Lovell, take't of my soul,\n", - "That I must bear it.\n", - "\n", - "SIR HUGH EVANS:\n", - "Got's will, and his passion of my heart\n", - "Her eyes, her hair, her cheek, her lip,\n", - "Nay, her foot speaks; her wanton spirits look out\n", - "At every joint and motive of her body stands Ireland?\n", - "\n", - "DROMIO OF SYRACUSE:\n", - "Faith, I saw it in his pocket too; and this, it seems,\n", - "Roderigo meant to have sent this damned villain;\n", - "But that belike Iago in the interim\n", - "Came in and satisfied him.\n", - "\n", - "OTHELLO:\n", - "O the pernicious caitiff!\n", - "How came you, Cassio, by that handkerchief\n", - "That was my wife a girl;\n", - "Your precious self had then not cross'd the Hellespont.\n", - "\n", - "PROTEUS:\n", - "That's a lie in thy sheet of\n", - "paper, although the sheet were big enough for him otherwise he might put on a hat,\n", - "a muffler and a kerchief, and so escape.\n", + "EROS:\n", + "Farewell, great chief. Shall I strike at it with you, and so following, but I will murder your ruff for this.\n", "\n", "FALSTAFF:\n", - "Good hearts, devise something: any extremity rather\n", - "than a mischief.\n", + "No more, Pistol; I would not\n", + "Believe her lips in opening it. Proceed.\n", "\n", - "MISTRESS FORD:\n", - "My maid's aunt, the fat woman of Brentford; he swears\n", - "she's a \n" + "CORNELIUS:\n", + "Your daughter, whom she bore in hand to love\n", + "With such integrity, she did confess\n", + "Was as a scorpion to her sight; whose life,\n", + "But that the heavens fought: the king himself\n", + "Of his wings destitute, the army broken,\n", + "And but the backs of Britons seen, all flying\n", + "Through a straight lane; the enemy full-hearted,\n", + "Lolling the tongue with slaughtering, having work\n", + "More plentiful than tools to do't?\n", + "\n", + "First Lord:\n", + "You must not think\n", + "That we are made of stuff so flat and dull\n", + "That we can let our beard be shook with danger\n", + "And think it not the worst of me. So, I leave you, sir.\n", + "\n", + "VINCENTIO:\n", + "You shall not now be stol'n away to Rome; hath ta'en thy stand,\n", + "The elected deer before thee?\n", + "\n", + "PISANIO:\n", + "But to win time\n", + "To lose so bad employment; in the which\n", + "I do arrest you, sir: you might have heard it said, unbidden guests\n", + "Are often welcomest when they are full,\n", + "They \n" ] } ], @@ -1364,116 +1346,90 @@ "Peace, ho! Hear Antony. Most noble Antony!\n", "\n", "ANTONY:\n", - "Why, friends, you go to do you know not what:\n", - "Wherein hath Caesar thus deserved your loves?\n", - "Alas, you know not: I must tell you then:\n", - "You have forgot the will I told you of.\n", - "\n", - "All:\n", - "Most true. The will! Let's stay and hear the will.\n", - "\n", - "ANTONY:\n", - "Here is the will, and under Caesar's seal.\n", - "To every Roman citizen he gives,\n", - "To every several man, seventy-five drachmas.\n", - "\n", - "Second Citizen:\n", - "Most noble Caesar! We'll revenge his death.\n", - "\n", - "Third Citizen:\n", - "O royal Caesar!\n", - "\n", - "ANTONY:\n", - "Hear me with patience.\n", - "\n", - "IMOGEN:\n", - "Talk thy tongue weary; speak\n", - "I have heard I am a strumpet; and mine ear\n", - "Therein false struck, can take no greater wound,\n", - "Nor tent to bottom that. But speak.\n", - "\n", - "PISANIO:\n", - "Then, madam,\n", - "I thought you would not back again.\n", - "\n", - "IMOGEN:\n", - "Most like;\n", - "Bringing me here to kill me.\n", - "\n", - "PISANIO:\n", - "Not so, neither:\n", - "But if I were as tedious as go o'er:\n", - "Strange things I have in head, that will to hand;\n", - "Which must be acted ere they may be scann'd.\n", - "\n", - "LADY MACBETH:\n", - "You lack the season of all natures, sleep.\n", - "\n", - "MACBETH:\n", - "Come, we'll to sleep. My strange and self-abuse\n", - "Is the initiate fear that wants hard use:\n", - "We are yet but young in deed.\n", - "\n", - "First Witch:\n", - "Why, how now, Hecate! you look angerly.\n", - "\n", - "HECATE:\n", - "Have I not reason to prefer mine own?\n", - "\n", - "VALENTINE:\n", - "And I will help thee to prefer her too:\n", - "She shall be dignified with this high honour--\n", - "To bear my lady's train, lest the base earth\n", - "Should from her vesture chance to steal a kiss\n", - "And, of so great a favour growing proud,\n", - "Disdain to root the summer-swelling flower\n", - "And make rough winter everlastingly.\n", - "\n", - "PROTEUS:\n", - "Why, Valentine, what braggardism is this?\n", - "\n", - "VALENTINE:\n", - "Pardon me, Proteus: all I can is nothing\n", - "To her whose worth makes other worthies nothing;\n", - "She is alone.\n", - "\n", - "PROTEUS:\n", - "Then let her alone.\n", - "\n", - "VALENTINE:\n", - "Not for the world: why, man, she is mine own,\n", - "And I as rich in having such a jewel\n", - "As twenty seas, if all their sand were pearl,\n", - "The water nectar and the rocks pure gold.\n", - "Forgive me that I do not.\n", - "\n", - "PROSPERO:\n", - "Twelve year since, Miranda, twelve year since,\n", - "Thy father was the Duke of Milan and\n", - "A prince of power.\n", - "\n", - "MIRANDA:\n", - "Sir, are not you my husband?\n", + "Why, friends, you go to do you know not what\n", + "you speak. But, if ever the duke return, as our\n", + "prayers are he may, let me desire you to make your\n", + "answer before him. If it be honest you have spoke,\n", + "you have courage to maintain it: I am bound to wonder, I am bound\n", + "To Persia, and want guilders for my voyage:\n", + "Therefore make present satisfaction,\n", + "Or I'll attach you by this officer.\n", "\n", "ANTIPHOLUS OF EPHESUS:\n", - "No; I say nay to that.\n", + "I will debate this matter at more leisure\n", + "And teach your ears to list me with more heed.\n", + "To Adriana, villain, hie thee straight:\n", + "Give her this key, and tell her, in the desk\n", + "That's cover'd o'er with Turkish tapestry,\n", + "There is a purse of ducats; let her send it:\n", + "Tell her I am arrested in the street\n", + "And that shall bail me; hie thee, slave, be gone!\n", + "On, officer, to prison till it come.\n", "\n", - "ANTIPHOLUS OF SYRACUSE:\n", - "And so do I too, lieutenant.\n", + "DROMIO OF SYRACUSE:\n", + "To Adriana! that is where we dined,\n", + "Where Dowsabel did claim me for her husband:\n", + "She is too big, I hope, for me to compass.\n", + "Thither I must, although against my will,\n", + "For servants must their masters' minds fulfil.\n", "\n", - "CASSIO:\n", - "Ay, but, by your leave, not before me; the\n", - "lieutenant is to be saved before the ancient. Let's\n", - "have no more of life than may suffice\n", - "To give my tongue that heat to ask your help;\n", - "Which if you shall refuse, when I am dead,\n", - "For that I am prepared and full resolved.\n", - "Foul-spoken coward, that thunder'st with thy tongue,\n", - "And with thy weapon nothing darest perform!\n", + "ADRIANA:\n", + "Ah, Luciana, did he tempt thee so?\n", + "Mightst thou perceive austerely in his eye\n", + "That he did plead in earnest? yea or no?\n", + "Look'd he or red or pale, or sad or merrily,\n", + "Interpretation will misquote our looks,\n", + "And we shall feed like oxen at a stall,\n", + "The better cherish'd, still the nearer death.\n", + "My nephew's trespass may be well forgot;\n", + "it hath the excuse of youth and heat of blood,\n", + "And an adopted name of privilege,\n", + "A hair-brain'd Hotspur, govern'd by a child!\n", "\n", - "AARON:\n", - "Away, I say!\n", - "Now, \n" + "Second Citizen:\n", + "In him there is a hope of government,\n", + "That in his nonage council under him,\n", + "And in his full and ripen'd years himself,\n", + "No doubt, shall then and till then govern well.\n", + "\n", + "First Citizen:\n", + "So stood the state when Henry the Sixth\n", + "Was crown'd in Paris but at nine months old.\n", + "\n", + "Third Citizen:\n", + "Stood the state so? No, no, good friends, God wot;\n", + "For then this land was famously enrich'd\n", + "With politic grave counsel; then the king\n", + "Had virtuous uncles to protect his grace.\n", + "\n", + "First Citizen:\n", + "Why, so hath this, both by the father and mother.\n", + "\n", + "Third Citizen:\n", + "Better it were they all came by the father,\n", + "Or by the father there were none at all;\n", + "For emulation now, who shall be nearest,\n", + "Will touch us all too near, if God prevent not.\n", + "O, full of danger is the Duke of Norfolk:\n", + "Ratcliff, thyself, or Catesby; where is he?\n", + "\n", + "CATESBY:\n", + "Here, my lord.\n", + "\n", + "KING RICHARD III:\n", + "Then, by myself--\n", + "\n", + "QUEEN ELIZABETH:\n", + "Thyself thyself misusest.\n", + "\n", + "KING RICHARD III:\n", + "Why, Buckingham, I say, I would be king,\n", + "\n", + "BUCKINGHAM:\n", + "Why, so you are, my thrice renowned liege.\n", + "\n", + "KING RICHARD III:\n", + "\n" ] } ], @@ -1504,566 +1460,490 @@ " *\n", " * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar\n", " *\n", - " * This file contains spurious interrupt handling.\n", + " * This file contains the IRQ-resend code\n", + " *\n", + " * If the interrupt is waiting to be processed, we try to re-run it.\n", + " * We can't directly run it from here since the caller might be in an\n", + " * interrupt-protected region. Not all irq controller chips can\n", + " * retrigger interrupts at the hardware level, so in those cases\n", + " * we allow the resending of IRQs via a tasklet.\n", " */\n", "\n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", + "#include \n", + "#include \n", + "#include \n", "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "\n", - "/*\n", - " * The run state of the lockup detectors.\n", - "\t */\n", - "\tif (!write) {\n", - "\t\t*watchdog_param = (watchdog_enabled & which) != 0;\n", - "\t\terr = proc_dointvec_minmax(table, write, buffer, lenp, ppos);\n", - "\tput_uts(table, write, uts_table.data);\n", - "\n", - "\tif (write)\n", - "\t\tproc_sys_poll_notify(table->poll);\n", - "\n", - "\treturn r;\n", - "}\n", - "#else\n", - "#define proc_do_uts_string NULL\n", - "#endif\n", - "\n", - "static DEFINE_CTL_TABLE_POLL(hostname_poll);\n", - "static DEFINE_CTL_TABLE_POLL(domainname_poll);\n", - "\n", - "static struct ctl_table uts_kern_table[] = {\n", - "\t{\n", - "\t\t.procname\t= \"ostype\",\n", - "\t\t.data\t\t= init_uts_ns.name.sysname,\n", - "\t\t.maxlen\t\t= sizeof(init_uts_ns.name.version),\n", - "\t\t.mode\t\t= 0444,\n", - "\t\t.proc_handler\t= proc_do_uts_string,\n", - "\t},\n", - "\t{\n", - "\t\t.procname\t= \"hostname\",\n", - "\t\t.data\t\t= init_uts_ns.name.nodename,\n", - "\t\t.maxlen\t\t= sizeof(init_uts_ns.name.release),\n", - "\t\t.mode\t\t= 0444,\n", - "\t\t.proc_handler\t= proc_do_uts_string,\n", - "\t},\n", - "\t{\n", - "\t\t.procname\t= \"version\",\n", - "\t\t.data\t\t= init_uts_ns.name.version,\n", - "\t\t.maxlen\t\t= sizeof(init_uts_ns.name.sysname),\n", - "\t\t.mode\t\t= 0444,\n", - "\t\t.proc_handler\t= proc_do_uts_string,\n", - "\t},\n", - "\t{\n", - "\t\t.procname\t= \"version\",\n", - "\t\t.data\t\t= init_uts_ns.name.version,\n", - "\t\t.maxlen\t\t= sizeof(init_uts_ns.name.version),\n", - "\t\t.mode\t\t= 0444,\n", - "\t\t.proc_handler\t= proc_do_uts_string,\n", - "\t},\n", - "\t{\n", - "\t\t.procname\t= \"osrelease\",\n", - "\t\t.data\t\t= init_uts_ns.name.release,\n", - "\t\t.maxlen\t\t= sizeof(init_uts_ns.name.domainname),\n", - "\t\t.mode\t\t= 0644,\n", - "\t\t.proc_handler\t= proc_do_uts_string,\n", - "\t\t.poll\t\t= &domainname_poll,\n", - "\t},\n", - "\t{}\n", - "};\n", - "\n", - "static struct ctl_table uts_root_table[] = {\n", - "\t{\n", - "\t\t.procname\t= \"kernel\",\n", - "\t\t.mode\t\t= 0555,\n", - "\t\t.child\t\t= uts_kern_table,\n", - "\t},\n", - "\t{}\n", - "};\n", - "\n", - "#ifdef CONFIG_PROC_SYSCTL\n", - "/*\n", - " * Notify userspace about a change in a certain entry of uts_kern_table,\n", - " * identified by the parameter proc.\n", - " */\n", - "void uts_proc_notify(enum uts_proc proc)\n", - "{\n", - "\tstruct ctl_table *table = &uts_kern_table[proc];\n", - "\n", - "\tproc_sys_poll_notify(table->poll);\n", - "}\n", - "#endif\n", - "\n", - "static int __init utsname_sysctl_init(void)\n", - "{\n", - "\tregister_sysctl_table(uts_root_table);\n", - "\treturn 0;\n", - "}\n", - "\n", - "device_initcall(utsname_sysctl_init);\n", - "/*\n", - " * Public API and common code for kernel->userspace relay file support.\n", - " *\n", - " * See Documentation/filesystems/relay.txt for an overview.\n", - " *\n", - " * Copyright (C) 2002-2005 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp\n", - " * Copyright (C) 1999-2005 - Karim Yaghmour (karim@opersys.com)\n", - " *\n", - " * Moved to kernel/relay.c by Paul Mundt, 2006.\n", - " * November 2006 - CPU hotplug support by Mathieu Desnoyers\n", - " * \t(mathieu.desnoyers@polymtl.ca)\n", - " *\n", - " * This file is released under the GPLv2.\n", - " *\n", - " */\n", - "\n", - "#include \n", - "#include \n", - "\n", + "#include \n", + "#include \n", "#include \n", - "#include \n", - "#endif\n", - "#ifdef CONFIG_SPARC\n", - "#endif\n", + "#include \n", "\n", - "#ifdef __hppa__\n", - "extern int pwrsw_enabled;\n", - "#endif\n", + "#include \"trace.h\"\n", "\n", - "#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW\n", - "extern int unaligned_enabled;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_IA64\n", - "extern int unaligned_dump_stack;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN\n", - "extern int no_unaligned_warning;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_PROC_SYSCTL\n", - "\n", - "#define SYSCTL_WRITES_LEGACY\t-1\n", - "#define SYSCTL_WRITES_WARN\t 0\n", - "#define SYSCTL_WRITES_STRICT\t 1\n", - "\n", - "static int sysctl_writes_strict = SYSCTL_WRITES_WARN;\n", - "\n", - "static int proc_do_cad_pid(struct ctl_table *table, int write,\n", - "\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n", - "{\n", - "\treturn -ENOSYS;\n", - "}\n", - "\n", - "int proc_dointvec_jiffies(struct ctl_table *table, int write,\n", - "\t\t void __user *buffer, size_t *lenp, loff_t *ppos);\n", - "#endif\n", - "\n", - "#ifdef CONFIG_PRINTK\n", - "static int ten_thousand = 10000;\n", - "#endif\n", - "\n", - "/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */\n", - "static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;\n", - "\n", - "/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */\n", - "static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;\n", - "\n", - "/* this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */\n", - "#ifdef CONFIG_DETECT_HUNG_TASK\n", - "static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);\n", - "#endif\n", - "\n", - "#ifdef CONFIG_INOTIFY_USER\n", - "#include \n", - "#endif\n", - "#ifdef CONFIG_SPARC\n", - "#endif\n", - "\n", - "#ifdef __hppa__\n", - "extern int pwrsw_enabled;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW\n", - "extern int unaligned_enabled;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_IA64\n", - "extern int unaligned_dump_stack;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN\n", - "extern int no_unaligned_warning;\n", - "#endif\n", - "\n", - "#ifdef CONFIG_PROC_SYSCTL\n", - "\n", - "#define SYSCTL_WRITES_LEGACY\t-1\n", - "#define SYSCTL_WRITES_WARN\t 0\n", - "#define SYSCTL_WRITES_STRICT\t 1\n", - "\n", - "static int sysctl_writes_strict = SYSCTL_WRITES_WARN;\n", - "\n", - "static int proc_do_cad_pid(struct ctl_table *table, int write,\n", - "\t\tvoid __user *buffer, size_t *lenp, loff_t *ppos)\n", - "{\n", - "\treturn do_proc_dointvec(table, write, buffer, lenp, ppos);\n", - "}\n", - "#endif\n", - "\n", - "struct do_proc_dointvec_minmax_conv_param {\n", - "\tint *min;\n", - "\tint *max;\n", - "};\n", - "\n", - "static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,\n", - "\t\t\t\t\t int *valp,\n", - "\t\t\t\t\t int write, void *data)\n", - "{\n", - "\tstruct do_proc_dointvec_minmax_conv_param *param = data;\n", - "\tif (write) {\n", - "\t\tint val = *negp ? -*lvalp : *lvalp;\n", - "\t\tif ((param->min && *param->min > val) ||\n", - "\t\t (param->max && *param->max < val))\n", - "\t\t\treturn -EINVAL;\n", - "\t\t*valp = val;\n", - "\t} else {\n", - "\t\tint val = *valp;\n", - "\t\tunsigned long lval;\n", - "\t\tif (val < 0) {\n", - "\t\t\t*negp = true;\n", - "\t\t\t*lvalp = (unsigned long)-val;\n", - "\t\t} else {\n", - "\t\t\t*negp = false;\n", - "\t\t\tlval = (unsigned long)val;\n", - "\t\t}\n", - "\t\t*lvalp = jiffies_to_msecs(lval);\n", - "\t}\n", - "\treturn 0;\n", - "}\n", + "static DEFINE_PER_CPU(int, bpf_prog_active);\n", "\n", "/**\n", - " * proc_dointvec_jiffies - read a vector of integers\n", - " * @table: the sysctl table\n", - " * @write: %TRUE if this is a write to the sysctl file\n", - " * @buffer: the user buffer\n", - " * @lenp: the size of the user buffer\n", - " * @ppos: file position\n", + " * trace_call_bpf - invoke BPF program\n", + " * @prog: BPF program\n", + " * @ctx: opaque context pointer\n", " *\n", - " * Reads/writes a string from/to the user buffer, treated as an ASCII string. \n", + " * kprobe handlers execute BPF programs via this helper.\n", + " * Can be used from static tracepoints in the future.\n", " *\n", - " * Returns 0 on success.\n", - " */\n", - "int proc_dointvec_jiffies(struct ctl_table *table, int write,\n", - "\t\t\t void __user *buffer, size_t *lenp, loff_t *ppos)\n", - "{\n", - " return do_proc_dointvec(table,write,buffer,lenp,ppos,\n", - "\t\t \t NULL,NULL);\n", - "}\n", - "\n", - "/*\n", - " * Taint values can only be increased by someone holding\n", - "\t * cgroup_lock, and that's us. The worst that can happen is that we\n", - "\t * have some link structures left over\n", - "\t */\n", - "\tret = allocate_cgrp_cset_links(css_set_count, &tmp_links);\n", - "\tif (ret)\n", - "\t\tgoto cancel_ref;\n", - "\n", - "\troot->kf_root = kernfs_create_root(&cgroup_kf_syscall_ops,\n", - "\t\t\t\t\t KERNFS_ROOT_CREATE_DEACTIVATED,\n", - "\t\t\t\t\t root_cgrp);\n", - "\tif (IS_ERR(root->kf_root)) {\n", - "\t\tret = PTR_ERR(root->kf_root);\n", - "\t\tgoto exit_root_id;\n", - "\t}\n", - "\troot_cgrp->kn = root->kf_root->kn;\n", - "\n", - "\tif (root == &cgrp_dfl_root)\n", - "\t\tbase_files = cgroup_dfl_base_files;\n", - "\telse\n", - "\t\tbase_files = cgroup_legacy_base_files;\n", - "\n", - "\tret = cgroup_addrm_files(cgrp, base_files, true);\n", - "\tif (ret)\n", - "\t\tgoto destroy_root;\n", - "\n", - "\t/*\n", - "\t * There must be no failure case after here, since rebinding takes\n", - "\t * care of subsystems' refcounts, which are explicitly dropped in\n", - "\t * the failure exit path.\n", - "\t */\n", - "\tlist_add(&root->root_list, &cgroup_roots);\n", - "\tcgroup_root_count++;\n", - "\n", - "\t/*\n", - "\t * Link the root cgroup in this hierarchy into all the css_set\n", - "\t * objects.\n", - "\t */\n", - "\tdown_write(&css_set_rwsem);\n", - "\thash_for_each(css_set_table, i, cset, hlist)\n", - "\t\tlink_css_set(&tmp_links, cset, root_cgrp);\n", - "\tup_write(&css_set_rwsem);\n", - "\n", - "\tBUG_ON(!list_empty(&root_cgrp->self.children));\n", - "\tBUG_ON(atomic_read(&root->nr_cgrps) != 1);\n", - "\n", - "\tkernfs_activate(root_cgrp->kn);\n", - "\tret = 0;\n", - "\tgoto out;\n", - "\n", - "destroy_root:\n", - "\tkernfs_destroy_root(root->kf_root);\n", - "\troot->kf_root = NULL;\n", - "exit_root_id:\n", - "\tcgroup_exit_root_id(root);\n", - "cancel_ref:\n", - "\tpercpu_ref_exit(&root_cgrp->self.refcnt);\n", - "out:\n", - "\tfree_cgrp_cset_links(&tmp_links);\n", - "\treturn ret;\n", - "}\n", - "\n", - "static struct event_subsystem *\n", - "create_new_subsystem(const char *name)\n", - "{\n", - "\tstruct module_param_attrs *new_mp;\n", - "\tstruct attribute **new_attrs;\n", - "\tunsigned int i;\n", - "\n", - "\t/* We don't bother to find any names.\n", - " */\n", - "int kallsyms_lookup_size_offset(unsigned long addr, unsigned int n)\n", - "{\n", - "\treturn addr + (n * sizeof(long));\n", - "}\n", - "#endif\n", - "\n", - "static unsigned long get_user_stack_nth(struct pt_regs *regs, unsigned long bp_vaddr)\n", - "{\n", - "\tstruct uprobe_task *utask;\n", - "\tunsigned long orig_ret_vaddr, trampoline_vaddr;\n", - "\tbool chained = false;\n", - "\n", - "\tif (!get_xol_area())\n", - "\t\treturn;\n", - "\n", - "\tutask = get_utask();\n", - "\tif (!utask)\n", - "\t\treturn -ENOMEM;\n", - "\n", - "\txol_vaddr = xol_get_insn_slot(uprobe);\n", - "\tif (!xol_vaddr)\n", - "\t\treturn -ENOMEM;\n", - "\n", - "\tutask->xol_vaddr = xol_vaddr;\n", - "\tutask->vaddr = bp_vaddr;\n", - "\n", - "\terr = arch_uprobe_pre_xol(&uprobe->arch, regs);\n", - "\tif (unlikely(err)) {\n", - "\t\txol_free_insn_slot(current);\n", - "\t\treturn err;\n", - "\t}\n", - "\n", - "\tutask->active_uprobe = uprobe;\n", - "\tutask->state = UTASK_SSTEP;\n", - "\treturn 0;\n", - "}\n", - "\n", - "/*\n", - " * If we are singlestepping, then ensure this thread is not connected to\n", - " * non-fatal signals until completion of singlestep. When xol insn itself\n", - " * triggers the signal, restart the original insn even if the task is increasing\n", - "\t\t * or lowering its prio, so...\n", + " * Return: BPF programs always return an integer which is interpreted by\n", + " * kprobe handler as:\n", + " * 0 - return from kprobe (event is filtered out)\n", + " * 1 - store kprobe event into ring-buffer,\n", + "\t\t * so return zero here\n", "\t\t */\n", - "\t\tif (!rq->dl.overloaded)\n", - "\t\t\tpull_dl_task(rq);\n", + "\t\tret = 0;\n", + "\t\tgoto out;\n", + "\t}\n", + "\n", + "\tif (trigger) {\n", + "\t\tnumber = strsep(&trigger, \":\");\n", + "\n", + "\t\tret = -EINVAL;\n", + "\t\tif (!strlen(number))\n", + "\t\t\tgoto out_free;\n", "\n", "\t\t/*\n", - "\t\t * If we now have a earlier deadline task than p,\n", - "\t\t * then reschedule, provided p is still on the\n", - "\t * reader page.\n", - "\t */\n", - "\tif (rb_is_head_page(cpu_buffer, next_page, &tail_page->list)) {\n", + "\t\t * We use the callback data field (which is a pointer)\n", + "\t\t * as our counter.\n", + "\t\t */\n", + "\t\tret = kstrtoul(number, 0, &data->count);\n", + "\tif (ret)\n", + "\t\tgoto out_free;\n", "\n", - "\t\t/*\n", - "\t\t * If the commit is not on the instruction boundary */\n", - "\t\tif ((unsigned long)p->addr != ftrace_addr)\n", - "\t\t\treturn -EILSEQ;\n", - "\t\tp->flags |= KPROBE_FLAG_FTRACE;\n", - "#else\t/* !CONFIG_KPROBES_ON_FTRACE */\n", - "\t\treturn -EINVAL;\n", - "#endif\n", - "\t}\n", - "\treturn 0;\n", - "}\n", - "\n", - "static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs)\n", - "{\n", - "\tunsigned long ret = regs_return_value(regs);\n", - "\n", - "\tif (ret != (rand1 / div_factor)) {\n", - "\t\thandler_errors++;\n", - "\t\tpr_err(\"incorrect value in kretprobe handler2\\n\");\n", - "\t}\n", - "\tif (krph_val == 0) {\n", - "\t\thandler_errors++;\n", - "\t\tpr_err(\"call to kretprobe entry handler failed\\n\");\n", + " out_reg:\n", + "\t/* Don't let event modules unload while probe registered */\n", + "\tret = try_module_get(file->event_call->mod);\n", + "\tif (!ret) {\n", + "\t\tret = -EBUSY;\n", + "\t\tgoto out_free;\n", "\t}\n", "\n", - "\tkrph_val = rand1;\n", - "\treturn 0;\n", - "}\n", - "\n", - "static struct kimage *do_kimage_alloc_init(void)\n", - "{\n", - "\tstruct kimage *image;\n", - "\n", - "\t/* Allocate a controlling structure */\n", - "\timage = do_kimage_alloc_init();\n", - "\tif (!image)\n", - "\t\treturn -ENOMEM;\n", - "\n", - "\timage->start = entry;\n", - "\n", - "\tret = copy_user_segment_list(image, nr_segments, segments);\n", - "\tif (ret)\n", - "\t\tgoto out_free_image;\n", - "\n", - "\tret = sanity_check_segment_list(image);\n", - "\tif (ret)\n", - "\t\tgoto out_free_image;\n", - "\n", - "\tret = sanity_check_segment_list(image);\n", - "\tif (ret)\n", - "\t\tgoto out_free_post_load_bufs;\n", + "\tret = __ftrace_event_enable_disable(file, 1, 1);\n", + "\tif (ret < 0)\n", + "\t\tgoto skip_full_check;\n", "\n", + "\tenv->explored_states = kcalloc(env->prog->len,\n", + "\t\t\t\t sizeof(struct verifier_state_list *),\n", + "\t\t\t\t GFP_USER);\n", "\tret = -ENOMEM;\n", - "\timage->control_code_page = kimage_alloc_control_pages(image,\n", - "\t\t\t\t\t get_order(KEXEC_CONTROL_PAGE_SIZE));\n", - "\tif (!image->control_code_page) {\n", - "\t\tpr_err(\"Could not allocate swap buffer\\n\");\n", - "\t\t\tgoto out_free_control_pages;\n", - "\t\t}\n", + "\tif (!env->explored_states)\n", + "\t\tgoto skip_full_check;\n", + "\n", + "\tret = check_cfg(env);\n", + "\tif (ret < 0)\n", + "\t\tgoto out_put;\n", + "\tret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);\n", + "\t/*\n", + "\t * The above returns on success the # of functions enabled,\n", + "\t * but if it didn't find any functions it returns zero.\n", + "\t * Consider no functions a failure too.\n", + "\t */\n", + "\tif (!ret) {\n", + "\t\tret = -ENOENT;\n", + "\t\tgoto out_disable;\n", + "\t} else if (ret < 0)\n", + "\t\tgoto out_free;\n", + "\n", + " out_reg:\n", + "\t/* Don't let event modules unload while probe registered */\n", + "\tret = try_module_get(file->event_call->mod);\n", + "\tif (!ret) {\n", + "\t\tret = -EBUSY;\n", + "\t\tgoto out_free;\n", "\t}\n", "\n", - "\t*rimage = image;\n", - "\treturn 0;\n", - "out_free_control_pages:\n", - "\tkimage_free_page_list(&image->control_pages);\n", - "out_free_post_load_bufs:\n", - "\tkimage_file_post_load_cleanup(image);\n", - "out_free_image:\n", - "\tkfree(image);\n", + "\tret = trace_event_enable_disable(event_enable_file, 1, 1);\n", + "\tif (ret < 0)\n", + "\t\tgoto out_disable;\n", + "\t/* Just return zero, not the number of enabled functions */\n", + "\tret = 0;\n", + " out:\n", + "\tmutex_unlock(&ftrace_lock);\n", + "\n", "\treturn ret;\n", "}\n", "\n", - "#ifdef CONFIG_KEXEC_FILE\n", - "static int kexec_calculate_store_digests(struct kimage *image);\n", - "#endif\n", + "#ifdef CONFIG_MODULES\n", "\n", - "/* Location of the reserved area for the crash kernel */\n", - "struct resource crashk_res = {\n", - "\t.name = \"Crash kernel\",\n", - "\t.start = 0,\n", - "\t.end = 0,\n", - "\t.flags = IORESOURCE_BUSY | IORESOURCE_MEM\n", - "};\n", + "#define next_to_ftrace_page(p) container_of(p, struct ftrace_page, next)\n", "\n", - "int kexec_should_crash(struct task_struct *p)\n", + "void ftrace_release_mod(struct module *mod)\n", "{\n", - "\tif (p)\n", - "\t\tprintk(\"%16s:%5d [%p, %3d]\", p->comm, task_pid_nr(p), p, p->prio);\n", - "\telse\n", - "\t\tprintk(\"\");\n", - "}\n", + "\tstruct module_attribute *attr;\n", + "\tint i;\n", "\n", - "static void printk_lock(struct rt_mutex *lock, int print_owner)\n", - "{\n", - "\tif (lock->name)\n", - "\t\tprintk(\" [%p] {%s}\\n\",\n", - "\t\t\tlock, lock->name);\n", - "\telse\n", - "\t\tprintk(\" [%p] {%s:%d}\\n\",\n", - "\t\t\tlock, lock->file, lock->line);\n", - "\n", - "\tif (print_owner && rt_mutex_owner(lock)) {\n", - "\t\tprintk(\".. ->owner: %p\\n\", lock->owner);\n", - "\t\tprintk(\".. held by: \");\n", - "\t\tprintk_task(rt_mutex_owner(lock));\n", - "\t\tprintk(\"\\n\");\n", + "\tfor (i = KDB_MAXBPT - 1; i >= 0; i--)\n", + "\t\tif (rdp->nxttail[i] == rdp->nxttail[RCU_DONE_TAIL])\n", + "\t\t\t\trdp->nxttail[i] = rsp->orphan_donetail;\n", + "\t\trsp->orphan_donelist = NULL;\n", + "\t\trsp->orphan_donetail = &rsp->orphan_donelist;\n", "\t}\n", - "}\n", - "\n", - "void rt_mutex_debug_task_free(struct task_struct *task)\n", - "{\n", - "\tDEBUG_LOCKS_WARN_ON(!RB_EMPTY_ROOT(&task->pi_waiters));\n", - "\tDEBUG_LOCKS_WARN_ON(task->pi_blocked_on);\n", + "\tif (rsp->orphan_nxtlist != NULL) {\n", + "\t\t__call_rcu_nocb_enqueue(rdp, rsp->orphan_nxtlist,\n", + "\t\t\t\t\trsp->orphan_nxttail, ql, qll, flags);\n", + "\t\tql = qll = 0;\n", + "\t\trsp->orphan_nxtlist = NULL;\n", + "\t\trsp->orphan_nxttail = &rsp->orphan_nxtlist;\n", + "\t}\n", + "\treturn true;\n", "}\n", "\n", "/*\n", - " * We fill out the fields in the waiter to store the information about\n", - " * the deadlock. We print when we return. act_waiter can be NULL in\n", - " * case of a remove waiter operation.\n", - " */\n", - "void debug_rt_mutex_deadlock(enum rtmutex_chainwalk chwalk,\n", - "\t\t\t\t struct rt_mutex_waiter *waiter,\n", - "\t\t\t\t struct rt_mutex *lock);\n", - "extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock,\n", - "\t\t\t\t struct task_struct *proxy_owner);\n", - "extern int rt_mutex_start_proxy_lock(struct rt_mutex *lock,\n", - "\t\t\t struct hrtimer_sleeper *timeout)\n", - "{\n", - "\tmight_sleep();\n", + " * If necessary, kick off a new grace period if one is needed.\n", + "\t */\n", + "\trcu_report_qs_rsp(rsp, flags); /* releases rnp->lock. */\n", + "}\n", "\n", - "\treturn rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout,\n", - "\t\t\t\t RT_MUTEX_FULL_CHAINWALK,\n", - "\t\t\t\t rt_mutex_slowlock);\n", + "/*\n", + " * Record a quiescent state for all tasks that were preempted within an RCU read-side critical\n", + " * sections. This function also enables RCU lockdep checking.\n", + " */\n", + "void rcu_scheduler_starting(void)\n", + "{\n", + "\tWARN_ON(num_online_cpus() != 1);\n", + "\tWARN_ON(nr_context_switches() > 0);\n", + "\trcu_scheduler_active = 1;\n", + "}\n", + "\n", + "/*\n", + " * Compute the per-level fanout, either using the exact fanout specified\n", + " * or balancing the tree, depending on CONFIG_RCU_FANOUT_EXACT.\n", + " */\n", + "static void __init rcu_init_levelspread(struct rcu_state *rsp)\n", + "{\n", + "\tint cpu;\n", + "\tunsigned long sum = 0;\n", + "\tunsigned long t;\n", + "\n", + "\tfor_each_possible_cpu(cpu) {\n", + "\t\tt = ACCESS_ONCE(per_cpu_ptr(sp->per_cpu_ref, cpu)->c[1]);\n", + "\t}\n", + "\treturn sum;\n", "}\n", "\n", "/**\n", - " * rt_mutex_timed_lock - lock a rt_mutex interruptible\n", - " *\t\t\tthe timeout structure is provided\n", - " *\t\t\tby the caller\n", + " * cleanup_srcu_struct - deconstruct a sleep-RCU structure\n", + " * @sp: structure to clean up.\n", " *\n", - " * @lock:\t\tthe rt_mutex to take\n", - " * @state:\t\t the state the task should block in (TASK_INTERRUPTIBLE\n", - " * \t\t\t or TASK_UNINTERRUPTIBLE)\n", - " * @timeout:\t\t the pre-initialized and started timer, or NULL for none\n", - " * @waiter:\t\t the pre-initialized rt_mutex_waiter\n", + " * Must invoke this after you are finished using a given srcu_struct that\n", + " * was initialized via init_srcu_struct(), else you leak memory.\n", + " */\n", + "void cleanup_srcu_struct(struct srcu_struct *sp)\n", + "{\n", + "\tif (WARN_ON(srcu_readers_active(sp)))\n", + "\t\treturn; /* Leakage unless caller handles error. */\n", + "\tfree_percpu(sp->per_cpu_ref);\n", + "\tsp->per_cpu_ref = NULL;\n", + "}\n", + "EXPORT_SYMBOL_GPL(cleanup_srcu_struct);\n", + "\n", + "/*\n", + " * Counts the new reader in the appropriate per-CPU\n", + " * element of the srcu_struct. Note that this may well be a different\n", + " * CPU than that which was incremented by the corresponding srcu_read_lock().\n", + " * Must be called from process context.\n", " *\n", - " * lock->wait_lock must be held by the caller. A call to unqueue_me() must\n", - " * be paired with exactly one earlier call to queue_me().\n", + " * Note that it is permissible to omit this call entirely, as is\n", + " * done in architectures that do no CPU-hotplug error checking.\n", + " */\n", + "int cpu_check_up_prepare(int cpu)\n", + "{\n", + "\tif (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) {\n", + "\t\tatomic_set(&per_cpu(cpu_hotplug_state, cpu), CPU_UP_PREPARE);\n", + "\t\treturn 0;\n", + "\t}\n", + "\n", + "\tswitch (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD)\n", + "\t\tgoto update_state;\n", + "\tudelay(5);\n", + "\n", + "\t/* But if the outgoing CPU dawdles, wait increasingly long times. */\n", + "\twhile (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) != CPU_DEAD) {\n", + "\t\tschedule_timeout_uninterruptible(sleep_jf);\n", + "\t\tjf_left -= sleep_jf;\n", + "\t\tif (jf_left <= 0)\n", + "\t\t\tbreak;\n", + "\t\tsleep_jf = DIV_ROUND_UP(sleep_jf * 11, 10);\n", + "\t}\n", + "update_state:\n", + "\toldstate = atomic_read(&per_cpu(cpu_hotplug_state, cpu));\n", + "\t\tif (oldstate != CPU_BROKEN)\n", + "\t\t\tnewstate = CPU_DEAD;\n", + "\t\telse\n", + "\t\t\tnewstate = CPU_DEAD_FROZEN;\n", + "\t} while (atomic_cmpxchg(&per_cpu(cpu_hotplug_state, cpu),\n", + "\t\t\t\t oldstate, CPU_BROKEN) != oldstate)\n", + "\t\t\tgoto update_state;\n", + "\t\tret = false;\n", + "\t}\n", + "\treturn ret;\n", + "}\n", + "\n", + "/*\n", + " * Called by the outgoing CPU to report its successful death. Return\n", + " * false if this report follows the surviving CPU's timing out.\n", " *\n", - " * Return:\n", - " * 1 - if the futex_q was still queued (and we removed unqueued it);\n", - " * 0 - if the futex_q was already removed by\n" + " * A separate \"CPU_DEAD_FROZEN\" is used when the surviving CPU\n", + " * timed out. This approach allows architectures to omit calls to\n", + " * cpu_check_up_prepare() and cpu_set_state_online() without defeating\n", + " * the next cpu_wait_death()'s polling loop.\n", + " */\n", + "bool cpu_report_death(void)\n", + "{\n", + "\tint oldstate;\n", + "\tint newstate;\n", + "\tint cpu = smp_processor_id();\n", + "\n", + "\tdo {\n", + "\t\toldstate = atomic_read(&per_cpu(cpu_hotplug_state, cpu));\n", + "\tif (oldstate == CPU_DEAD) {\n", + "\t\t/* Outgoing CPU died normally, update state. */\n", + "\t\tsmp_mb(); /* atomic_read() before update. */\n", + "\t\tatomic_set(&per_cpu(cpu_hotplug_state, cpu), CPU_POST_DEAD);\n", + "\t} else {\n", + "\t\t/* Outgoing CPU still hasn't gotten around\n", + " * to dying. In the latter two cases, the CPU might not be set up\n", + " * properly, but it is up to the arch-specific code:\n", + "\t *\n", + "\t * \tinsn -\tcopy_insn() saves the original instruction here for\n", + "\t *\t\tarch_uprobe_analyze_insn().\n", + "\t *\n", + "\t *\tixol -\tpotentially modified instruction to execute out of\n", + "\t *\t\tline, copied to xol_area by xol_get_insn_slot().\n", + "\t */\n", + "\tstruct arch_uprobe\tarch;\n", + "};\n", + "\n", + "struct return_instance {\n", + "\tstruct uprobe\t\t*uprobe;\n", + "\tunsigned long\t\tfunc;\n", + "\tunsigned long\t\tret_ip;\n", + "};\n", + "\n", + "/*\n", + " * trace_flag_type is an enumeration that defines bit\n", + " * positions into trace_flags that controls the output.\n", + " *\n", + " * NOTE: These bits must match the trace_options array in\n", + " * trace.c.\n", + " */\n", + "enum trace_iterator_flags {\n", + "\tTRACE_ITER_PRINT_PARENT\t\t= 0x01,\n", + "\tTRACE_ITER_SYM_OFFSET\t\t= 0x02,\n", + "\tTRACE_ITER_SYM_ADDR\t\t= 0x04,\n", + "\tTRACE_ITER_VERBOSE\t\t= 0x08,\n", + "\tTRACE_ITER_RAW\t\t\t= 0x10,\n", + "\tTRACE_ITER_HEX\t\t\t= 0x20,\n", + "\tTRACE_ITER_BIN\t\t\t= 0x40,\n", + "\tTRACE_ITER_BLOCK\t\t= 0x80,\n", + "\tTRACE_ITER_STACKTRACE\t\t= 0x100,\n", + "\tTRACE_ITER_PRINTK\t\t= 0x200,\n", + "\tTRACE_ITER_PREEMPTONLY\t\t= 0x400,\n", + "\tTRACE_ITER_BRANCH\t\t= 0x800,\n", + "\tTRACE_ITER_ANNOTATE\t\t= 0x1000,\n", + "\tTRACE_ITER_USERSTACKTRACE = 0x2000,\n", + "\tTRACE_ITER_SYM_USEROBJ = 0x4000,\n", + "\tTRACE_ITER_PRINTK_MSGONLY\t= 0x8000,\n", + "\tTRACE_ITER_CONTEXT_INFO\t\t= 0x10000, /* Print pid/cpu/time */\n", + "\tTRACE_ITER_LATENCY_FMT\t\t= 0x20000,\n", + "\tTRACE_ITER_SLEEP_TIME\t\t= 0x40000,\n", + "\tTRACE_ITER_GRAPH_TIME\t\t= 0x80000,\n", + "\tTRACE_ITER_RECORD_CMD\t\t= 0x100000,\n", + "\tTRACE_ITER_OVERWRITE\t\t= 0x200000,\n", + "\tTRACE_ITER_STOP_ON_FREE\t\t= 0x400000,\n", + "\tTRACE_ITER_IRQ_INFO\t\t= 0x800000,\n", + "\tTRACE_ITER_MARKERS\t\t= 0x1000000,\n", + "\tTRACE_ITER_FUNCTION\t\t= 0x2000000,\n", + "};\n", + "\n", + "/*\n", + " * TRACE_ITER_SYM_MASK masks the options in trace_flags that\n", + " * control the output of kernel symbols.\n", + " */\n", + "#define TRACE_ITER_SYM_MASK \\\n", + "\t(TRACE_ITER_PRINT_PARENT|TRACE_ITER_SYM_OFFSET|TRACE_ITER_SYM_ADDR)\n", + "\n", + "extern struct tracer nop_trace;\n", + "\n", + "#ifdef CONFIG_BRANCH_TRACER\n", + "extern int enable_branch_tracing(struct trace_array *tr)\n", + "{\n", + "\tmutex_lock(&event_mutex);\n", + "\n", + "\t/* Disable any event triggers and associated soft-disabled events */\n", + "\tclear_event_triggers(tr);\n", + "\n", + "\t/* Disable any running events */\n", + "\t__ftrace_set_clr_event_nolock(tr, NULL, NULL, NULL, 0);\n", + "\tif (WARN_ON_ONCE(ret)) {\n", + "\t\tpr_warn(\"error on probing function return.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\t/* Enable trace point */\n", + "\t\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\t\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tif (warn)\n", + "\t\tgoto end;\n", + "\n", + "\tret = target(1, 2, 3, 4, 5, 6);\n", + "\n", + "\t/* Disable trace points before removing it */\n", + "\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting test probe.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tif (warn)\n", + "\t\tgoto end;\n", + "\n", + "\tret = target(1, 2, 3, 4, 5, 6);\n", + "\n", + "\t/* Disable trace points before removing it */\n", + "\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\tpr_warn(\"error on getting 2nd test probe.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tret = traceprobe_command(\"r:testprobe2 kprobe_trace_selftest_target \"\n", + "\t\t\t\t \"$retval\", create_trace_kprobe);\n", + "\tif (WARN_ON_ONCE(ret)) {\n", + "\t\tpr_warn(\"error on probing function entry.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\t/* Enable trace point */\n", + "\t\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\t\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tif (warn)\n", + "\t\tgoto end;\n", + "\n", + "\tret = target(1, 2, 3, 4, 5, 6);\n", + "\n", + "\t/* Disable trace points before removing it */\n", + "\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else\n", + "\t\t\tdisable_trace_kprobe(tk, file);\n", + "\t}\n", + "\n", + "\ttk = find_trace_kprobe(\"testprobe2\", KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tif (warn)\n", + "\t\tgoto end;\n", + "\n", + "\tret = target(1, 2, 3, 4, 5, 6);\n", + "\n", + "\t/* Disable trace points before removing it */\n", + "\ttk = find_trace_kprobe(\"testprobe\", KPROBE_EVENT_SYSTEM);\n", + "\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting 2nd test probe.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting 2nd test probe.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn(\"error on getting probe file.\\n\");\n", + "\t\t\t\twarn++;\n", + "\t\t\t} else\n", + "\t\t\t\tenable_trace_kprobe(tk, file);\n", + "\t\t}\n", + "\t}\n", + "\n", + "\tret = traceprobe_command(\"r:testprobe2 kprobe_trace_selftest_target \"\n", + "\t\t\t\t \"$retval\", create_trace_kprobe);\n", + "\tif (WARN_ON_ONCE(ret)) {\n", + "\t\tpr_warn(\"error on probing function entry.\\n\");\n", + "\t\twarn++;\n", + "\t} else {\n", + "\t\t/* Enable trace point */\n", + "\t\ttk = find_trace_kprobe(\"testprobe2\", KPROBE_EVENT_SYSTEM);\n", + "\t\tif (WARN_ON_ONCE(tk == NULL)) {\n", + "\t\t\tpr_warn(\"error on getting 2nd new probe.\\n\");\n", + "\t\t\twarn++;\n", + "\t\t} else {\n", + "\t\t\tfile = find_trace_probe_file(tk, top_trace_array());\n", + "\t\t\tif (WARN_ON_ONCE(file == NULL)) {\n", + "\t\t\t\tpr_warn\n" ] } ],